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 Commented Jun 23, 2022 at 11:13
  • Not really. I saw this.
    – jedi
    Commented Jun 23, 2022 at 11:14
  • I used to have a similar script and it worked fine. I have automatic login to my Ubuntu.
    – jedi
    Commented Jun 23, 2022 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? Commented Jun 23, 2022 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. Commented Jun 23, 2022 at 11:17


You must log in to answer this question.

Browse other questions tagged .