You are not logged in.

#1 2021-11-05 15:29:26

jfk
Member
Registered: 2017-12-11
Posts: 131

[SOLVED] Mapping Xmodmap at startup

Gnome 40 on Arch

This is a recurrent topic apparently but I still cannot understand why setting (for instance)

xmodmap -e "keycode 248 = XF86Launch0"

or

sleep 10 && xmodmap -e "keycode 248 = XF86Launch0"

in my autostart folder would not work whereas entering the command in the command line runs as expected.

[Desktop Entry]
Name=Keycode 240 
Comment=Run sleep 10 && xmodmap -e "keycode 248 = XF86Launch0"
Exec=sleep 10 && xmodmap -e "keycode 248 = XF86Launch0"
Terminal=false
Type=Application

Last edited by jfk (2021-11-05 17:04:52)

Offline

#2 2021-11-05 15:59:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,241

Re: [SOLVED] Mapping Xmodmap at startup

The direct version likely gets overridden when gnome applies its xkb config and the second one is bash syntax where it's not supposed to be.

Exec=bash -c 'sleep 10 && touch /tmp/yup.works && xmodmap -e "keycode 248 = XF86Launch0"'

Online

#3 2021-11-05 17:09:13

jfk
Member
Registered: 2017-12-11
Posts: 131

Re: [SOLVED] Mapping Xmodmap at startup

Thank you, lenghten sleep to 20 made it work:

bash -c 'sleep 20 && xmodmap -e "keycode 248 = XF86Launch0"'

I actually ticked "open in terminal" in my startup GUI thinking I could consequently avoid writing bash. I dont know why I had this in mind.

Last edited by jfk (2021-11-06 01:25:51)

Offline

#4 2021-11-05 20:13:09

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,241

Re: [SOLVED] Mapping Xmodmap at startup

You *may* not need to execute this in a dedicated bash process, but that vastly depends on how the runner that executes the line actually does so (no idea about gnome)
The 20 second sleep requirement seems excessive, but if that was one requirement, you might actually not have to use a subshell here (but I don't know and you'd have to try)

Online

Board footer

Powered by FluxBB