Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Setting numlock on startup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
arnvidr
Guru
Guru


Joined: 19 Aug 2004
Posts: 595
Location: Oslo, Norway

PostPosted: Tue Feb 19, 2019 10:54 am    Post subject: [SOLVED] Setting numlock on startup Reply with quote

Hi all,

Do people have a reliable way to set numlock on at bootup?

I've tried the numlock init script, but that only switched on the light, not the functionality, so worse than nothing.

If I run x11-misc/numlockx after I log in, that does the trick, so I tried to put that into /root/.xinitrc with no result. This file also has a setxkbmap command in it, which seems to do what I want reliably, but nothing happens to my numlock.

Any ideas? Better places to place the command?

How do I technically turn on this function anyway? I can switch the light on in numerous ways, including messing with stuff in /sys/class/leds/ but I'm not sure how this functionality is actually activated.
_________________
Noone wrote:
anything


Last edited by arnvidr on Thu Feb 28, 2019 11:13 am; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43175
Location: 56N 3W

PostPosted: Tue Feb 19, 2019 11:07 am    Post subject: Reply with quote

arnvidr,

Hopefully you never run Xorg as root, so /root/.xinitrc is never consulted.
It belongs in ~/.xinitrc fot the normal user that will startx.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21753
Location: here

PostPosted: Tue Feb 19, 2019 11:14 am    Post subject: Reply with quote

But you mean in a tty or in X?
numlock script work for tty numlockx for X, you can see here how enable it on X depending on what wm/de you use
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
arnvidr
Guru
Guru


Joined: 19 Aug 2004
Posts: 595
Location: Oslo, Norway

PostPosted: Wed Feb 20, 2019 11:25 am    Post subject: Reply with quote

NeddySeagoon wrote:
Hopefully you never run Xorg as root, so /root/.xinitrc is never consulted.

I assume I don't, since my numlockx call does nothing.
I remember trying a few solutions for setting my keyboard map (setxkbmap), so I guess a different solution has worked as well then, since presumably this script is never called. Will try to disable it here and see if I still have my desired keyboard layout on next boot.
fedeliallalinea wrote:
you can see here how enable it on X depending on what wm/de you use

That seems perfect, cheers. I use sddm, so I added a /etc/sddm.conf file with numlock=on, so I'll see if I can check if that works this evening.
_________________
Noone wrote:
anything
Back to top
View user's profile Send private message
gaurav712
n00b
n00b


Joined: 12 Jan 2019
Posts: 24
Location: India

PostPosted: Thu Feb 21, 2019 5:43 am    Post subject: Reply with quote

I use xdotool to do that.
Code:
xdotool key Num_Lock &
Back to top
View user's profile Send private message
arnvidr
Guru
Guru


Joined: 19 Aug 2004
Posts: 595
Location: Oslo, Norway

PostPosted: Thu Feb 21, 2019 9:10 am    Post subject: Reply with quote

gaurav712 wrote:
I use xdotool to do that.
Code:
xdotool key Num_Lock &
That's a great tip! I have xdotool installed already, so even if the previous tips work out, I'll check that out and see if I can avoid having numlockx installed as well.
_________________
Noone wrote:
anything
Back to top
View user's profile Send private message
C5ace
Apprentice
Apprentice


Joined: 23 Dec 2013
Posts: 277
Location: Brisbane, Australia

PostPosted: Thu Feb 21, 2019 10:49 am    Post subject: Reply with quote

Run:
Code:
rc-update add numlock default

Then reboot and log into a terminal.

This allows me to login from a terminal using a password containg letters and numbers without pushing the Numlock key.
_________________
Observation after 30 years working with computers:
All software has known and unknown bugs and vulnerabilities. Especially software written in complex, unstable and object oriented languages such as python, perl, C++, C#, Rust and the likes.
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 21753
Location: here

PostPosted: Thu Feb 21, 2019 12:07 pm    Post subject: Reply with quote

C5ace wrote:
This allows me to login from a terminal using a password containg letters and numbers without pushing the Numlock key.

but probably not in X as arnvidr want
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
C5ace
Apprentice
Apprentice


Joined: 23 Dec 2013
Posts: 277
Location: Brisbane, Australia

PostPosted: Thu Feb 21, 2019 1:34 pm    Post subject: Reply with quote

I use Xfce. With Xfce open Applications -> Settings -> Keyboard -> Behavior and tick "Restore numlock state on startup". This will rembar the last numlock state when loging out of Xfce.
_________________
Observation after 30 years working with computers:
All software has known and unknown bugs and vulnerabilities. Especially software written in complex, unstable and object oriented languages such as python, perl, C++, C#, Rust and the likes.
Back to top
View user's profile Send private message
gaurav712
n00b
n00b


Joined: 12 Jan 2019
Posts: 24
Location: India

PostPosted: Thu Feb 21, 2019 7:16 pm    Post subject: Reply with quote

arnvidr wrote:
gaurav712 wrote:
I use xdotool to do that.
Code:
xdotool key Num_Lock &
That's a great tip! I have xdotool installed already, so even if the previous tips work out, I'll check that out and see if I can avoid having numlockx installed as well.
I use xdotool for the same reason :) .
Back to top
View user's profile Send private message
samidarko
n00b
n00b


Joined: 10 Aug 2014
Posts: 27

PostPosted: Tue Feb 26, 2019 6:48 am    Post subject: Reply with quote

Maybe it will be useful for someone. I'm using Awesome WM.

I have a the end of my awesome configuration "rc.lua"

Code:
do
    local icons = {
        'nm-applet', 'parcellite', 'numlockx'
        }
    for _,icon in pairs(icons) do
        awful.spawn(icon)
    end
end
Back to top
View user's profile Send private message
arnvidr
Guru
Guru


Joined: 19 Aug 2004
Posts: 595
Location: Oslo, Norway

PostPosted: Thu Feb 28, 2019 11:14 am    Post subject: Reply with quote

Just a quick update to let people know that the sddm.conf trick worked just fine, so I haven't tried the xdotool solution, but either way, I could remove numlockx from my system, as it wasn't needed.

Thanks all! :D
_________________
Noone wrote:
anything
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum