Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: How to set NumLock button to "on" after boot in KDE

  1. #1

    Cool How to set NumLock button to "on" after boot in KDE

    For years, the setting of NumLock button in KDE usually does not work. If you set it to "on" in

    System Settings -> Input Devices -> Keyboard

    then this setting most likely will be ignored, and after boot the user has to press that button on the keyboard to have NumLock on. This is bothersome if the password to login contains numbers.

    Google helped to find a solution. If SDDM is used for login screen, which is the default, then add these lines in file
    Code:
    /etc/sddm.conf
    which is likely empty:

    Code:
    [General]
    Numlock=on

  2. #2
    Join Date
    Mar 2020
    Location
    São Leopoldo, RS, Brazil
    Posts
    231

    Default Re: How to set NumLock button to "on" after boot in KDE

    Quote Originally Posted by ZStefan View Post
    For years, the setting of NumLock button in KDE usually does not work. If you set it to "on" in

    System Settings -> Input Devices -> Keyboard

    then this setting most likely will be ignored, and after boot the user has to press that button on the keyboard to have NumLock on. This is bothersome if the password to login contains numbers.
    KDE is only involved after you typed your password.

    For completeness, for virtual consoles you need a different strategy, this works fine:

    Code:
    # systemctl edit getty@.service 
    # # input the next two lines
    [Service]
    ExecStartPre=/bin/sh -c 'setleds -D +num < /dev/%I'
    # # save
    Attempt on tty2 (tty1 is already up so it needs a restart).

    Source: https://wiki.archlinux.org/index.php...bootup#Console
    openSUSE Tumbleweed

  3. #3
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    1,772
    Blog Entries
    1

    Default Re: How to set NumLock button to "on" after boot in KDE

    Quote Originally Posted by ZStefan View Post
    For years, the setting of NumLock button in KDE usually does not work. If you set it to "on" in

    System Settings -> Input Devices -> Keyboard

    then this setting most likely will be ignored, and after boot the user has to press that button on the keyboard to have NumLock on. This is bothersome if the password to login contains numbers.
    Don't tinker. NumLock is set in the bios. System Numlock is set in /etc/sysconfig/keyboard and can be changed using "yast2 sysconfig".
    Code:
    ## Type:        list(bios,yes,no)
    ## Default:     bios
    #
    # NumLock on? ("yes" or "no" or "bios" for BIOS setting)
    # This setting may interfere with GNOME /org/gnome/settings-daemon/peripherals/keyboard/remember-numlock-state DConf key.
    KBD_NUMLOCK="bios"
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), openSUSE Tumbleweed, KDE Plasma 5

  4. #4
    Join Date
    Mar 2020
    Location
    São Leopoldo, RS, Brazil
    Posts
    231

    Default Re: How to set NumLock button to "on" after boot in KDE

    Quote Originally Posted by karlmistelberger View Post
    Don't tinker. NumLock is set in the bios. System Numlock is set in /etc/sysconfig/keyboard and can be changed using "yast2 sysconfig".
    Code:
    ## Type:        list(bios,yes,no)
    ## Default:     bios
    #
    # NumLock on? ("yes" or "no" or "bios" for BIOS setting)
    # This setting may interfere with GNOME /org/gnome/settings-daemon/peripherals/keyboard/remember-numlock-state DConf key.
    KBD_NUMLOCK="bios"
    In my experience, I had to tinker too. There's no NumLock setting in BIOS, and I don't recall the issue being fixed by setting to "yes". I may have done it wrong somehow though, as I was trying to get it working mostly for the graphical session. Later I discovered that in vt's the numpad wouldn't work (no numlock key).

    Code:
    # sudo rg --line-number -w '(/etc/sysconfig/keyboard|setleds)' /usr
    /usr/sbin/kbdsettings:3:    . /etc/sysconfig/keyboard
    /usr/sbin/kbdsettings:19:            /usr/bin/setleds -D +$param < /dev/$tty
    /usr/sbin/kbdsettings:25:            /usr/bin/setleds -D -$param < /dev/$tty
    /usr/sbin/kbdsettings:32:                    /usr/bin/setleds -D +$param < /dev/$tty
    /usr/sbin/kbdsettings:35:                    /usr/bin/setleds -D -$param < /dev/$tty
    /etc/sysconfig/keyboard is used to source this routine, and we can see it uses the setleds above for a given tty.

    Code:
    ## Path:        Hardware/Keyboard
    ## Description: Keyboard settings for the text console
    ## ServiceRestart: kbdsettings
    #
    
    ...
    
    ## Type:        list(bios,yes,no)
    ## Default:     bios
    #
    # NumLock on? ("yes" or "no" or "bios" for BIOS setting)
    # This setting may interfere with GNOME /org/gnome/settings-daemon/peripherals/keyboard/remember-numlock-state DConf key.
    KBD_NUMLOCK="bios"
    
    ...
    
    ## Type:        string
    ## Default:
    #
    # ttys for the above settings 
    # Example: "tty1 tty2"
    # "" for tty's 1-6
    #
    KBD_TTY=""
    It shouldn't have anything to do with X. Are you positive it works for X, and if so, have you set KBD_TTY to include tty7? On X it fails to call setleds, or more precisely, to open /dev/tty7.
    openSUSE Tumbleweed

  5. #5
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    1,772
    Blog Entries
    1

    Default Re: How to set NumLock button to "on" after boot in KDE

    Quote Originally Posted by awerlang View Post
    In my experience, I had to tinker too. There's no NumLock setting in BIOS, and I don't recall the issue being fixed by setting to "yes". I may have done it wrong somehow though, as I was trying to get it working mostly for the graphical session. Later I discovered that in vt's the numpad wouldn't work (no numlock key).
    KBD_NUMLOCK overrides bios, plasma settings override KBD_NUMLOCK. tty1..6 default to numlock=no and may be changed in /etc/sysconfig/keyboard. X11 checks for file numlock-on which is created or deleted by /usr/sbin/kbdsettings. Settings are:

    Code:
    karl@erlangen:~> localectl
       System Locale: LANG=de_DE.UTF-8
           VC Keymap: de-latin1-nodeadkeys
          X11 Layout: de
           X11 Model: pc105
         X11 Variant: nodeadkeys
         X11 Options: terminate:ctrl_alt_bksp
    karl@erlangen:~>
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), openSUSE Tumbleweed, KDE Plasma 5

  6. #6
    Join Date
    Mar 2020
    Location
    São Leopoldo, RS, Brazil
    Posts
    231

    Default Re: How to set NumLock button to "on" after boot in KDE

    Quote Originally Posted by karlmistelberger View Post
    KBD_NUMLOCK overrides bios, plasma settings override KBD_NUMLOCK. tty1..6 default to numlock=no and may be changed in /etc/sysconfig/keyboard. X11 checks for file numlock-on which is created or deleted by /usr/sbin/kbdsettings. Settings are:

    Code:
    karl@erlangen:~> localectl
       System Locale: LANG=de_DE.UTF-8
           VC Keymap: de-latin1-nodeadkeys
          X11 Layout: de
           X11 Model: pc105
         X11 Variant: nodeadkeys
         X11 Options: terminate:ctrl_alt_bksp
    karl@erlangen:~>
    Thanks, it's indeed a better solution, as it fixes for both consoles and Xorg. I'll propose changing the docs for /etc/sysconfig/keyboard to include that Xorg picks it up too, not just text consoles. Do you think it makes sense? I feel somewhere in the Xorg docs should mention this as well, but have no idea where.
    openSUSE Tumbleweed

  7. #7
    Join Date
    Dec 2008
    Location
    FL, USA
    Posts
    2,326

    Default Re: How to set NumLock button to "on" after boot in KDE

    Quote Originally Posted by awerlang View Post
    Code:
    # systemctl edit getty@.service 
    # # input the next two lines
    [Service]
    ExecStartPre=/bin/sh -c 'setleds -D +num < /dev/%I'
    # # save
    Thanks! It's just what I needed for Fedora on my UEFI installations.
    Reg. Linux User #211409 *** multibooting since 1992
    Primary: 15.1,TW,15.2 & 13.1 on Haswell w/ RAID
    Secondary: eComStation (OS/2)&15.1 on 965P/Radeon
    Tertiary: TW,15.2,15.1,Fedora,Debian,more on Kaby Lake,Q45,Q43,G41,G3X,965G,Cedar,Caicos,Oland,GT218&&&

  8. #8

    Default Re: How to set NumLock button to "on" after boot in KDE

    Quote Originally Posted by karlmistelberger View Post
    KBD_NUMLOCK overrides bios, plasma settings override KBD_NUMLOCK. tty1..6 default to numlock=no and may be changed in /etc/sysconfig/keyboard. X11 checks for file numlock-on which is created or deleted by /usr/sbin/kbdsettings.
    If plasma has no way of inheriting/using the current value of KBD_NUMLOCK then someone should file an issue with Plasma IMHO...

  9. #9
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    1,772
    Blog Entries
    1

    Default Re: How to set NumLock button to "on" after boot in KDE

    Quote Originally Posted by TriMoon View Post
    If plasma has no way of inheriting/using the current value of KBD_NUMLOCK then someone should file an issue with Plasma IMHO...
    System Settings > Input Devices > Keyboard > NumLock on Plasma Startup has:

    1. Turn on
    2. Turn off
    3. Leave unchanged
    AMD Athlon 4850e (2009), openSUSE 13.1, KDE 4, Intel i3-4130 (2014), i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), openSUSE Tumbleweed, KDE Plasma 5

  10. #10

    Default Manual needed

    With this much knowledge, can somebody write a small manual

    "How to have NumLock on always, no matter how the booting is done and at what level opensuse runs"?

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •