You are not logged in.

#1 2013-05-11 00:52:09

donut_monger
Member
Registered: 2013-05-11
Posts: 6

[SOLVED] Trying to remap some keys at startup

Hey there everyone, I have a macbook air 4.2 and I recently decided to try out arch linux on it. I've been able to figure most of the configuration out but there's one thing that has  been annoying me. By default, my command key is mapped as super and control as control. I found a way to change this by following these instructions but this means I have to run this command (xmodmap ~/.xmodmaprc) every time I log in. To resolve this I have tried putting it inside my /etc/rc.local file and also ~/.xinitrc but it seems as if these scripts don't even run the command because when I log in the keymap is back to default. Any help is appreciated, thanks!

Last edited by donut_monger (2013-05-13 02:41:48)

Offline

#2 2013-05-11 01:04:43

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Trying to remap some keys at startup

/etc/rc.local is a part of initscripts, which are deprecated https://www.archlinux.org/news/final-sy … n-warning/

Post your ~.xinitrc.
How are you starting X? Do you run 'startx'?

Offline

#3 2013-05-11 01:24:35

donut_monger
Member
Registered: 2013-05-11
Posts: 6

Re: [SOLVED] Trying to remap some keys at startup

Here is my ~/.xinitrc

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

exec gnome-session-cinnamon

xmodmap /home/chris/xmodmaprc

I use Slim login manager so starting X is done through that.

Offline

#4 2013-05-11 01:28:18

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Trying to remap some keys at startup

Put 'xmodmap /home/chris/xmodmaprc' before 'exec gnome-session-cinnamon'. The exec part should always be last, as the second note tells you https://wiki.archlinux.org/index.php/Xinitrc all the following lines will just be ignored.

Last edited by karol (2013-05-11 01:29:49)

Offline

#5 2013-05-11 01:39:06

donut_monger
Member
Registered: 2013-05-11
Posts: 6

Re: [SOLVED] Trying to remap some keys at startup

Ok, I've done that now. It still doesn't work though. I've had this problem with a lot of things I have tried to do on startup like set the backlight, and audio levels. Could there be something wrong with my install? Running the exact same command

 xmodmap /home/chris/.xmodmaprc 

works from the terminal, why does it seem to be ignored in the startup script?

Offline

#6 2013-05-11 01:45:18

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

Re: [SOLVED] Trying to remap some keys at startup

If you are looking for something that doesn't require xmodmap, I am pretty certain this functionality can be handles by xkb itself.

Peruse the file /usr/share/X11/xkb/base.lst.  In it there are a whole shit load of options.  Find the one you need, and then you can set it globally on X start with /etc/X11/xorg.conf.d/10-evdev.conf.  For example, I hate the caps lock with a passion, and I use the windows key as my window manager's mod key.  So 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
...

This is of course assuming that you configure your devices with evdev.

Last edited by WonderWoofy (2013-05-11 01:46:59)

Offline

#7 2013-05-11 02:51:38

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [SOLVED] Trying to remap some keys at startup

Put it in ~/.xsession instead. I'm not sure about slim but kdm/xdm/gdm don't read ~/.xinitrc but they do read ~/.xsession. Least, they do here.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#8 2013-05-11 02:57:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Trying to remap some keys at startup

The wiki says https://wiki.archlinux.org/index.php/SLiM

SLiM reads the local ~/.xinitrc configuration and then launches the desktop according to what is in that file.

Offline

#9 2013-05-11 04:10:12

donut_monger
Member
Registered: 2013-05-11
Posts: 6

Re: [SOLVED] Trying to remap some keys at startup

WonderWoofy wrote:

If you are looking for something that doesn't require xmodmap, I am pretty certain this functionality can be handles by xkb itself.

Peruse the file /usr/share/X11/xkb/base.lst.  In it there are a whole shit load of options.  Find the one you need, and then you can set it globally on X start with /etc/X11/xorg.conf.d/10-evdev.conf.  For example, I hate the caps lock with a passion, and I use the windows key as my window manager's mod key.  So 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
...

This is of course assuming that you configure your devices with evdev.

I don't seem to have a /usr/share/X11/xkb/base.lst file, could you post yours so I can see the options? I tried the option "control:super" but that didn't work. Thanks!

Offline

#10 2013-05-11 04:16:29

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Trying to remap some keys at startup

I think he meant /usr/share/X11/xkb/rules/base.lst. It's provided by xkeyboard-config package.

Last edited by karol (2013-05-11 04:16:53)

Offline

#11 2013-05-11 04:32:30

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

Re: [SOLVED] Trying to remap some keys at startup

karol wrote:

I think he meant /usr/share/X11/xkb/rules/base.lst. It's provided by xkeyboard-config package.

This ^^^

Offline

#12 2013-05-11 05:28:51

donut_monger
Member
Registered: 2013-05-11
Posts: 6

Re: [SOLVED] Trying to remap some keys at startup

Hmm... I've tried a few options now and none of them seem to have any effect on the keys. In my xorg.conf.d I only have evdev and synaptics files so I dont think I'm configuring my keyboard with anything else.

Offline

#13 2013-05-11 14:53:00

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

Re: [SOLVED] Trying to remap some keys at startup

You know if you are configuring through the xorg.conf.d file you have to restart X.  It won't just automtically parse and apply new settings if the file is changed.

If you want to test given settings, there is the xkbcomp commmand.  Here have a look at this for more info.

Offline

#14 2013-05-13 02:39:36

donut_monger
Member
Registered: 2013-05-11
Posts: 6

Re: [SOLVED] Trying to remap some keys at startup

Thanks WonderWoofy, that guide helped a lot, I finally got it working!

Offline

#15 2013-05-13 02:41:03

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

Re: [SOLVED] Trying to remap some keys at startup

Fantastico!  Please mark the thread as [Solved].  This can be done by editing the first post.


Edit: I guess you were probably doing that while I was typing this...

Last edited by WonderWoofy (2013-05-13 02:45:20)

Offline

Board footer

Powered by FluxBB