2

I edited the file /etc/X11/xorg.conf.d/90-keyboard-layout.conf:

Section "InputClass"
    Identifier "keyboard-all"
    MatchIsKeyboard "on"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    Option "XkbLayout" "us,ru"
    #Option "XkbVariant" ""
    Option "XKbOptions" "grp:alt_shift_toggle,grp_led:scroll"
    Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

When the layout is "US", scroll lock diode is turned on. When the layout is "RU", it's turned off.

Everything works correctly, but when I turn off the PC, scroll lock stays turned on. Is it possible to turn it off, when the PC is shut-down?

2
  • 1
    That's odd, most PCs power off the keyboard when they're shut down. What type of keyboard do you have? How are you shutting down the computer? Mar 5, 2015 at 23:13
  • @Gilles The keyboard is an old 101 Packard Bell keyboard, made in 1995. I shut down the computer by clicking: "Start" -> "Log out" -> "Shut down" in XFCE.
    – user4035
    Mar 6, 2015 at 6:07

1 Answer 1

2

You can use the setleds command to change the keyboard leds.

setleds -num -caps -scroll

You'll need to run this from a script executed during shutdown. How to do this depends on what init system your system uses.

With a traditional SysVinit or a system that supports emulation of its scripts, if you have directories called /etc/init/init.d or /etc/init.d, create a script called local_turn_off_leds in this directory containing

#!/bin/sh
setleds -num -caps -scroll

Make it executable (chmod +x local_turn_off_leds) and register it to be executed during shutdown for poweroff:

ln -s ../init.d/local_turn_off_leds /etc/rc0.d

If your init system is Upstart, which is the case if you have a directory called /etc/init, you can create an Upstart job instead.

For Systemd, see How to run a script with systemd right before shutdown?

1
  • No, it doesn't work
    – user4035
    Mar 23, 2015 at 14:51

You must log in to answer this question.

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