setxkbmap stop working randomly

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?
 
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.
 
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 &
 
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)
 
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.
 
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.
 
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.
 
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.
 
"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?
 
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.
 
Back
Top