Merge pull request #795 from TheMC47/feat/start-sbs

X.H.StatusBar: Added startAllStatusBars
This commit is contained in:
Tony Zorman 2023-01-24 20:35:34 +01:00 committed by GitHub
commit 339dbbf2fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -172,6 +172,9 @@
some status bars (see this some status bars (see this
[polybar issue](https://github.com/polybar/polybar/issues/2603)). [polybar issue](https://github.com/polybar/polybar/issues/2603)).
* `XMonad.Hooks.StatusBar`
- Added `startAllStatusBars` to start the configured status bars.
### Other changes ### Other changes
## 0.17.1 (September 3, 2022) ## 0.17.1 (September 3, 2022)

View File

@ -56,6 +56,7 @@ module XMonad.Hooks.StatusBar (
spawnStatusBar, spawnStatusBar,
killStatusBar, killStatusBar,
killAllStatusBars, killAllStatusBars,
startAllStatusBars,
) where ) where
import Control.Exception (SomeException, try) import Control.Exception (SomeException, try)
@ -564,3 +565,9 @@ spawnStatusBar cmd = do
killAllStatusBars :: X () killAllStatusBars :: X ()
killAllStatusBars = killAllStatusBars =
XS.gets (M.elems . getPIDs) >>= io . traverse_ killPid >> XS.put (StatusBarPIDs mempty) XS.gets (M.elems . getPIDs) >>= io . traverse_ killPid >> XS.put (StatusBarPIDs mempty)
-- | Start all status bars. Note that you do not need this in your startup hook.
-- This can be bound to a keybinding for example to be used in tandem with
-- `killAllStatusBars`.
startAllStatusBars :: X ()
startAllStatusBars = XS.get >>= traverse_ (sbStartupHook . snd) . getASBs