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.
keep-numlock-on.shtotouch ~/text.txtDoes it create the file? I am just checking to see if it is getting called and something is failing inside or if just isnt getting called at boot. I don't man I am sorry. I can't sleep, I shouldnt even be on here right nowxmodmapworks only with X11 running so your cron might try to call it before X11 is running. Usenumlockx, either have it called from your login manager or have it in your.config/autostart. For the console, usesetleds. You can read: Activating Numlock on BootupTerminal=true, although it's probably irrelevant in autostart anyway (I'm no expert either, however).