Mailinglist Archive: opensuse (1264 mails)

< Previous Next >
Re: [opensuse] Mapping and re-mapping Keyboard Keys


On 27/06/17 15:59, Rodney Baker wrote:
On Wednesday, 28 June 2017 0:20:43 ACST Paul Groves wrote:

[...]
put them in ~/.xmodmap and they will be read when <user> logs in, iiuc.
I just booted to opensuse and that works but in ubuntu it doesn't.
Ubuntu apparently uses xkb and ignores the ~./xmodmap file

Anyway as I said If found the Launch keycodes which work fine so it
solves that problem but I need to run the script with all the setkeycode
commands at boot

I tried the usual /etc/init.d
/etc/init.d/rc.local
/etc/rc.local

A few places online say ubuntu no longer uses rc.local ans uses
/etc/rc#.d where # is the runlevel, So i ran the command runlevel which
told me normal boot is runlevel 5

So I put my script in /etc/rc5.d and gave it execute permissions, reboot
and it didn't run :(

Where on earth am I supposed to put this script to run at boot? If I
drop to tty2 and run it manually it works but if I run it under X or
from cron it cannot change key maps.
You don’t put scripts in the rcX.d directories - put them in /etc/init.d, then
(on Ubuntu) use update-rc.d to create the symlinks in the appropriate rcX.d
directories. You’ll need to have all the correct headers in the file
(required-start, required-stop, runlevels etc), so look at existing init.d
scripts and use them as a template.

Bear in mind that debian/Ubuntu has now moved to systemd, and sysvinit is now
deprecated (although lots of packages still use init scripts). Instead of
writing an init script, you could write a systemd unit file and have systemd
execute the script. The final result should be the same, but you’re “future
proofing” it by not relying on a deprecated subsystem.

HTH.
Rodney.


Perfect! I found this using your advice

https://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd#47715


I made the file /etc/systemd/system/ tinykb9805.service (below) which runs my script (has to be executable)

then I ran systemctl enable tinykb9805.service
then I ran systemctl start tinykb9805.service

and it works! Even after reboot :)

File:

[Unit]
Description=Re-map the Tiny KB-9805 PS/2 Keyboard Hotkeys

[Service]
Type=oneshot
ExecStart=/home/paul/ownCloud/bin/tinykb9805_map.sh

[Install]
WantedBy=multi-user.target


Now all of my hotkeys are working fine!

Thanks for all the help everyone.

One annoyance though is the scroll lock LED does not work. I will start a new thread for this.

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >