I have a simple script that I want to run at startup but it doesn't get run. The script is simple, it just swaps right Option key with right CMD key on my Apple Magic Keyboard:

xmodmap -e "keycode 108 = Super_R"
xmodmap -e "keycode 134 = ISO_Level3_Shift"

When I run the script from the terminal it works fine. It doesn't work at startup. I have added an entry to Startup Application like this. enter image description here

I am running Ubuntu 21.10 with X11 with passwordless login so I want the keys to be swapped after my desktop shows up.

type Xorg
Xorg is /usr/bin/Xorg

Why doesn't it work? What am I doing wrong?

  • Related? bash script not running at startup
    – roaima
    Jun 23 at 11:13
  • Not really. I saw this.
    – jedi
    Jun 23 at 11:14
  • I used to have a similar script and it worked fine. I have automatic login to my Ubuntu.
    – jedi
    Jun 23 at 11:15
  • Do you intend this to run at system startup, when the GUI login manager starts, or when you log in with your account?
    – roaima
    Jun 23 at 11:15
  • 1
    A shot in the dark, but if you're using a recent Ubuntu version you may be using Wayland as your display server and AFAIK xmodmap is X only and won't run on Wayland. Jun 23 at 11:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.