You are not logged in.

#1 2013-06-01 19:15:11

EvanPurkhiser
Member
From: San Francisco
Registered: 2010-08-17
Posts: 225
Website

[Solved] Move xmodmap settings to xorg.conf?

Hey guys,

I've been trying to figure out how I could move my xmodmap keyboard mappings into my xorg.conf.

It seems like I'll have to create a custom keyboard mapping, but I'm not entirely positive.

Any ideas?

Last edited by EvanPurkhiser (2013-06-03 04:48:19)

Offline

#2 2013-06-01 19:45:53

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Move xmodmap settings to xorg.conf?

First of all, on most systems, you should be using /etc/X11/xorg.conf.d/* instead of the single xorg.conf file.  Though I think that the nvidia (maybe ATI) proprietary setup involves generating a single xorg.conf... though I don't know much about that.

Second, it would have been nice if you had included your xmodmap settings in the post rather than linking.  Putting them in code tags is probably the best way for things that aren't so long that they require a pastebin.

Third, looking over your settings in your xmodmap configuration file, only one of the things would be possible to do in the xorg.conf file.  That is the caps lock part. I actually do this very change, and I have this:

% cat /etc/X11/xorg.conf.d/10-evdev.conf
...
Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
	Option "XkbOptions" "caps:super"
EndSection
... 

It is that "XkbOptions" like that handles it.  You can find available settings in /usr/share/X11/xkb/rules/base.lst.  But I think that changing the actual mapping of your other keys to XF86* stuff would require that you actually edit the keymap file itself.  The xorg.conf[.d] changes can only accomodate common customizations, and I think that your particular preferences cannot be seen as common unfotunately.  The file that (I think) sets the keys to what they are if you are using evdev is located at /usr/share/X11/xkb/keycodes/evdev.  But if you edit that, it will likely be overwritten by an update.  Good luck!

Edit: BTW, if you hit the "quote" button of this post, you can see how code tags are done in the 10-evdev.conf box above.

Edit2: If karol happens upon this thread, take a look at that path to base.lst.  I got it right this time!

Last edited by WonderWoofy (2013-06-01 19:47:26)

Offline

#3 2013-06-01 19:57:46

EvanPurkhiser
Member
From: San Francisco
Registered: 2010-08-17
Posts: 225
Website

Re: [Solved] Move xmodmap settings to xorg.conf?

Thanks,

Sorry about not putting my xbindkeys xmodmap config in a code block.

You're right about most likely having to edit the /usr/share/X11/xkb/keycodes/evdev file.

I suspect I might be able to create a "custom keyboard layout" that changes the keysyms.

Last edited by EvanPurkhiser (2013-06-01 21:03:28)

Offline

#4 2013-06-01 20:58:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Move xmodmap settings to xorg.conf?

I have created a custom layout for myself for the console, but not for use in X.  This is because there is the high level tool xmodmap.  You now mention xbindkeys, but I think (paritcularly from your config you posted) that you are using xmodmap.  No?

Out of curiousity, and maybe this might help in finding an ultimate solution that fits your needs, why is it you are trying to move away from using xmodmap in the first place?  I did it because the only change I have is to make the caps lock a super key, and I want this to be persistent no matter what environment I want to use.  But in your case, what is motivating you to try to rid yourself of xmodmap?

Offline

#5 2013-06-01 21:12:54

EvanPurkhiser
Member
From: San Francisco
Registered: 2010-08-17
Posts: 225
Website

Re: [Solved] Move xmodmap settings to xorg.conf?

Whoops, sorry about that. I did indeed mean xmodmap =)

The reason I was asking about moving away from xmodmap is because right now I'm setting up systemd --user as my session manager, and when writing my service files it felt funny to include a oneshot xmodmap service. Since keyboard mappings are more of a configuration than they are a service I thought it would make more sense for my custom mappings to be passively part of my xorg settings instead of having to be configured everytime xorg starts.

Another reason I would like for it to be part of my xorg config is so I don't have to re-execute xmodmap if I unplug and plug-in my keyboard.

Offline

#6 2013-06-01 21:34:05

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Move xmodmap settings to xorg.conf?

Well, I also use systemd --user, and though I no longer use xmodmap, I do use xrdb to load my xresources, which I think is a similar situation.  What I have done is created a xrdb.path which will run xrdb.service if ~/.Xresources exists.  This is pretty much achieving the same thing as [[ -f ~/.Xresources ]] && xrdb ~/.Xresources like you would include in your xinitrc.  I don't think it is really strange at all to use systemd to set up your working environment, and as I oneshot service, it runs and quits, so you get an easy way to check if it worked with systemctl, and it is a type of process/service that doesn't hang around either, taking up resources. 

As far as the USB keyboard situation, does pluggin in your keyboard generate any interesting udev signals?  For example, if you do "udevadm monitor" then plug/unplug your keyboard, I would imagine that udev has to detect it.  So if this is the case, I think this would be a good example of a time in which you could use a udev rule to call a systemd service, or even just xmodmap itself.

Still, making your own keyboard layout might be a decent way to go.  Do you know if /etc/X11 overrules /usr/share/X11?  I'm thinking that if it works in a similar way to how /etc/systemd overrules /usr/lib/systemd, then maybe you could create an upgrade proof keymap there.

Offline

#7 2013-06-03 04:46:57

EvanPurkhiser
Member
From: San Francisco
Registered: 2010-08-17
Posts: 225
Website

Re: [Solved] Move xmodmap settings to xorg.conf?

I've made some good progress on this.

I've been able to successfully replicate my xmodmap settings with a new keyboard layout. The layout configuration is simply

default
partial alphanumeric_keys modifier_keys
xkb_symbols "evan-custom" {
  include "us"

  # Capslock should be Super_L
  include "capslock(super)"

  # Forward and back on numpad 1 and 3
  key <KP1> { [ XF86_Back    ] };
  key <KP3> { [ XF86_Forward ] };

  # Voice PTT on numpad 2
  key <KP2> { [ XF86_Send ] };
};

By placing this file in /usr/share/X11/xkb/symbols/ I can then set it at runtime by running "setxkbmap evan-custom". Though I have configured it in the xorg conf with the following:

Section "InputClass"
	Identifier      "edev keyboard catchall"
	MatchIsKeyboard "on"
	MatchDevicePath "/dev/input/event*"
	Driver          "evdev"

	Option "XkbLayout" "evan-custom"
EndSection

For now, I've stored these files in my ~/.config/X11 directory and symlinked them to the proper location. To answer your question WonderWoffy, it doesn't look like it XKB reads config files from /etc/x11. But I'm still experimenting with this.

This basically answers my question so I'll go ahead and mark this as solved. But it would be nice if I didn't have to symlink the configuration files into the system config directories and x11 would read from my ~/.config/X11. But I don't think it does sad

Offline

#8 2013-06-03 14:45:30

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Move xmodmap settings to xorg.conf?

Yeah, I don't think it works that way for sure.  I've definitely never heard of a per-user X11 configuration directory (or X11 XDG directory like you've tried).  I have to wonder though, if you are creating a whole new customization to the keymap (as in a whole not fle), why not just put it in /usr/share/X11/xkb/symbols?  I mean the whole issue I was poiting out earlier was that changes to existing files will be overwritten since pacman doesn't track those evdev files.  But as a wholly new file, it is out of the scope of pacman anyway, so it doesn't matter where you put them.  Now, in the event that there might happen to be a package that has that exact file path, it would error out with "file exists in the filesystem".  Also, if you were to remove all packages that owned /usr/share/X11/xkb/symbols, the directory would even remain because there would still be a file there. 

So I think the way you have decided to go would be safe in keeping the configuration with the rest of the xkb stuff.  The only time you have to worry about updates is if you take a file that is from a package and is not listed in the backups array (these files can be seen if you use "pacman -Qii <package>").

I would be interested to know what you determine to be the final solution.  Please update this thread when find what you feel is a satisfactory end.

Offline

Board footer

Powered by FluxBB