Is it possible to reset Xmobar without restarting Xmonad?

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). If anyone has advice on how to reset Xmobar without Xmonad restart (or at least how to make the Xmonad restart not touch my window config), I'd love to hear it! --Leo

Excerpts from Leo Alekseyev's message of Sat Feb 11 18:22:03 -0700 2012:
If anyone has advice on how to reset Xmobar without Xmonad restart (or at least how to make the Xmonad restart not touch my window config), I'd love to hear it!
I believe the newer versionns or possibly only the latest git xmobars adjust to screen reconfigurations on the fly. Disclaimer: haven't run xmobar in a long while, and no clue if tablet orientation changes are different from normal xrandr xinerama screen changes. As far as restarting, mod-q should only change window arrangement if you've significantly changed the layoutHook in xmonad.hs. Normally all the windows and workspaces remain as is. You aren't by chance using mod-shift-q which would log you out of X11 are you? Regards, W

Grr.. Sorry, I should have read more carefully. To avoid recompiling, run `xmonad --restart' from a terminal instead. I believe aavogt's config on the wiki archive has a snippet to only recompile when it's really needed. It's very puzzling though that your windows and workspaces change on a mod-q even with xmonad.hs unchanged. W

On Sat, Feb 11, 2012 at 21:32, Wirt Wolff
Grr.. Sorry, I should have read more carefully. To avoid recompiling, run `xmonad --restart' from a terminal instead. I believe aavogt's config on the wiki archive has a snippet to only recompile when it's really needed.
It's very puzzling though that your windows and workspaces change on a mod-q even with xmonad.hs unchanged.
I see this as well, and have for a while; I had thought it was related to some of my experimental modules, but it continued when I removed most of my ManageHook and went to a relatively vanilla setup (but still using FadeInactive); when I removed FadeInactive as well, it went away. I'm inclined to agree with the assertion that it's related to using xcompmgr, which has a number of odd bugs. (I also see slow compilation in that particular setup, but that has less to do with xmonad than with it running in an EC2 micro instance, which really doesn't have enough memory to run ghc properly....) -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

Hi Leo!
restarting Xmonad is suboptimal because config takes noticeable time to compile and all the terminal windows like to move themselves to a single workspace
This sounds really suspicious. The xmonad core includes a significant amount of logic attempting to prevent both of these problems. Would you show us your config and tell us how you're restarting xmonad? ~d

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

On Sun, Feb 12 2012, 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
I use XMonadLog instead of StdinReader. I gave some details on my setup here: http://permalink.gmane.org/gmane.comp.lang.haskell.xmonad/11754. HTH, jao -- Humans think they are smarter than dolphins because we build cars and buildings and start wars etc., and all that dolphins do is swim in the water, eat fish and play around. Dolphins believe that they are smarter for exactly the same reasons. -Douglas Adams

Hi everyone, Thanks for your suggestions! After playing around with the config a little more, I conclude that xcompmgr is definitely the culprit behind destroying window configurations on xmonad restart. Latest xmobar from github does indeed handle screen rotations well! It didn't build under my version of GHC, so I had to upgrade everything to 7.0.4. Also, for the life of me, I can't get the xft font support to work; I was building things like so: cabal install xmonad-contrib --flags="-use_xft" --reinstall (and in the xmobar source dir:) cabal configure --flags="-with_xft" cabal install --flags="-with_xft" Am I missing something? --Leo
participants (6)
-
Brandon Allbery
-
Jose A. Ortega Ruiz
-
Leo Alekseyev
-
Toby Cubitt
-
wagnerdm@seas.upenn.edu
-
Wirt Wolff