setxkbmap stop working randomly

Nick-6

Member

Reaction score: 4
Messages: 37

I'm using 13.0-RELEASE-p4 with x11-wm/openbox. I've set keyboard in ~/.config/openbox/autostart as:

Code:
setxkbmap -layout us,xx -option 'grp:win_space_toggle' &

I can't change the keyboard from time to time until I run that command in terminal again.

Do I need to set that in somewhere else? How can I fix that?
 

chrbr

Aspiring Daemon

Reaction score: 416
Messages: 966

I am not sure but since there has been no reply so far...
Please try without the trailing & which will send the command in the background.
May be then it depends on the timings if it has effect on your openbox session or not.
I do not use x11-wm/openbox but have in my ~/.xinitrc
Code:
setxkbmap -layout de
.
Please give it a try without the trailing ampersand.
 
OP
Nick-6

Nick-6

Member

Reaction score: 4
Messages: 37

Please give it a try without the trailing ampersand.
Sorry, I didn't paste the whole content which actually is;
Code:
sakura &
compton &
setxkbmap -layout us,xx -option 'grp:win_space_toggle' &
gxkb &
volumeicon &
redshift &
plank &
tint2 &
xset -dpms
So, if I remove the ampersand, it won't work.

I do not use x11-wm/openbox but have in my ~/.xinitrc
Is it better or more proper to set it in ~/.xinitrc ? I have
Code:
exec openbox-session
in my ~/.xinitrc.

Btw, which DE or WM are you using? Thanks for your reply.


Edited: Added tint2 &
 

eternal_noob

Daemon

Reaction score: 1,252
Messages: 1,516

I use Openbox too and if i setxkbmap in ~/.xinitrc all works like a charm.
Try something like
Code:
setxkbmap -layout us,xx -option 'grp:win_space_toggle'
exec openbox-session

(And don't forget to remove the entry from the autostart file)
 
OP
Nick-6

Nick-6

Member

Reaction score: 4
Messages: 37

Code:
Code:
setxkbmap -layout us,xx -option 'grp:win_space_toggle'
exec openbox-session
I'm testing it and will report back if the issue persists. One thing I don't understand is why don't we need an ampersand after setxkbmap command. I search for some sample ~/.xinitrc files online and found that if we have more than one command, we need to put trailing ampersands except the last one. Thanks.
 

hruodr

Daemon

Reaction score: 326
Messages: 1,016

I have it similar, but still using 11.4:

Code:
# cat .xinitrc 
setxkbmap de
xsetroot -solid black
twm&
xterm -geometry +1+1 -n login -display :0

I think, to run openbox or twm is in principle the same.
 

eternal_noob

Daemon

Reaction score: 1,252
Messages: 1,516

why don't we need an ampersand after setxkbmap command.
You only need an ampersand if you want to run the command in the background. This is only useful if the command doesn't exit but has a loop in it.
Since setxkbmap finishes after you run it, there is no need to run it in the background.
 

mer

Daemon

Reaction score: 668
Messages: 1,038

If you look at your autostart file, you do not have an ampersand after the xset command, simply because as eternal_noob points out "it runs and exits".
I'm guessing the "gxkb" is something for the keyboard? If so having that and the setxkbmap running in the background could be creating a race condition where gxkb actually wants the setxkbmap to do it's thing before it starts.

In general I've always set things in .xinitrc or .xsession if they are "global" for the X session, so things like the xset command, the setxkbmap, and environment variables and then the last line is usually an "exec" of the windowmanger or the desktop environment.
 

T-Daemon

Daemon

Reaction score: 1,114
Messages: 2,019

Alternatively you could create a Xorg configuration file instead:

/usr/local/etc/X11/xorg.conf.d/keyboard.conf
Code:
Section "InputClass"
        Identifier      "All Keyboards"
        MatchIsKeyboard "yes"
        Option          "XkbLayout" "us, xx"
        Option          "XkbOptions" "grp:win_space_toggle"
EndSection

I'm using such a configuration myself, never had a problem.

I can even assign (4) different keyboard layouts for each window separately without special configuration, with x11/sbxkb indicating with a flag the layout in the panel.

I'm running x11-wm/openbox and x11/tint as panel.
 
OP
Nick-6

Nick-6

Member

Reaction score: 4
Messages: 37

"gxkb" is something for the keyboard?
Yes, it is just a graphical indicator for current keyboard on panel.

Alternatively you could create a Xorg configuration file instead:

/usr/local/etc/X11/xorg.conf.d/keyboard.conf
After setting that, my keyboard setting survive even after waking up from zzz. But I still don't know it will randomly stop working later. I'll test and report back if the problem persists.

I'm running x11-wm/openbox and x11/tint as panel.
Me too. But x11/tint shows glitches sometimes. I don't know it is theme related or not. Have you experienced one?
 

T-Daemon

Daemon

Reaction score: 1,114
Messages: 2,019

Me too. But x11/tint shows glitches sometimes. I don't know it is theme related or not. Have you experienced one?
I haven't experienced any unusual behavior. The theme I use is horizontal-light-transparent.

How would you describe those glitches?
 
OP
Nick-6

Nick-6

Member

Reaction score: 4
Messages: 37

How would you describe those glitches?

I wanted to ask the same. I also use tint and for me it works like a charm.
I disabled x11/tint and was using x11/rofi and x11/plank recently. I don't remember how to reproduce that glitch right now. It is something like the white grains on dark background panel. It was distorted and unusable. So, I had to kill and restart the process. Now I'm using x11/tint again. Since now I know it works flawlessly on others, I'll post a new thread and ask if it happens to me again.
The theme I use is horizontal-light-transparent.
I'm using repentance.
 
Top