Skip to content

Instantly share code, notes, and snippets.

@stefansundin
Last active March 6, 2024 18:23
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stefansundin/6987698 to your computer and use it in GitHub Desktop.
Save stefansundin/6987698 to your computer and use it in GitHub Desktop.
Xmodmap for Chromebook Pixel. This is customized for a Swedish layout, you might want to edit these lines for your preferred layout. Use 'xmodmap -pke' to print your current Xmodmap.
! Chromebook Pixel Xmodmap
! https://gist.github.com/stefansundin/6987698
! setxkbmap -layout se
! xmodmap .Xmodmap
! xev
! Startup applications:
! Command: sh -c "xmodmap ~/.Xmodmap"
! I also manually bind F4 and F5 in Ubuntu's keyboard shortcuts:
! Keyboard -> Shortcuts -> Windows
! Toggle maximization state: F4
! Lower window below other windows: F5
! Maximize window vertically: Shift+F4
! Maximize window horizontally: Ctrl+F4
! = <1:Key> <2:Shift+Key> <3:mode_switch+Key> <4:mode_switch+Shift+Key> <5:AltGr+Key> <6:AltGr+Shift+Key> <7:???>
! Prior = Page Up
! Next = Page Down
! less = <
! greater = >
! AltGr+ikolpö = Insert,Delete,Home,End,Page Up,Page Down (like the 3x2 keys above the arrow keys on normal keyboards)
keycode 31 = i I i I Insert idotless rightarrow
keycode 45 = k K k K Delete ampersand kra
keycode 32 = o O o O Home Home oe
keycode 46 = l L l L End End lstroke
keycode 33 = p P p P Prior THORN thorn
keycode 47 = odiaeresis Odiaeresis odiaeresis Odiaeresis Next Oslash oslash
! Shift+Backspace = Delete
keycode 22 = BackSpace Delete BackSpace BackSpace NoSymbol NoSymbol Terminate_Server
! AltGr+,.- = <>|
keycode 59 = comma semicolon comma semicolon less dead_ogonek dead_cedilla
keycode 60 = period colon period colon greater dead_abovedot periodcentered
keycode 61 = minus underscore minus underscore bar dead_abovedot dead_belowdot
! AltGr+Shift+c = |
keycode 54 = c C c C copyright bar copyright
! Shift+Key to the left of 1 = ~
keycode 49 = section asciitilde section asciitilde paragraph threequarters
! bind F1 and F2 to back and forward
! Use Shift+F1 or Shift+F2 to use F1 and F2 actions, e.g. rename a file
keycode 67 = XF86Back F1 F1 F1 F1 F1 XF86Switch_VT_1
keycode 68 = XF86Forward F2 F2 F2 F2 F2 XF86Switch_VT_2
! bind F3 to refresh
keycode 69 = XF86Refresh F3 F3 F3 F3 F3 XF86Switch_VT_3
! bind F6, F7 to brightness down and up
keycode 72 = XF86MonBrightnessDown F6 F6 F6 F6 F6 XF86Switch_VT_6
keycode 73 = XF86MonBrightnessUp F7 F7 F7 F7 F7 XF86Switch_VT_7
! bind F8, F9, F10 to mute, voldown, volup
keycode 74 = XF86AudioMute F8 F8 F8 F8 F8 XF86Switch_VT_8
keycode 75 = XF86AudioLowerVolume F9 F9 F9 F9 F9 XF86Switch_VT_9
keycode 76 = XF86AudioRaiseVolume F10 F10 F10 F10 F10 XF86Switch_VT_10
! Remove nobreakspace when accidentally using AltGr+Shift+Space
keycode 65 = space space space space space space space
! external keyboards:
! bind caps lock to super
! keycode 66 = Super_R Caps_Lock Caps_Lock NoSymbol Caps_Lock Caps_Lock
! Apple Wireless Keyboard, scatter and applications keys
keycode 128 = F4 NoSymbol XF86LaunchA NoSymbol XF86LaunchA XF86LaunchA
keycode 212 = Super_R NoSymbol XF86LaunchB NoSymbol XF86LaunchB XF86LaunchB
# Chromebook Pixel keymap for Linux console. To install:
# sudo curl -fL -o /opt/pixel.kmap https://gist.githubusercontent.com/stefansundin/6987698/raw/pixel.kmap
# sudo vim /etc/rc.local
# loadkeys /opt/pixel.kmap
# NOTE: You have to use these commands in a real terminal, if you try to use them in X
# you will get the error "Couldn't get a file descriptor referring to the console"
# dumpkeys prints the current configuration
# You can load the default keymap again with "sudo loadkeys -d"
# If you can't find /usr/share/keymaps/defkeymap.map, you must first (before loading any new keymap!):
# sudo mkdir /usr/share/keymaps
# dumpkeys > defkeymap.map
# sudo mv defkeymap.map /usr/share/keymaps/
# showkey prints keycodes (like xev)
# sudo loadkeys console-keymap.kmap
# 27,41,46 = }~c
# 51,52,53 = ,.-
# 59,60,61 = F1 F2 F3
# 103,105,108,106 = ↑←↓→
altgr keycode 27 = tilde
altgr keycode 41 = tilde
shift altgr keycode 46 = bar
altgr keycode 51 = less
altgr keycode 52 = greater
altgr keycode 53 = bar
keycode 59 = Home
keycode 60 = End
alt keycode 103 = Scroll_Backward
alt keycode 108 = Scroll_Forward
altgr keycode 105 = Home
altgr keycode 106 = End
@chouch0u
Copy link

I have some troblem on xmodmap. I using the same comfiguration but F9 and F10 still as XF86AudioLowerVolume and XF86AudioUpVolume. I don't know why.
System: Ubuntu 18.04
Chromebook: Chromebook Pixel 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment