setxkbmap - prevent layout amnesia

I use both the US* and the Czech keyboard layouts on my home desktop, but I use dwm which is quite minimalist and doesn't come with any way to switch between these. Nor should it - dwm is a window manager for hackers, so I bodged my own solution that displays the currently selected layout in dmenu and added the following section to my ~/.xprofile that let's me cycle between them using right-Windows key:
# enable US and CZ layouts, toggle with right-win, other possible grp:* values are...
#    grp:alt_caps_toggle         Alt+Caps Lock
#    grp:alt_space_toggle        Alt+Space
#    grp:menu_toggle             Menu
#    grp:lwin_toggle             Left Win
#    grp:win_space_toggle        Win+Space
#    grp:rwin_toggle             Right Win
setxkbmap -layout us,cz                 
setxkbmap -option                       
setxkbmap -option "grp:rwin_toggle"

However I noticed that periodically this would stop working, I'd be stuck on the US layout and my right-windows key would do nothing. Re-running the three setxkbmap commands would fix things up. 

This eventually annoyed me and I resolved to figure it out. Apparently Linux has some power-management module that will cause some USB devices to disconnect, and when they reconnect they appear as a different device without these keyboard settings.

Unsuprisingly my bodge was responsible for this. The correct solution here was to set my XKBLAYOUT to "uz,cz" and to add "grp:rwin_toggle" to my XKBOPTIONS in /etc/default/keyboard:

$ cat /etc/default/keyboard 

# Consult the keyboard(5) manual page.



Now my layout switching works a little better and my keyboard no longer has bouts of amnesia. That BACKSPACE="guess" line sure does look odd though, I'll need to come back to that at some point.

* = I have no need for the "pound" symbol anymore and US-layout keyboards are much more available