Why does X loses my keyboard key mapping?

blind Pete 0123peter at gmail.com
Thu Aug 3 00:46:00 UTC 2017


Petter Adsen wrote:

> On 02/08/17 01:30, Rick wrote:
>> Hi,
>> 
>> On my 16.04, I re-map some keyboard keys at login using "xmodmap
>> /home/rick/.Xmodmap" in a shell script. I rarely log out and usually,
>> sometime after 24 hours the system re-maps the keyboard back to its
>> default key settings. Would anyone have any idea what would cause X to
>> do this?
> 
> This is because xmodmap is now obsolete, replaced by the XKB tools.
> xmodmap is no longer guaranteed to work correctly, and any modifications
> made with it will be overwritten the next time an XKB tool runs.
> 
> Look into using setxkbmap and xkbcomp instead.
> 
> https://unix.stackexchange.com/questions/65507/use-setxkbmap-to-swap-the-left-shift-and-left-control/65600
> http://www.pixelbeat.org/docs/xkb_remap/
> 
> Petter

This is beyond my paygrade, but those links suggest that xmodmap is 
obsoleted by xkb tools.  On my system, 4.04.5 LTS, Trusty Tahr, it 
looks like console-setup has obsoleted xkb tools. 

Here is an example from my system; 

$ pwd
/etc/default
$ cat keyboard
# Check /usr/share/doc/keyboard-configuration/README.Debian for
# documentation on what to do after having modified this file.

# The following variables describe your keyboard and can have the same
# values as the XkbModel, XkbLayout, XkbVariant and XkbOptions options
# in /etc/X11/xorg.conf.

#XKBMODEL="pc105"
XKBMODEL="pc104"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS="compose:caps"

# If you don't want to use the XKB layout on the console, you can
# specify an alternative keymap.  Make sure it will be accessible
# before /usr is mounted.
# KMAP=/etc/console-setup/defkeymap.kmap.gz
$ 



-- 
blind Pete
Sig goes here...  





More information about the ubuntu-users mailing list