The bar is stopped because you are starting it as a background job but it is configured to read from stdin (standard input).
The xmobar process is not terminated, you should still see the bar.
If the bar is not visible at all, it could be because it is covered by your desktop. You are already importing XMonad.Hooks.ManageDocks
and using avoidStruts
so you could also use the manageDocks
hook it provides and make xmobar behave like a dock (overrideRedirect=False
in the configuration).
You configured xmobar to read from standard input, so you should have something writing to its standard input. It can be anything, not necessarily xmonad.
You don't have to start xmobar from xmonad, but if you want to show the output provided by XMonad.Hooks.DynamicLog
for instance, it's easier to start it from there.
You can use the xmobar
convenience function, as explained in the doc :
main = xmonad =<< xmobar myConfig
Or you can use the statusBar
function and define your own pretty printing format :
main = xmonad =<< statusBar "xmobar" myPP myToggleKey myConfig
Or directly use dynamicLogWithPP
as shown in the example in the documentation :
main = do
h <- spawnPipe "xmobar -options -foo -bar"
xmonad $ defaultConfig {
...
logHook = dynamicLogWithPP $ defaultPP { ppOutput = hPutStrLn h }
spawnPipe
runs the given command and returns a Handle to its standard input, that handle is then used in defining the ppOutput
function.
This is no ready solution, but an idea: I would use osd_cat
which comes in the package xosd in Fedora Linux together with a cronjob, that checks your battery status.
You can edit your cronjobs with
crontab -e
and you find your battery status in /sys/class/power_supply/
, and there it is in my case BAT1/
with some files charge_now
and charge_full
. With those files, that is with
/sys/class/power_supply/BAT1/charge_now
/sys/class/power_supply/BAT1/charge_full
you could find the percentage remaining in your battery, which could then show you a big message with osd_cat (onscreen display).
Best Answer
You probably want the Wireless plugin which comes with xmobar
http://projects.haskell.org/xmobar/#wireless-interface-args-refreshrate
In your config file, you'd have something like this in the
commands
list: