Running xmodmap from rc.local

sudo -u user xmodmap -e "keycode 123 = NoSymbol"

Why doesn’t this work in rc.local?

I want to disable a key, 123 is just place holder

if I run in terminal it works, but not in rc.local

Because it is called before X is started. Try xprofile or xsession(rc): xprofile - ArchWiki.

1 Like

Hi thomas85135 - and welcome to the forum. :slight_smile:

Even if X was started, I believe that you would still need to know the name of the $DISPLAY and the MIT-MAGIC-COOKIE for the DISPLAY you want to change. :slight_smile:

You can have a look at command like:

xauth list

in various terminals/qubes.

:slight_smile:

Thanks for your comment

I added xmodmap -e "keycode 123 = NoSymbol"

to .xsessionrc and .xprofile and restarted the Qube, but it did nothing. Executing manually with sh .xsessionrc applies the command

Hi

I know about $DISPLAY and tried export DISPLAY=:0 before the command in my rc.local, it did not work

xauth list says this:
xauth: file /home/user/.Xauthority does not exist

Hi thomas85135

What does xauth list show in a terminal from dom0? – is XAUTHORITY defined? :wink:

Does it change, if you use:

xauth -f /some/where list

Note: The path to /some/where should be shown by echo $XAUTHORITY in a dom0 terminal.

:slight_smile:

So it shows in dom0 terminal, but important detail, I’m trying to do this only in AppVM so it doesn’t apply everywhere

Will I still need this from dom0?

Hi thomas85135

Sorry – I didn’t see the fact/detail, that you would like to keep it in/for a only AppVM.

Looking at the processes started in an AppVM, it doesn’t look like the processes are started like usual by the Display Manager – and then it makes sense that .xsessionrc and .xprofile isn’t executed like a normal setup. So I don’t know the best way to resolve your issue … :frowning:

:slight_smile:

1 Like

Hi

so it works with DISPLAY=:0 sudo -u user xmodmap -e "your command here", but it has to be run at the right time

it takes a few seconds before command works, so i waited for xorg to run in appvm

then i run it, but it only works sometimes, very unreliable

i tried to do this, run in loop xmodmap command, then read back xmodmap -pk and if change was done then stop, but still unreliable every 3rd boot it wouldn’t apply

In the end I just run my command in a loop for 60 seconds after appvm boot, I don’t like it but it works