1

I use Linux Mint 20.2 (with Mate desktop environment). I need to make permanent some modifications of the keyboard mapping, as explained in the chosen answer to this question. In other words, I need to execute the xmodmap command at each startup, and make it read its configuration file ~/.Xmodmap.

I have followed all the suggestions in this post, but with no success :(

1
  • I did a small progress: following the suggestions in forums.linuxmint.com/viewtopic.php?t=294096 I have created ~/.xprofile, and inside I have written: bash -c "sleep 10; xmodmap $HOME/.Xmodmap" & On reboot, the right ctrl has worked, but only for few seconds (maybe 10 seconds?)... then it has gone back to the usual situation :-/
    – Fabio
    Jan 12, 2022 at 14:58

1 Answer 1

1

Have you tried to use a cron job for this? Cron provides a @reboot parameter to schedule tasks that should run every time the computer is started up. It is used in the following way: Open crontab in a terminal as so:

crontab -e

It will ask you which text editor you would like to use, and then at the bottom of the file you could write the following

# assuming your ~/.Xmodmap file is a list of keycodes that xmodmap can read
@reboot xmodmap /home/<username>/.Xmodmap

It is important to use full paths because the $HOME variable is not initialized at boot time.

Hopefully this helps!

7
  • I tried your suggestion, but it doesn't work... :-/
    – Fabio
    Jan 12, 2022 at 14:56
  • Can you post the content of your ~/.Xmodmap file? Jan 12, 2022 at 16:57
  • Here is the content of my ~/.Xmodmap file: keycode 105 = Control_R NoSymbol Control_R add control = Control_R And if I run: xmodmap ~/.Xmodmap in terminal, it works!
    – Fabio
    Jan 14, 2022 at 8:31
  • What is it exactly you want to right control key to do? Jan 14, 2022 at 17:41
  • Have you tried to add the line if [[ -f /home<user>/.Xmodmap ]] ; then xmodmap /home/<user>/.Xmodmap ; fi to the /etc/X11/xinit/ file? Jan 14, 2022 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .