mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 04:31:52 -07:00
X.H.StatusBar: Simplify the fix for def
as k
Fixes: 58e2b803a4
("fix: handle `const (0,0)` from passing `def` as keybinding action")
This commit is contained in:
@@ -156,8 +156,7 @@ import XMonad.Hooks.StatusBar
|
|||||||
-- You should use this function only when the default 'dzen' function does not
|
-- You should use this function only when the default 'dzen' function does not
|
||||||
-- serve your purpose.
|
-- serve your purpose.
|
||||||
--
|
--
|
||||||
dzenWithFlags :: (LayoutClass l Window
|
dzenWithFlags :: LayoutClass l Window
|
||||||
,Read (l Window))
|
|
||||||
=> String -- ^ Flags to give to @dzen@
|
=> String -- ^ Flags to give to @dzen@
|
||||||
-> XConfig l -- ^ The base config
|
-> XConfig l -- ^ The base config
|
||||||
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
||||||
@@ -171,8 +170,7 @@ dzenWithFlags flags = statusBar ("dzen2 " ++ flags) dzenPP toggleStrutsKey
|
|||||||
--
|
--
|
||||||
-- This works pretty much the same as the 'xmobar' function.
|
-- This works pretty much the same as the 'xmobar' function.
|
||||||
--
|
--
|
||||||
dzen :: (LayoutClass l Window
|
dzen :: LayoutClass l Window
|
||||||
,Read (l Window))
|
|
||||||
=> XConfig l -- ^ The base config
|
=> XConfig l -- ^ The base config
|
||||||
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
||||||
dzen = dzenWithFlags flags
|
dzen = dzenWithFlags flags
|
||||||
@@ -183,8 +181,7 @@ dzen = dzenWithFlags flags
|
|||||||
|
|
||||||
-- | This function works like 'xmobarProp', but uses pipes instead of
|
-- | This function works like 'xmobarProp', but uses pipes instead of
|
||||||
-- property-based logging.
|
-- property-based logging.
|
||||||
xmobar :: (LayoutClass l Window
|
xmobar :: LayoutClass l Window
|
||||||
,Read (l Window))
|
|
||||||
=> XConfig l -- ^ The base config
|
=> XConfig l -- ^ The base config
|
||||||
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
||||||
xmobar = statusBar "xmobar" xmobarPP toggleStrutsKey
|
xmobar = statusBar "xmobar" xmobarPP toggleStrutsKey
|
||||||
@@ -192,8 +189,7 @@ xmobar = statusBar "xmobar" xmobarPP toggleStrutsKey
|
|||||||
-- | Like 'statusBarProp', but uses pipes instead of property-based logging.
|
-- | Like 'statusBarProp', but uses pipes instead of property-based logging.
|
||||||
-- Only use this function if your status bar does not support reading from a
|
-- Only use this function if your status bar does not support reading from a
|
||||||
-- property of the root window.
|
-- property of the root window.
|
||||||
statusBar :: (LayoutClass l Window
|
statusBar :: LayoutClass l Window
|
||||||
,Read (l Window))
|
|
||||||
=> String -- ^ The command line to launch the status bar
|
=> String -- ^ The command line to launch the status bar
|
||||||
-> PP -- ^ The pretty printing options
|
-> PP -- ^ The pretty printing options
|
||||||
-> (XConfig Layout -> (KeyMask, KeySym))
|
-> (XConfig Layout -> (KeyMask, KeySym))
|
||||||
@@ -262,8 +258,7 @@ dynamicLogXinerama = withWindowSet $ io . putStrLn . pprWindowSetXinerama
|
|||||||
-- The binding uses the "XMonad.Hooks.ManageDocks" module to automatically
|
-- The binding uses the "XMonad.Hooks.ManageDocks" module to automatically
|
||||||
-- handle screen placement for xmobar, and enables 'mod-b' for toggling
|
-- handle screen placement for xmobar, and enables 'mod-b' for toggling
|
||||||
-- the menu bar.
|
-- the menu bar.
|
||||||
xmobarProp :: (LayoutClass l Window
|
xmobarProp :: LayoutClass l Window
|
||||||
,Read (l Window))
|
|
||||||
=> XConfig l -- ^ The base config
|
=> XConfig l -- ^ The base config
|
||||||
-> XConfig (ModifiedLayout AvoidStruts l)
|
-> XConfig (ModifiedLayout AvoidStruts l)
|
||||||
xmobarProp =
|
xmobarProp =
|
||||||
|
@@ -275,8 +275,7 @@ withSB (StatusBarConfig lh sh ch) conf = conf
|
|||||||
-- Using this function multiple times to combine status bars may result in
|
-- Using this function multiple times to combine status bars may result in
|
||||||
-- only one status bar working properly. See the section on using multiple
|
-- only one status bar working properly. See the section on using multiple
|
||||||
-- status bars for more details.
|
-- status bars for more details.
|
||||||
withEasySB :: (LayoutClass l Window
|
withEasySB :: LayoutClass l Window
|
||||||
,Read (l Window))
|
|
||||||
=> StatusBarConfig -- ^ The status bar config
|
=> StatusBarConfig -- ^ The status bar config
|
||||||
-> (XConfig Layout -> (KeyMask, KeySym))
|
-> (XConfig Layout -> (KeyMask, KeySym))
|
||||||
-- ^ The key binding
|
-- ^ The key binding
|
||||||
@@ -287,16 +286,18 @@ withEasySB sb k conf = docks . withSB sb $ conf
|
|||||||
, keys = (<>) <$> keys' <*> keys conf
|
, keys = (<>) <$> keys' <*> keys conf
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
-- This usually means the user passed 'def' for the keybinding
|
k' conf' = case k conf' of
|
||||||
-- function, and is otherwise meaningless to harmful depending on
|
(0, 0) ->
|
||||||
-- whether 383ffb7 has been applied to xmonad or not. So do what
|
-- This usually means the user passed 'def' for the keybinding
|
||||||
-- they probably intend.
|
-- function, and is otherwise meaningless to harmful depending on
|
||||||
--
|
-- whether 383ffb7 has been applied to xmonad or not. So do what
|
||||||
-- A user who wants no keybinding function should probably use
|
-- they probably intend.
|
||||||
-- 'withSB' instead, especially since NoSymbol didn't do anything
|
--
|
||||||
-- sane before 383ffb7. ++bsa
|
-- A user who wants no keybinding function should probably use
|
||||||
k' | k conf {layoutHook = Layout (layoutHook conf)} == (0,0) = defToggleStrutsKey
|
-- 'withSB' instead, especially since NoSymbol didn't do anything
|
||||||
| otherwise = k
|
-- sane before 383ffb7. ++bsa
|
||||||
|
defToggleStrutsKey conf'
|
||||||
|
key -> key
|
||||||
keys' = (`M.singleton` sendMessage ToggleStruts) . k'
|
keys' = (`M.singleton` sendMessage ToggleStruts) . k'
|
||||||
|
|
||||||
-- | Default @mod-b@ key binding for 'withEasySB'
|
-- | Default @mod-b@ key binding for 'withEasySB'
|
||||||
|
Reference in New Issue
Block a user