conformal / spectrwm

A small dynamic tiling window manager for X11.
ISC License
1.34k stars 97 forks source link

Dvorak layout not recognized at startup #128

Closed Spindelhalla closed 7 years ago

Spindelhalla commented 8 years ago

Openbsd 5.9 -stable, Spectrwm 2.7.2

When Spectrwm starts up the first time it doesn't recognize that I'm using the Dvorak layout. A restart is required for it to function properly.

LordReg commented 8 years ago

spectrwm maps keys based on the keyboard layout when it starts. Make sure the dvorak layout is active before spectrwm starts.

Spindelhalla commented 8 years ago

I thought that might have been the reason and I added

setxkbmap -layout us -variant dvorak

at the beginning of my .xinitrc (I use the startx method) but it didn't help. Should I add a few seconds of delay to the execution of spectrwm instead?

Spindelhalla commented 8 years ago

A simple "sleep 5" in my .xinitrc right before spectrwm "solved" the problem for me. Probably not the best solution but good enough for me.

Thanks for your work and the help.

marcopeereboom commented 8 years ago

that's awful... why does the key layout not complete before spectrwm?

ghost commented 8 years ago

why would

mykeyboardcommand && specrtwm

not solve the problem?

marcopeereboom commented 8 years ago

that's what I said. What is happening in that script?

Spindelhalla commented 8 years ago

I have no idea to be honest. My .xinitrc looks like this (I'm on a different machine at the moment but it's simple enough I can remember it). At first it was looking like this:

feh --bg-center path_to_wallpaper
exec spectrwm

Notice that I didn't have to specify the dvorak layout, OpenBSD took care of the X configurations during installation. Then I tried to specify the layout anyway, but it didn't work. It looked like this:

feh --bg-center path_to_wallpaper
setxkbmap -layout us -variant dvorak
exec spectrwm

This is by the way the same .xinitrc I was using with Arch Linux and had no problems there.

Finally I removed setxkbmap -layout us -variant dvorak and added sleep 5 and now it works:

feh --bg-center path_to_wallpaper
sleep 5
exec spectrwm

Five seconds is probably too much, it's just for testing. I can probably reduce it.

Is there anything wrong in my .xinitrc?

marcopeereboom commented 8 years ago

are you using startx or xdm?

if you are using xdm then link your .xinitrc to .xsession

Spindelhalla commented 8 years ago

I use startx

dajohi commented 8 years ago

that looks correct. I need to use sleep for certain things, such as transset-df on new xterms. I think that is a normal thing with X.

Spindelhalla commented 8 years ago

I had to reboot my system a few times yesterday and noticed that even with sleep 5 most of the time I still have to restart spectrwm for it to use the Dvorak layout. Is there a way to make spectrwm restart itself when it starts? It's the only other "solution" that comes to mind for my problem. Otherwise I'll just keep it like this.

dajohi commented 8 years ago

Is system-wide an option? Add this to your xorg.conf?

Section "InputClass"
     Identifier "system-keyboard"
     Option "XkbLayout" "us"
     Option "XkbVariant" ",dvorak"
EndSection
Spindelhalla commented 8 years ago

Thank you for your patience, I really appreciate it. I found something that works, I restarted X many times to be sure it works 100% of the time and here it is, basically the same as before but with setxkbmap -layout us -variant dvorak, even though it feels redundant to me since Xorg is already configured to use Dvorak.

feh --bg-center path_to_wallpaper
setxkbmap -layout us -variant dvorak
sleep 2
exec spectrwm