selecting text using shift + numpad keys on Ubuntu

Mar 21, 2016   #Ubuntu 14.04  #bash  #fix  #workaround 

Have you ever wondered why Home/End keys on your keypad all of a sudden work really strange if you hold Shift?

(Hint: if you press Shift+NumPad Home instead of selecting text you will type ‘1’)

There are numerous solutions available on the Net, and most of them do not work with Ubuntu LTS 14.04.


XKB_OPTIONS=$(gsettings get org.gnome.desktop.input-sources xkb-options | \
    perl -pe "s/\[/\['numpad:microsoft', / unless (/'numpad:microsoft'/); s/,\s*]/\]/") \
    && gsettings set org.gnome.desktop.input-sources xkb-options "$XKB_OPTIONS"; \
    unset XKB_OPTIONS

will fix this once and for all. Changes will be in effect immediately.