Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
2 replaced http://askubuntu.com/ with https://askubuntu.com/
source | link

Add the following command to the startup applicationsstartup applications:

Add the following command to the startup applications:

Add the following command to the startup applications:

1
source | link

Here's how it used to be done, with XKB. More recent versions of Chrome OS now use Ash.

Create a directories called ~/.xkb/keymap, ~/.xkb/types and ~/.xkb/symbols. Create a file ~/.xkb/types/chromebook containing the following definition:

xkb_types "chromebook" {
    virtual_modifiers Alt;
    type "ARROW" {
        modifiers              = Shift+Lock+Alt+Control;
        map[Shift]             = Level2;
        map[Lock]              = Level2;
        map[Alt]               = Level3;
        map[Alt+Shift]         = Level3;
        map[Alt+Lock]          = Level3;
        map[Control+Alt]       = Level4;
        map[Control+Alt+Shift] = Level4;
        map[Control+Alt+Lock]  = Level4;
        level_name[Level1]     = "Base";
        level_name[Level2]     = "Caps";
        level_name[Level3]     = "Alt";
        level_name[Level4]     = "ControlAlt";
    };
}

Create a file ~/.xkb/symbols/chromebook containing the following definition:

xkb_symbols "chromebook" {
    key <UP> {
        type="ARROW",
        repeat=yes,
        [ Up, Up, Prior, Home ],
        actions[Group1] = [
            NoAction(),
            NoAction(),
            RedirectKey(key=<PGUP>, clearmods=Alt),
            RedirectKey(key=<HOME>, clearmods=Control+Alt)
        ]
    };
    key <DOWN> {
        type="ARROW",
        repeat=yes,
        [ Down, Down, Next, End ],
        actions[Group1] = [
            NoAction(),
            NoAction(),
            RedirectKey(key=<PGDN>, clearmods=Alt),
            RedirectKey(key=<END>, clearmods=Control+Alt)
        ]
    };
};

Run the command setxkbmap -print >~/.xkb/keymap/chromebook. Edit the resulting file and add +chromebook inside the include directives for xkb_types and xkb_symbols; the file should look like this:

xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete+chromebook"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(evdev)+chromebook"     };
        xkb_geometry  { include "pc(pc105)"     };
};

Add the following command to the startup applications:

xkbcomp -I ~/.xkb -R ~/.xkb keymap/chromebook $DISPLAY

Note: this is untested, I'm not very familiar with XKB and it's poorly documented. I tried to follow Vincent Lefèvre's XKB tips.