xmodmap and gnome
October 13, 2010 11:20 pm g-s-d, gnome, libgnomekbdGNOME (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%
October 13th, 2010 at 11:47 pm
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.
October 14th, 2010 at 12:19 am
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.
October 14th, 2010 at 12:20 am
Fair enough. And any reasons why you’re not using the same ~/.Xmodmap file, but an ~/.xmodmap file instead?
October 14th, 2010 at 12:26 am
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?)
October 14th, 2010 at 3:53 am
How does this affect Colemak typists?
October 14th, 2010 at 6:56 am
ethana2: Using standard layouts – not affected
October 14th, 2010 at 3:59 am
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!
October 14th, 2010 at 4:29 am
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?
October 14th, 2010 at 6:57 am
Tobias: not without patching xkeyboard-config
October 14th, 2010 at 7:01 am
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.)
October 14th, 2010 at 7:27 am
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?
October 14th, 2010 at 7:51 am
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.
October 14th, 2010 at 9:36 am
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 .. ๐
October 14th, 2010 at 10:20 am
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)
October 14th, 2010 at 10:26 am
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.
October 14th, 2010 at 10:46 am
pycg: thanks for the info
October 14th, 2010 at 10:52 am
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.
October 14th, 2010 at 11:02 am
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
October 14th, 2010 at 11:30 am
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
October 14th, 2010 at 12:02 pm
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”.
October 14th, 2010 at 12:43 pm
Juanjo: ok, thanks
October 14th, 2010 at 4:24 pm
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).
October 14th, 2010 at 4:29 pm
Oh, and my map is named .xmodmap-dan-x200, and I don’t remember why.
October 15th, 2010 at 2:32 am
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.
October 15th, 2010 at 1:15 pm
thumbs up from another xmodmap (ab)user
October 15th, 2010 at 3:24 pm
Ahh, finally gnome will be synchronized with KDE in this area ๐
kxkb has been doing this for quite a while
October 16th, 2010 at 8:59 pm
dalekiy_obriy: gnome has been doing that for years! It is just going to become simpler now.
October 15th, 2010 at 11:29 pm
I need ~/.Xmodmap to have the em dash in my keyboard layout.
October 18th, 2010 at 4:07 pm
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
October 19th, 2010 at 3:16 pm
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.
October 19th, 2010 at 4:51 pm
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.
January 2nd, 2011 at 11:56 pm
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.