I have a simple objective: Keep NumLock always on
OS and DE: Linux Mint 17.3 / 18 Cinnamon
I found this:
So, I created this small script
-rwxr--r-- 1 root root 47 Apr 15 07:50 keep-numlock-on.sh
with content
#!/bin/bash
xmodmap -e 'keycode 77 = NoSymbol'
and I added it to sudo crontab -e like this
@reboot /home/vlastimil/Development/bash/keep-numlock-on.sh
To my surprise, it does not work on reboot and I have no clue as to why.
It works if I manually call the script.
Any help appretiated.
Further attempts:
I created this file in ~/.config/autostart
-rw-r--r-- 1 vlastimil vlastimil 308 Apr 15 10:00 NumLock.desktop
with content
[Desktop Entry]
Encoding=UTF-8
Name=Keep NumLock always on
GenericName=Keep NumLock always on
Comment=Keep NumLock always on
Exec=/home/vlastimil/Development/bash/keep-numlock-always-on.sh
Icon=
Terminal=true
Type=Application
Categories=
X-GNOME-Autostart-enabled=true
Hidden=false
X-GNOME-Autostart-Delay=0
while renaming the script and changing rights to
-rwxrwxrwx 1 vlastimil vlastimil 47 Apr 15 09:56 keep-numlock-always-on.sh
in order to rule out permission issue.
Well, I don't know what I did wrong, but it still does not work :(
EDIT1:
As for the comments, I changed the contents of the script to:
#!/bin/bash
/usr/bin/numlockx on
DISPLAY=":0" xmodmap -e 'keycode 77 = NoSymbol'
But without luck. This is really annoying to me. Please help and if you solve it, you will be rewarded with 50 points. Thank you.
EDIT2:
sudoedit /etc/X11/xinit/xinitrc
and placed the path to the file in there, still no luck.
. /etc/X11/Xsession
/home/vlastimil/Development/bash/keep-numlock-always-on.sh
EDIT3:
xmodmap messes up with my keyboard mappings, making it unusable for this purpose.