xmodmap and gnome

11:20 pm g-s-d, gnome, libgnomekbd

GNOME (gnome-settings-daemon) was supporting custom xmodmap files for ages – as a convenient way to tweak the kbd config. I heard several times about people using that feature – even though it was never important, used by minority. Yesterday that feature has gone from g-s-d.

Since I feel that at least rudimentary xmodmap support is necessary, I made libgnomekbd load $HOME/.xmodmap if it exists. Hope it won’t be much trouble for people to change their configs.

Actually, I would be interested to hear here in comments about the ways people use xmodmap with gnome.

The discussion on IRC was quite hot. My apologies for some bad words, lads – I did not control myself well enough. Even though that does not eliminate my points about importance of xmodmap – and in general about our (GNOME) attitude to features used by minorities. Minorities matter. 99% = 99*1%

32 Responses

  1. Bastien Nocera Says:

    Despite the sarcasm, you’ll notice me removing 500 lines of code, and you adding 30. And that Fedora’s xinitrc scripts already load .Xmodmap files:
    /etc/X11/xinit/xinitrc-common:usermodmap=$HOME/.Xmodmap

    Seems even more bizarre a feature to me if that code you added is supposed to be equivalent to what I removed.

  2. Sergey Udaltsov Says:

    Bastien, my 30 lines are MUCH simplified version of those mighty 500 lines, not really equivalent – just allows to do the same thing, without gui, flexibility and stuff…

    About xinitrc – that’s not an option, because xmodmap have to be reapplied after every xkb reconfiguration. First, at the session startup it has to be done after(!!!) g-s-d reconfigured xkb. And when user changes kbd configuration in g-c-c – xmodmap settings (if exist) have to be reapplied after every xkb config change, made by g-s-d.

  3. Bastien Nocera Says:

    Fair enough. And any reasons why you’re not using the same ~/.Xmodmap file, but an ~/.xmodmap file instead?

  4. Sergey Udaltsov Says:

    Well, there is no formal convention IIRC. I can change to .Xmodmap or check both (it is still much better than scanning entire $HOME, right?)

  5. ethana2 Says:

    How does this affect Colemak typists?

  6. Sergey Udaltsov Says:

    ethana2: Using standard layouts – not affected

  7. ethana2 Says:

    Wait, does this mean that my X-25M SSD under Ubuntu will be able to lose another fraction of a second of boot time?! All I’ve got to do then is benchmark nVidia versus Nouveau boot times, pick the faster one, install CoreBoot, and use BootChart and BUM to cut out the wasted cycles, and ensure that my SSD is TRIM’d… maybe I can finally get down to 4 seconds!

  8. Tobias Says:

    I picked up unused shrink-wrapped aluminium apple keyboard lying around in the lab this week. Was just curious how it feels.

    I like it, but I had to make it conform to PC standard after some use.

    The only way to do that according to some googling was .Xmodmap.

    I need Insert for Shift-Insert. And I need Printscr.

    Also I swapped Mod4 and Mod1, that was awkward.

    And the hid_apple module option to get F# keys.

    In the Gnome Keyboard panel all this cannot be achieved at all, can it?

  9. Sergey Udaltsov Says:

    Tobias: not without patching xkeyboard-config

  10. fatal Says:

    One useful way of using Xmodmap files in gnome is strange people like me who like the dvorak layout but lives in a country which is not-native-english. At the times I have to communicate with my fellow countrymen, I need access to the extra swedish characters. I’ve used Xmodmap in the past to add them to the dvorak layout (on an alt-gr combo).
    (Some might ask why I’m not using “svorak” which is supposed to be the “swedish dvorak”, but that layout is just too fucked up and takes away most of the benefits with dvorak for me.)

  11. Sergey Udaltsov Says:

    fatal: thanks for the info. Are there other people in Sweden that use “Dvorak with extra chars” instead of svorak? If so, perhaps it should be put into xk-c as well?

  12. tvst Says:

    My Thinkpad comes with two extra keys above the left and right arrow keys, which usually map to “previous page” and “next page” in a web browser.

    The problem is that they are *very* easy to press as a mistake — which often moves you away from a long answer you were typing, and makes you lose everything. (Lenovo has since fixed the problem by making those keys be recessed in newer models)

    My solution is to use Xmodmap to map those keys to something else.

    I have also used Xmodmap to map the “Thinkvantage” button (a big blue button that is supposed to open Lenovo’s website or something) to some function key (F40? I don’t remember) so I could use it with Compiz’s “scale” plugin.

  13. Vidar Haarr Says:

    Does this mean that the next time I get an updated g-s-d package in Ubuntu, the following ~/.Xmodmap will no longer work?

    It is my precious .. ๐Ÿ™

  14. Sergey Udaltsov Says:

    Vidar: It will. That’s what my change in libgnomekbd is about (for a moment, it is using .xmodmap, but perhaps I will change that to .Xmodmap)

  15. pycg Says:

    I have a ~/.xmodmap and I toggle between dvorak and a Finnish layout. Preserving all the mods is an important feature for me.

    I have mapped alt-gr to control and the extra key Finnish keyboards have next to the left shift to escape. Emacs and vim are a lot more ergonomic that way, reaching for the old escape and controls was killing my small hands. Plus I have swapped backspace and caps lock, as any sane person should.

  16. Sergey Udaltsov Says:

    pycg: thanks for the info

  17. Juanjo Says:

    I use it in my English keyb laptop to easily use some Spanish stuff (I’m Spanish trapped in a foreign keyboard and country!).

    I don’t know if there’s another way of accomplishing the same, because xmodmap works for me.

  18. Sergey Udaltsov Says:

    Juano: thanks. Did you think about contributing something like us(esp) layout to xkeyboard-config? I think there are many many people who are “trapped” like you

  19. teuf Says:

    I used to use a .Xmodmap file to switch 2 keys on my macbook keyboard which are badly mapped in the default macbook keymap. However, I’ve been meaning to look into fixing this properly for a week now. Now there is one more reason to do this ๐Ÿ™‚
    For what it’s worth, here is my old .Xmodmap
    keycode 49 = less greater lessthanequal greaterthanequal
    keycode 94 = at numbersign

  20. Juanjo Says:

    Sergey: I don’t know if it’d make any sense, my configuration fits my needs… but my partner, for example, uses a different configuration for the same “problem”.

  21. Sergey Udaltsov Says:

    Juanjo: ok, thanks

  22. Dan Says:

    I use an X mod map to remap CapsLk as A, and a few other usability tweaks. I always found the GUI “selector”(?) convenient, but I would be alright with editing gconf keys manually or with a separate applet (keyboard applet is a logical place, in my mind).

  23. Dan Says:

    Oh, and my map is named .xmodmap-dan-x200, and I don’t remember why.

  24. joe Says:

    I use an xmodmap for my Apple Keyboard to completely disable NumLock (swap it for the Clear key symbol) and force the keypad to be permanently numeric so it works more like the mac keyboards that I used my whole computing life. Gnome’s keyboard settings don’t seem to offer this functionality so I stick with xmodmap.

  25. . Says:

    thumbs up from another xmodmap (ab)user

  26. dalekiy_obriy Says:

    Ahh, finally gnome will be synchronized with KDE in this area ๐Ÿ˜‰
    kxkb has been doing this for quite a while

  27. Sergey Udaltsov Says:

    dalekiy_obriy: gnome has been doing that for years! It is just going to become simpler now.

  28. Leonardo Fontenelle Says:

    I need ~/.Xmodmap to have the em dash in my keyboard layout.

  29. Mircea Says:

    I use .xmodmap to map Caps Lock as an additional Level3 select. Thus, my .xmodmap is:

    remove lock = Caps_Lock
    keysym Caps_Lock = ISO_Level3_Shift ISO_Next_Group ISO_Level3_Shift ISO_Next_Group

  30. Hendrik Maryns Says:

    I want .Xmodmap to be read as well. I use it to add โ€“, โ€”, โ€ฆ and ยท to that empty key on my keyboard which is otherwise unused, and to add โ€š and โ€ž (German opening quotes) to the ‘”-key.

  31. E.S. Quinn Says:

    Thank you very much for this patch. ๐Ÿ™‚ I have a…very nonstandard keyboard (122 key IBM terminal keyboard modified to hook up to a standard PC), and i have yet to actually figure out how to write proper xkb code, so i’ve been manually loading an xmodmap file this whole time. This patch gets rid of that ‘manual’ step quite nicely.

  32. Ondrej Bojar Says:

    I use ubuntu 10.04 with gnome and xmodmap for various minor but essential usability tweaks, most notably the Previous/Next keys on Thinkpad/Lenovo keyboard already mentioned by someone above.

    Personally, I hated the magical popup xmodmap selector. To me, it is a proof Gnome is going Windoze. I prefer plain text config files and plain text documentation that can be actually found somewhere. Magical “fool-proof” dialog boxes are not searchable by Google, as Page Rank performs poorly on highly structured (internationalized!) source code.

    To sum up: I’m happy for the selector being removed and for the ~/.[xX]modmap (hardwired whichever way) being added. Just make sure to have a plain text documentation somewhere online! (Generally, gnome is rather poor in this respect in my opinion.)

    However, I’m experiencing rather weird behaviour of Gnome for months (and certainly both before and after the critical October day): every now and then, my custom xmodmap setting gets lost. I can quickly restore it manually by running “xmodmap – < ~/.Xmodmap" but that's extremely annoying.

    I still absolutely don't know what triggers the xmodmap being lost. I don't know how to Google for this irregular behaviour. I don't know what gnome-settings-daemon is supposed to do and it could be messing up my xmodmap settings…

    Any cues?

    Best, Ondrej.

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.