Reputation: 3194
I'm trying to configure xmonad again witout any Haskell knowledge...
I would like to find a way to start xmonad without any statusbar at the beginning. I want to avoid running xmobar in the background and drain battery. Then, when pressing meta-b xmobar should be started. Does anyone know a keyboard shortcut definition for the xmonad config file that starts xmobar and connect the pipes?
...
xmproc <- spawnPipe "xmobar ~/.xmonad/xmobar.hs"
xmonad $ defaults {
logHook = dynamicLogWithPP $ xmobarPP {
ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor xmobarTitleColor "" . shorten 100
, ppCurrent = xmobarColor xmobarCurrentWorkspaceColor ""
, ppSep = " "
}
...
is the standard one, but how can I define it as a keyboard shortcut? When binding a simple "spawn xmobar" it is not starting up (when starting xmobar it in a shell however the statusbar appears). However the simple "spawn xmobar" would probably not have the text from xmonad showing the workspaces connected.
Upvotes: 1
Views: 1596
Reputation: 2772
As of xmonad(-contrib) 0.9, there is a new statusBar function in XMonad.Hooks.DynamicLog. It allows you to use your own configuration for:
The following is an example of how to use it:
~/.xmonad/xmonad.hs
-- Imports.
import XMonad
import XMonad.Hooks.DynamicLog
-- The main function.
main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig
-- Command to launch the bar.
myBar = "xmobar"
-- Custom PP, configure it as you like. It determines what is being written to the bar.
myPP = xmobarPP { ppCurrent = xmobarColor "#429942" "" . wrap "<" ">" }
-- Key binding to toggle the gap for the bar.
toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)
-- Main configuration, override the defaults to your liking.
myConfig = defaultConfig { modMask = mod4Mask }
For more information see the following link: Source
Upvotes: 0