Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
[Software] Programmatically enable Numlock key on boot?
[Software] Programmatically enable Numlock key on boot?
Forgive me if "programmatically" isnt the right term here. Perhaps "automatically" would be more appropriate, but whatever. Anyway, I have a Dell XPS 13 9360. The internal keyboard doesnt have a Numlock key. However, about a week ago I bought an RGB mechanical keyboard, Redragon K556 Pro Wireless, which supports connecting via wired/Bluetooth/wireless 2.5ghz USB dongle chip. I'm really liking it and dont want to return it. It has excellent compatibility with Debian, Windows, and my Playstation 5.
However, I've noticed that the Numlock key isnt always enabled after rebooting, I can tell it's off just by looking at the light above it (or lack of a light, if disabled). I'm not sure if this is a quirk of this keyboard, or if it's just something that's common behavior on mechanical keyboards. And while it's no big deal to just tap the button, I'd rather it always be enabled automatically. Perhaps by editing a config file, having a script autorun on every boot, whatever. I use the keyboard in wired mode most of the time, it's easily identifiable with the lsusb command, perhaps there is a way to use its' "identifier" to recognize the device and auto toggle the Numlock to be on. And in the cases where it's not connected on Debian boot, but instead manually connected to the laptop at whatever time, maybe a script that polls, say, once per minute until the keyboard is detected and toggles the key to be on.
Thanks!
However, I've noticed that the Numlock key isnt always enabled after rebooting, I can tell it's off just by looking at the light above it (or lack of a light, if disabled). I'm not sure if this is a quirk of this keyboard, or if it's just something that's common behavior on mechanical keyboards. And while it's no big deal to just tap the button, I'd rather it always be enabled automatically. Perhaps by editing a config file, having a script autorun on every boot, whatever. I use the keyboard in wired mode most of the time, it's easily identifiable with the lsusb command, perhaps there is a way to use its' "identifier" to recognize the device and auto toggle the Numlock to be on. And in the cases where it's not connected on Debian boot, but instead manually connected to the laptop at whatever time, maybe a script that polls, say, once per minute until the keyboard is detected and toggles the key to be on.
Thanks!
Re: [Software] Programmatically enable Numlock key on boot?
you can use the numlockx program (apt install numlockx) and run "numlockx on" in one of your initialization scripts.
I have that in my .xsessionrc.
I have that in my .xsessionrc.
Re: [Software] Programmatically enable Numlock key on boot?
Thanks for the reply. But I ideally want to enable it immediately after the kernel boots. And hopefully it would remain on, unless I manually press the button, or use a software like numlockx to toggle it. I'm not sure if it would remain on while in a TTY.
Re: [Software] Programmatically enable Numlock key on boot?
I have also used numlockx, works well in X, but to enable right on boot, check first the BIOS/UEFI settings, most of my computers as this laptop have option to set numlock on.
Re: [Software] Programmatically enable Numlock key on boot?
This option does exist in my BIOS, and it's enabled (was already enabled long before I bought a mechanical keyboard). However, as I've already said in the 1st post, the laptop's internal keyboard doesn't have a NumLock key, so it doesn't make any sense for this option to be in my BIOS.
Re: [Software] Programmatically enable Numlock key on boot?
Same here, but tested by connecting a keyboard to the laptop's usb port, and Numlock on led lights at boot. I found also a lot of discussion of the topic when searched, but I think this is the simplest method. I have no bluetooth keyboard to test.Enigma83 wrote: ↑2024-04-06 08:23This option does exist in my BIOS, and it's enabled (was already enabled long before I bought a mechanical keyboard). However, as I've already said in the 1st post, the laptop's internal keyboard doesn't have a NumLock key, so it doesn't make any sense for this option to be in my BIOS.
Re: [Software] Programmatically enable Numlock key on boot?
You could put something in /etc/default/keyboard XKBOPTIONS="" except I'm not sure if there's a specific option to switch numlock on, unless I've missed it. Have a look in the bottom of file /usr/share/X11/xkb/rules/base for the many options. These settings work before X is started despite the X11 connection. In fact when I put "caps:none" in /etc/default/keyboard it didn't work because it was being overridden by the desktop. So you might have to implement two solutions.
- wizard10000
- Global Moderator
- Posts: 666
- Joined: 2019-04-16 23:15
- Location: southeastern us
- Has thanked: 88 times
- Been thanked: 110 times
Re: [Software] Programmatically enable Numlock key on boot?
we see things not as they are, but as we are.
-- anais nin
-- anais nin
Re: [Software] Programmatically enable Numlock key on boot?
I did read somewhere that X11 has something to do with NumLock. Previously (no longer), I was running LXQT with the SDDM display/login manager. When powering on, I could see my external keyboard's NumLock light self-activate, which seemed to imply that the BIOS setting was doing its' job. It remained on during the transition from GRUB to the login screen. Once you reach this point you have gone from real mode to protected mode, the OS is in full control, and the BIOS plays a minimal role in the background. But once I logged in, I noticed that NumLock immediately turned off. I suspect that X11 has something to do with switching it off, or on. LXQT has a setting that can enable NumLock after logging in, but that is of course DE-specific and not generally useful outside of LXQT.
- sunrat
- Administrator
- Posts: 6593
- Joined: 2006-08-29 09:12
- Location: Melbourne, Australia
- Has thanked: 119 times
- Been thanked: 502 times
Re: [Software] Programmatically enable Numlock key on boot?
KDE Plasma has under the Keyboard section of Settings:
- Turn on
- Turn off
- Leave unchanged
I guess "Leave unchanged" retains the BIOS setting.
- Turn on
- Turn off
- Leave unchanged
I guess "Leave unchanged" retains the BIOS setting.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
Re: [Software] Programmatically enable Numlock key on boot?
But I'm not using KDE, or any DE, so it's irrelevant. You basically just backed up what I've already said, that certain DEs can have their own options to override/change NumLock behavior. But it's not useful outside that DE's context.
- sunrat
- Administrator
- Posts: 6593
- Joined: 2006-08-29 09:12
- Location: Melbourne, Australia
- Has thanked: 119 times
- Been thanked: 502 times
Re: [Software] Programmatically enable Numlock key on boot?
You're welcome!
Did the Arch wiki link posted by wizard10000 help at all?
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!
Those who have lost data
...and those who have not lost data YET ” Remember to BACKUP!