mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Make usage of ManageDocks simpler and more robust
As it now consists of a startup hook, a manage hook, an event hook and a layout modifier, and behaves erratically when any one component is not included in a user's config (which happens to be the case for all configs from xmonad-contrib 0.12 since the startup hook is a new inclusion), it's probably wise to have a single function that adds all the hooks to the config instead. NB: This will need a release notes entry anyway!
This commit is contained in:
parent
c48d81e378
commit
e38fb3bdb8
@ -180,8 +180,7 @@ bluetileManageHook :: ManageHook
|
|||||||
bluetileManageHook = composeAll
|
bluetileManageHook = composeAll
|
||||||
[ workspaceByPos, positionStoreManageHook (Just defaultThemeWithButtons)
|
[ workspaceByPos, positionStoreManageHook (Just defaultThemeWithButtons)
|
||||||
, className =? "MPlayer" --> doFloat
|
, className =? "MPlayer" --> doFloat
|
||||||
, isFullscreen --> doFullFloat
|
, isFullscreen --> doFullFloat]
|
||||||
, manageDocks]
|
|
||||||
|
|
||||||
bluetileLayoutHook = avoidStruts $ minimize $ boringWindows $ (
|
bluetileLayoutHook = avoidStruts $ minimize $ boringWindows $ (
|
||||||
named "Floating" floating |||
|
named "Floating" floating |||
|
||||||
@ -199,6 +198,7 @@ bluetileLayoutHook = avoidStruts $ minimize $ boringWindows $ (
|
|||||||
floatingDeco l = buttonDeco shrinkText defaultThemeWithButtons l
|
floatingDeco l = buttonDeco shrinkText defaultThemeWithButtons l
|
||||||
|
|
||||||
bluetileConfig =
|
bluetileConfig =
|
||||||
|
docks $
|
||||||
def
|
def
|
||||||
{ modMask = mod4Mask, -- logo key
|
{ modMask = mod4Mask, -- logo key
|
||||||
manageHook = bluetileManageHook,
|
manageHook = bluetileManageHook,
|
||||||
|
@ -164,11 +164,9 @@ import qualified Data.Map as M
|
|||||||
-- > adjustEventInput
|
-- > adjustEventInput
|
||||||
--
|
--
|
||||||
|
|
||||||
desktopConfig = ewmh def
|
desktopConfig = docks $ ewmh def
|
||||||
{ startupHook = setDefaultCursor xC_left_ptr <+> docksStartupHook <+> startupHook def
|
{ startupHook = setDefaultCursor xC_left_ptr <+> startupHook def
|
||||||
, layoutHook = desktopLayoutModifiers $ layoutHook def
|
, layoutHook = desktopLayoutModifiers $ layoutHook def
|
||||||
, manageHook = manageDocks <+> manageHook def
|
|
||||||
, handleEventHook = docksEventHook <+> handleEventHook def
|
|
||||||
, keys = desktopKeys <+> keys def }
|
, keys = desktopKeys <+> keys def }
|
||||||
|
|
||||||
desktopKeys (XConfig {modMask = modm}) = M.fromList $
|
desktopKeys (XConfig {modMask = modm}) = M.fromList $
|
||||||
|
@ -205,7 +205,7 @@ instance PPrint ScreenId
|
|||||||
instance (Show a, Show b) => PPrint (Map a b)
|
instance (Show a, Show b) => PPrint (Map a b)
|
||||||
-- }}}
|
-- }}}
|
||||||
-- main {{{
|
-- main {{{
|
||||||
dmwitConfig nScreens = def {
|
dmwitConfig nScreens = docks $ def {
|
||||||
borderWidth = 2,
|
borderWidth = 2,
|
||||||
workspaces = withScreens nScreens (map show [1..5]),
|
workspaces = withScreens nScreens (map show [1..5]),
|
||||||
terminal = "urxvt",
|
terminal = "urxvt",
|
||||||
@ -221,7 +221,6 @@ dmwitConfig nScreens = def {
|
|||||||
<+> (appName =? "huludesktop" --> doRectFloat fullscreen43on169)
|
<+> (appName =? "huludesktop" --> doRectFloat fullscreen43on169)
|
||||||
<+> fullscreenMPlayer
|
<+> fullscreenMPlayer
|
||||||
<+> floatAll ["Gimp", "Wine"]
|
<+> floatAll ["Gimp", "Wine"]
|
||||||
<+> manageDocks
|
|
||||||
<+> manageSpawn,
|
<+> manageSpawn,
|
||||||
logHook = allPPs nScreens,
|
logHook = allPPs nScreens,
|
||||||
startupHook = refresh
|
startupHook = refresh
|
||||||
|
@ -42,7 +42,7 @@ import XMonad.Actions.DynamicWorkspaces ( withNthWorkspace, withWorkspace,
|
|||||||
import XMonad.Actions.CycleWS ( moveTo, WSType( HiddenNonEmptyWS ),
|
import XMonad.Actions.CycleWS ( moveTo, WSType( HiddenNonEmptyWS ),
|
||||||
Direction1D( Prev, Next) )
|
Direction1D( Prev, Next) )
|
||||||
|
|
||||||
import XMonad.Hooks.ManageDocks ( avoidStruts, manageDocks )
|
import XMonad.Hooks.ManageDocks ( avoidStruts, docks )
|
||||||
import XMonad.Hooks.EwmhDesktops ( ewmh )
|
import XMonad.Hooks.EwmhDesktops ( ewmh )
|
||||||
|
|
||||||
myXPConfig :: XPConfig
|
myXPConfig :: XPConfig
|
||||||
@ -117,7 +117,7 @@ keys x = M.fromList $
|
|||||||
++
|
++
|
||||||
zip (zip (repeat (modMask x .|. shiftMask)) [xK_F1..xK_F12]) (map (withNthWorkspace copy) [0..])
|
zip (zip (repeat (modMask x .|. shiftMask)) [xK_F1..xK_F12]) (map (withNthWorkspace copy) [0..])
|
||||||
|
|
||||||
config = ewmh def
|
config = docks $ ewmh def
|
||||||
{ borderWidth = 1 -- Width of the window border in pixels.
|
{ borderWidth = 1 -- Width of the window border in pixels.
|
||||||
, XMonad.workspaces = ["mutt","iceweasel"]
|
, XMonad.workspaces = ["mutt","iceweasel"]
|
||||||
, layoutHook = showWName $ workspaceDir "~" $
|
, layoutHook = showWName $ workspaceDir "~" $
|
||||||
@ -129,7 +129,6 @@ config = ewmh def
|
|||||||
named "widescreen" ((mytab *||* mytab)
|
named "widescreen" ((mytab *||* mytab)
|
||||||
****//* combineTwo Square mytab mytab) -- |||
|
****//* combineTwo Square mytab mytab) -- |||
|
||||||
--mosaic 0.25 0.5
|
--mosaic 0.25 0.5
|
||||||
, manageHook = manageHook def <+> manageDocks -- add panel-handling
|
|
||||||
, terminal = "xterm" -- The preferred terminal program.
|
, terminal = "xterm" -- The preferred terminal program.
|
||||||
, normalBorderColor = "#222222" -- Border color for unfocused windows.
|
, normalBorderColor = "#222222" -- Border color for unfocused windows.
|
||||||
, focusedBorderColor = "#00ff00" -- Border color for focused windows.
|
, focusedBorderColor = "#00ff00" -- Border color for focused windows.
|
||||||
|
@ -21,7 +21,7 @@ import XMonad.Layout.TwoPane
|
|||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
|
|
||||||
sjanssenConfig =
|
sjanssenConfig =
|
||||||
ewmh $ def
|
docks $ ewmh $ def
|
||||||
{ terminal = "exec urxvt"
|
{ terminal = "exec urxvt"
|
||||||
, workspaces = ["irc", "web"] ++ map show [3 .. 9 :: Int]
|
, workspaces = ["irc", "web"] ++ map show [3 .. 9 :: Int]
|
||||||
, mouseBindings = \(XConfig {modMask = modm}) -> M.fromList $
|
, mouseBindings = \(XConfig {modMask = modm}) -> M.fromList $
|
||||||
@ -35,7 +35,7 @@ sjanssenConfig =
|
|||||||
| (x, w) <- [ ("Firefox", "web")
|
| (x, w) <- [ ("Firefox", "web")
|
||||||
, ("Ktorrent", "7")
|
, ("Ktorrent", "7")
|
||||||
, ("Amarokapp", "7")]]
|
, ("Amarokapp", "7")]]
|
||||||
<+> manageHook def <+> manageDocks <+> manageSpawn
|
<+> manageHook def <+> manageSpawn
|
||||||
<+> (isFullscreen --> doFullFloat)
|
<+> (isFullscreen --> doFullFloat)
|
||||||
, startupHook = mapM_ spawnOnce spawns
|
, startupHook = mapM_ spawnOnce spawns
|
||||||
}
|
}
|
||||||
|
@ -199,12 +199,11 @@ statusBar :: LayoutClass l Window
|
|||||||
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
-> IO (XConfig (ModifiedLayout AvoidStruts l))
|
||||||
statusBar cmd pp k conf = do
|
statusBar cmd pp k conf = do
|
||||||
h <- spawnPipe cmd
|
h <- spawnPipe cmd
|
||||||
return $ conf
|
return $ docks $ conf
|
||||||
{ layoutHook = avoidStruts (layoutHook conf)
|
{ layoutHook = avoidStruts (layoutHook conf)
|
||||||
, logHook = do
|
, logHook = do
|
||||||
logHook conf
|
logHook conf
|
||||||
dynamicLogWithPP pp { ppOutput = hPutStrLn h }
|
dynamicLogWithPP pp { ppOutput = hPutStrLn h }
|
||||||
, manageHook = manageHook conf <+> manageDocks
|
|
||||||
, keys = liftM2 M.union keys' (keys conf)
|
, keys = liftM2 M.union keys' (keys conf)
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
@ -47,7 +47,7 @@ import XMonad.Util.WindowProperties (getProp32)
|
|||||||
-- > main = xmonad $ ewmh def{ handleEventHook =
|
-- > main = xmonad $ ewmh def{ handleEventHook =
|
||||||
-- > handleEventHook def <+> fullscreenEventHook }
|
-- > handleEventHook def <+> fullscreenEventHook }
|
||||||
--
|
--
|
||||||
-- You may also be interested in 'avoidStruts' from "XMonad.Hooks.ManageDocks".
|
-- You may also be interested in 'docks' from "XMonad.Hooks.ManageDocks".
|
||||||
|
|
||||||
|
|
||||||
-- | Add EWMH functionality to the given config. See above for an example.
|
-- | Add EWMH functionality to the given config. See above for an example.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
module XMonad.Hooks.ManageDocks (
|
module XMonad.Hooks.ManageDocks (
|
||||||
-- * Usage
|
-- * Usage
|
||||||
-- $usage
|
-- $usage
|
||||||
manageDocks, checkDock, AvoidStruts, avoidStruts, avoidStrutsOn,
|
docks, manageDocks, checkDock, AvoidStruts, avoidStruts, avoidStrutsOn,
|
||||||
docksEventHook, docksStartupHook,
|
docksEventHook, docksStartupHook,
|
||||||
ToggleStruts(..),
|
ToggleStruts(..),
|
||||||
SetStruts(..),
|
SetStruts(..),
|
||||||
@ -52,25 +52,16 @@ import Control.Monad (when, forM_, filterM)
|
|||||||
--
|
--
|
||||||
-- > import XMonad.Hooks.ManageDocks
|
-- > import XMonad.Hooks.ManageDocks
|
||||||
--
|
--
|
||||||
-- The first component is a 'ManageHook' which recognizes these
|
-- Wrap your xmonad config with a call to 'docks', like so:
|
||||||
-- windows and de-manages them, so that xmonad does not try to tile
|
|
||||||
-- them. To enable it:
|
|
||||||
--
|
--
|
||||||
-- > manageHook = ... <+> manageDocks
|
-- > main = xmonad $ docks def
|
||||||
--
|
--
|
||||||
-- The second component is a layout modifier that prevents windows
|
-- Then add 'avoidStruts' or 'avoidStrutsOn' layout modifier to your layout
|
||||||
-- from overlapping these dock windows. It is intended to replace
|
-- to prevent windows from overlapping these windows.
|
||||||
-- xmonad's so-called \"gap\" support. First, you must add it to your
|
|
||||||
-- list of layouts:
|
|
||||||
--
|
--
|
||||||
-- > layoutHook = avoidStruts (tall ||| mirror tall ||| ...)
|
-- > layoutHook = avoidStruts (tall ||| mirror tall ||| ...)
|
||||||
-- > where tall = Tall 1 (3/100) (1/2)
|
-- > where tall = Tall 1 (3/100) (1/2)
|
||||||
--
|
--
|
||||||
-- The third component is an event hook that causes new docks to appear
|
|
||||||
-- immediately, instead of waiting for the next focus change.
|
|
||||||
--
|
|
||||||
-- > handleEventHook = ... <+> docksEventHook
|
|
||||||
--
|
|
||||||
-- 'AvoidStruts' also supports toggling the dock gaps; add a keybinding
|
-- 'AvoidStruts' also supports toggling the dock gaps; add a keybinding
|
||||||
-- similar to:
|
-- similar to:
|
||||||
--
|
--
|
||||||
@ -90,17 +81,16 @@ import Control.Monad (when, forM_, filterM)
|
|||||||
--
|
--
|
||||||
-- > layoutHook = avoidStrutsOn [U,L] (tall ||| mirror tall ||| ...)
|
-- > layoutHook = avoidStrutsOn [U,L] (tall ||| mirror tall ||| ...)
|
||||||
--
|
--
|
||||||
-- /Important note/: if you are switching from manual gaps
|
|
||||||
-- (defaultGaps in your config) to avoidStruts (recommended, since
|
|
||||||
-- manual gaps will probably be phased out soon), be sure to switch
|
|
||||||
-- off all your gaps (with mod-b) /before/ reloading your config with
|
|
||||||
-- avoidStruts! Toggling struts with a 'ToggleStruts' message will
|
|
||||||
-- not work unless your gaps are set to zero.
|
|
||||||
--
|
|
||||||
-- For detailed instructions on editing your key bindings, see
|
-- For detailed instructions on editing your key bindings, see
|
||||||
-- "XMonad.Doc.Extending#Editing_key_bindings".
|
-- "XMonad.Doc.Extending#Editing_key_bindings".
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- | Add docks functionality to the given config. See above for an example.
|
||||||
|
docks :: XConfig a -> XConfig a
|
||||||
|
docks c = c { startupHook = docksStartupHook <+> startupHook c
|
||||||
|
, handleEventHook = docksEventHook <+> handleEventHook c
|
||||||
|
, manageHook = manageDocks <+> manageHook c }
|
||||||
|
|
||||||
newtype StrutCache = StrutCache { fromStrutCache :: M.Map Window [Strut] }
|
newtype StrutCache = StrutCache { fromStrutCache :: M.Map Window [Strut] }
|
||||||
deriving (Eq, Typeable)
|
deriving (Eq, Typeable)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user