You are not logged in.

#1 2014-11-05 04:01:25

mshan
Member
Registered: 2013-05-05
Posts: 105

[SOLVED] remap search key to capslock key using xmodmap

I am trying to remap search key to capslock key using xmodmap in arch on acer c720 chromebook.
If I execute the command

 $ xmodmap -e "keycode 133 = Caps_Lock"

in terminal, it works.
I get the search key works as capslock.
But I cann't get it remaped permenantly.

I created ~/.Xmodmap file using the command

 $ xmodmap -pke > ~/.Xmodmap

then change the line

 keycode 133 = Super_L NoSymbol Super_L

to

 keycode 133 = Caps_Lock NoSymbol Caps_Lock

and then add these lines

 if [ -s ~/.Xmodmap ]; then
    xmodmap ~/.Xmodmap
fi 

in ~/.xinitrc.
It doesn't work.

I am using openbox. I can excute most of commands at startup using autostart file.
But it doesn't work as well if I put this command

 $ xmodmap -e "keycode 133 = Caps_Lock"

in ~/.config/openbox/autostart file.

my autostart file is this:

#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
#

# If you want to use GNOME config tools...
#
#if test -x /usr/lib/openbox/gnome-settings-daemon >/dev/null; then
#  /usr/lib/openbox/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null 2>&1; then
#  gnome-settings-daemon &
#fi

# If you want to use XFCE config tools...
#
#xfce-mcs-manager &

# Setting Wallpaper
(sleep 0.5s && feh --bg-scale /home/msh/Pictures/archlinux-889216.jpg) &

# Start Tint2 panel
(sleep 1s && tint2) &

# us,mm keyboard
(sleep 2s && setxkbmap -layout us,mm -option grp:alt_shift_toggle) &

# xbindkeys
(sleep 2.5s && xbindkeys) &

# Caps_Lock
(sleep 3s && xmodmap -e "keycode 133 = Caps_Lock") & 

I think I should works. But it doesn't.
thz for helps in advance.

Last edited by mshan (2014-11-07 05:22:00)


Amazing !

Offline

#2 2014-11-05 05:15:53

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

Re: [SOLVED] remap search key to capslock key using xmodmap

What does your xinitrc look like?  Does the xmodmap command come after the 'exec' line?

Offline

#3 2014-11-05 05:33:39

mshan
Member
Registered: 2013-05-05
Posts: 105

Re: [SOLVED] remap search key to capslock key using xmodmap

No. my ~/.xinitrc file is like this:

#!/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

if [ -s ~/.Xmodmap ]; then
    xmodmap ~/.Xmodmap
fi 

# exec gnome-session
# exec startkde
# exec startxfce4
# ...or the Window Manager of your choice
# exec /usr/bin/ratpoison
exec openbox-session

actually I have tested both of before and after. But doesn't work.

Last edited by mshan (2014-11-05 10:16:13)


Amazing !

Offline

#4 2014-11-05 15:15:17

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

Re: [SOLVED] remap search key to capslock key using xmodmap

Nothing after the first 'exec' line is read, see the note https://wiki.archlinux.org/index.php/Xinitrc

What happens if you use

xmodmap -e "keycode 133 = Caps_Lock"

in ~/.xinitrc?

Have you tried using setxkbmap?

Offline

#5 2014-11-07 05:20:30

mshan
Member
Registered: 2013-05-05
Posts: 105

Re: [SOLVED] remap search key to capslock key using xmodmap

I can solve it now.
I configured my system to auto startx putting the line:

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

to ~/.bash_profile file
and automatic login to virtual console creating /etc/systemd/system/getty@tty1.service.d/autologin.conf file like this:

[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin username --noclear %I 38400 linux

when my openbox's autostart file like this:

#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
#

# If you want to use GNOME config tools...
#
#if test -x /usr/lib/openbox/gnome-settings-daemon >/dev/null; then
#  /usr/lib/openbox/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null 2>&1; then
#  gnome-settings-daemon &
#fi

# If you want to use XFCE config tools...
#
#xfce-mcs-manager &

# Setting Wallpaper
(sleep 0.5s && feh --bg-scale /home/msh/Pictures/archlinux-889216.jpg) &

# Start Tint2 panel
(sleep 1s && tint2) &

# us,mm keyboard
(sleep 2s && setxkbmap -layout us,mm -option grp:alt_shift_toggle) &

# xbindkeys
(sleep 2.5s && xbindkeys) &

At that time, I can not execute any xmodmap command. But I can execute any other command like compton or something using openbox's autostart file and ~/.xinitrc using ~/.Xmodmap.

the solution is that I configured my system back to normal (manual login and manual startx) removing the line:

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

in ~/.bash_profile file and removing
/etc/systemd/system/getty@tty1.service.d/autologin.conf file.

then I put the lines:

# Caps_Lock
(sleep 3s && xmodmap -e "keycode 133 = Caps_Lock") & 

in my openbox's autostart file.
reboot, check it works (yes it works) and set my system back again to auto login and auto startx by the way I mentioned above.

and then finally reboot again and check it still works (yes it still works)

I have already tested using ~/.Xmodmap and editing ~/.xinitrc with the solution above.
yes it works.

I don't know what I found is the cause of my problem or not.

Last edited by mshan (2014-11-07 05:25:18)


Amazing !

Offline

#6 2015-05-10 04:08:27

reisio
Member
Registered: 2015-05-10
Posts: 1

Re: [SOLVED] remap search key to capslock key using xmodmap

This, in a ~/.config/autostart/foo.desktop file, will work:

xmodmap -e 'keysym Super_L = Caps_Lock'

And now this thread that is marked SOLVED actually is solved, and isn’t just titled with a big damned lie.

Offline

#7 2015-05-10 04:11:31

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] remap search key to capslock key using xmodmap


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB