
On Sat, Feb 11, 2012 at 07:22:03PM -0600, Leo Alekseyev wrote:
I am using xmonad on a tablet PC where I sometimes change the screen orientation. Unfortunately, Xmobar doesn't properly rescale itself when the screen goes from portrait to landscape. If I kill it and then restart, the new Xmobar instance doesn't communicate with the Xmonad LogHook anymore. The only solution for me right now is restarting Xmonad, which is suboptimal because (1) config takes noticeable time to compile and (2) my workspace / window configuration gets completely fubared on every Xmonad restart (e.g. all the terminal windows like to move themselves to a single workspace even though there isn't a doShift directive to do so in the config (it might have something to do with my using compositing).
I don't have an answer to your xmobar question (I use dzen). But I also use Xmonad on a tablet. Rather than restarting being sub-optimal, I actually find it rather useful to restart Xmonad with a different configuration when I switch to tablet mode. It's useful to have things configured differently when running in tablet mode, where there's no (physical) keyboard and the primary input method is a stylus. I have two separate Xmonad configurations, and use scripts to switch between them automatically when switching between laptop to tablet mode. The two Xmonad configurations are stored in xmonad-laptop.hs and xmonad-tablet.hs (taking advantage of modular configs to factor out the common parts into a separate module), and the compiled versions are saved to xmonad-laptop-i386-linux and xmonad-tablet-i386-linux. xmonad.hs and xmonad-i386-linux are initially symlinks to the "laptop" files. When switching to tablet mode, the script updates these symlinks to point to the "tablet" files, and restarts Xmonad. Switching back to laptop mode reverses the process. Since the source and compiled configs that the symlinks point to always match, Xmonad detects that they don't need to be recompiled, so it restarts very quickly. (The script actually does a bit of additional juggling to avoid having to compile the two Xmonad configs manually, and allow the usual Xmonad compile-after-update magic to work for both configs.) I've attached my xmonad-rotate-screend script, which does the symlink juggling and restarts Xmonad. It actually does this automatically when it sees that I've switched to tablet mode, but you could adapt it to your needs if interested. (The automatic screen rotation relies on another pair of scripts, which detect when I switch to tablet mode (unfortunately by polling, as my laptop doesn't generate an ACPI event when rotating the screen) and uses xrandr to rotate the screen orientation. I've also attached those scripts, in case they're useful, though you'd have to modify them for your system.) HTH, Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org