mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-12 02:35:59 -07:00
have 'dzen' use autoStruts to detect the gaps
This commit is contained in:
@@ -51,13 +51,17 @@ module XMonad.Hooks.DynamicLog (
|
|||||||
import XMonad
|
import XMonad
|
||||||
import Data.Maybe ( isJust, catMaybes )
|
import Data.Maybe ( isJust, catMaybes )
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import qualified Data.Map as M
|
||||||
import Data.Ord ( comparing )
|
import Data.Ord ( comparing )
|
||||||
import qualified XMonad.StackSet as S
|
import qualified XMonad.StackSet as S
|
||||||
import System.IO
|
import System.IO
|
||||||
import XMonad.Util.WorkspaceCompare
|
import XMonad.Util.WorkspaceCompare
|
||||||
import XMonad.Util.NamedWindows
|
import XMonad.Util.NamedWindows
|
||||||
import XMonad.Util.Run
|
import XMonad.Util.Run
|
||||||
|
|
||||||
|
import XMonad.Layout.LayoutModifier
|
||||||
import XMonad.Hooks.UrgencyHook
|
import XMonad.Hooks.UrgencyHook
|
||||||
|
import XMonad.Hooks.ManageDocks
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
||||||
@@ -128,6 +132,8 @@ import XMonad.Hooks.UrgencyHook
|
|||||||
--
|
--
|
||||||
-- * add an xmobarEscape function
|
-- * add an xmobarEscape function
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | Run xmonad with a dzen status bar set to some nice defaults. Output
|
-- | Run xmonad with a dzen status bar set to some nice defaults. Output
|
||||||
-- is taken from the dynamicLogWithPP hook.
|
-- is taken from the dynamicLogWithPP hook.
|
||||||
--
|
--
|
||||||
@@ -142,17 +148,33 @@ import XMonad.Hooks.UrgencyHook
|
|||||||
-- If you wish to customize the status bar format at all, you'll have to
|
-- If you wish to customize the status bar format at all, you'll have to
|
||||||
-- use something like 'dynamicLogWithPP' instead.
|
-- use something like 'dynamicLogWithPP' instead.
|
||||||
--
|
--
|
||||||
dzen :: (XConfig (Choose Tall (Choose (Mirror Tall) Full)) -> IO ()) -> IO ()
|
-- The binding uses the XMonad.Hooks.ManageDocks module to automatically
|
||||||
|
-- handle screen placement for dzen, and enables 'mod-b' for toggling
|
||||||
|
-- the menu bar.
|
||||||
|
--
|
||||||
|
dzen ::
|
||||||
|
(XConfig
|
||||||
|
(ModifiedLayout AvoidStruts
|
||||||
|
(Choose Tall (Choose (Mirror Tall) Full))) -> IO t) -> IO t
|
||||||
dzen f = do
|
dzen f = do
|
||||||
h <- spawnPipe ("dzen2" ++ " " ++ flags)
|
h <- spawnPipe ("dzen2" ++ " " ++ flags)
|
||||||
f $ defaultConfig
|
f $ defaultConfig
|
||||||
{ logHook = dynamicLogWithPP dzenPP
|
{ logHook = dynamicLogWithPP dzenPP
|
||||||
{ ppOutput = hPutStrLn h } }
|
{ ppOutput = hPutStrLn h }
|
||||||
|
,layoutHook = avoidStrutsOn [U] (layoutHook defaultConfig)
|
||||||
|
,keys = \c -> mykeys c `M.union` keys defaultConfig c
|
||||||
|
,manageHook = manageHook defaultConfig <+> manageDocks
|
||||||
|
}
|
||||||
where
|
where
|
||||||
|
mykeys (XConfig{modMask=modm}) = M.fromList
|
||||||
|
[((modm, xK_b ), sendMessage ToggleStruts)
|
||||||
|
]
|
||||||
fg = "'#a8a3f7'" -- n.b quoting
|
fg = "'#a8a3f7'" -- n.b quoting
|
||||||
bg = "'#3f3c6d'"
|
bg = "'#3f3c6d'"
|
||||||
flags = "-e '' -w 400 -ta l -fg " ++ fg ++ " -bg " ++ bg
|
flags = "-e '' -w 400 -ta l -fg " ++ fg ++ " -bg " ++ bg
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
-- | An example log hook, which prints status information to stdout in
|
-- | An example log hook, which prints status information to stdout in
|
||||||
-- the default format:
|
-- the default format:
|
||||||
--
|
--
|
||||||
|
Reference in New Issue
Block a user