[XMonad] Add page breaks to config

This commit is contained in:
Ivan Malison 2016-11-09 17:29:45 -08:00
parent def606e713
commit 4e76aa048a
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -40,7 +40,6 @@ import XMonad.Util.CustomKeys
import qualified XMonad.Util.ExtensibleState as XS import qualified XMonad.Util.ExtensibleState as XS
import XMonad.Util.NamedWindows (getName) import XMonad.Util.NamedWindows (getName)
main = xmonad $ def main = xmonad $ def
{ modMask = mod4Mask { modMask = mod4Mask
, terminal = "urxvt" , terminal = "urxvt"
@ -54,6 +53,9 @@ main = xmonad $ def
} where } where
x +++ y = mappend y x x +++ y = mappend y x
-- Selectors
isHangoutsTitle = isPrefixOf "Google Hangouts" isHangoutsTitle = isPrefixOf "Google Hangouts"
chromeSelectorBase = className =? "Google-chrome" chromeSelectorBase = className =? "Google-chrome"
@ -69,38 +71,37 @@ virtualClasses = [ (hangoutsSelector, "Hangouts")
, (chromeSelector, "Chrome") , (chromeSelector, "Chrome")
, (transmissionSelector, "Transmission") , (transmissionSelector, "Transmission")
] ]
-- Startup -- Startup hoo
myStartup = spawn "systemctl --user start wm.target" myStartup = spawn "systemctl --user start wm.target"
-- Manage -- Manage hook
myManageHook = composeAll . concat $ myManageHook = composeAll . concat $
[ [ hangoutsSelector --> doShift "2"] [ [ hangoutsSelector --> doShift "2"]
, [ transmissionSelector --> doShift "5" ]] , [ transmissionSelector --> doShift "5" ]]
-- Layout -- Layout setup
-- TODO: Figure out how to disable focus follows mouse for magicFocus -- TODO: Figure out how to disable focus follows mouse for magicFocus
layouts = multiCol [1, 1] 2 0.01 (-0.5) ||| Full ||| layouts = multiCol [1, 1] 2 0.01 (-0.5) ||| Full |||
Tall 1 (3/100) (1/2) ||| magicFocus (Tall 1 (3/100) (3/4)) ||| Tall 1 (3/100) (1/2) ||| magicFocus (Tall 1 (3/100) (3/4)) |||
limitWindows 2 (Tall 1 (3/100) (1/2)) limitWindows 2 (Tall 1 (3/100) (1/2))
myLayoutHook = avoidStruts . smartSpacing 10 . minimize . boringAuto . boringWindows . myLayoutHook = avoidStruts . smartSpacing 10 . minimize . boringAuto .
mkToggle (MIRROR ?? EOT) . workspaceNamesHook . smartBorders . boringWindows . mkToggle (MIRROR ?? EOT) . workspaceNamesHook .
noBorders $ layouts smartBorders . noBorders $ layouts
-- WindowBringer -- WindowBringer
findM :: (Monad m) => (a -> m (Maybe b)) -> [a] -> m (Maybe b)
findM f = runMaybeT . msum . map (MaybeT . f)
myWindowBringerConfig = WindowBringerConfig { menuCommand = "rofi" myWindowBringerConfig = WindowBringerConfig { menuCommand = "rofi"
, menuArgs = ["-dmenu", "-i"] , menuArgs = ["-dmenu", "-i"]
, windowTitler = myDecorateName , windowTitler = myDecorateName
} }
findM :: (Monad m) => (a -> m (Maybe b)) -> [a] -> m (Maybe b)
findM f = runMaybeT . msum . map (MaybeT . f)
classIfMatches window entry = do classIfMatches window entry = do
result <- runQuery (fst entry) window result <- runQuery (fst entry) window
return $ if result then Just $ snd entry else Nothing return $ if result then Just $ snd entry else Nothing
@ -119,7 +120,7 @@ myDecorateName ws w = do
workspaceToName <- getWorkspaceNames workspaceToName <- getWorkspaceNames
return $ printf "%-20s%-40s %+30s" classTitle (take 40 name) return $ printf "%-20s%-40s %+30s" classTitle (take 40 name)
"in " ++ workspaceToName (W.tag ws) "in " ++ workspaceToName (W.tag ws)
-- Dynamic Workspace Renaming -- Dynamic Workspace Renaming
getClassRemap = do getClassRemap = do
@ -150,7 +151,7 @@ instance LayoutModifier WorkspaceNamesHook Window where
hook _ = setWorkspaceNames hook _ = setWorkspaceNames
workspaceNamesHook = ModifiedLayout WorkspaceNamesHook workspaceNamesHook = ModifiedLayout WorkspaceNamesHook
-- EWMH support for workspace names -- EWMH support for workspace names
ewmhWorkspaceNamesLogHook = do ewmhWorkspaceNamesLogHook = do
@ -163,7 +164,7 @@ getWorkspaceNameFromTag namesMap tag =
case M.lookup tag namesMap of case M.lookup tag namesMap of
Nothing -> tag Nothing -> tag
Just label -> printf "%s: %s " tag label Just label -> printf "%s: %s " tag label
-- Toggleable fade -- Toggleable fade
newtype ToggleFade = ToggleFade (M.Map Window Bool) newtype ToggleFade = ToggleFade (M.Map Window Bool)
@ -189,6 +190,7 @@ toggleFadingForActiveWindow = withWindowSet $ \windowSet -> do
XS.put $ ToggleFade (M.insert window (not existingValue) toggleMap) XS.put $ ToggleFade (M.insert window (not existingValue) toggleMap)
return () return ()
-- Minimize not in class -- Minimize not in class
withWorkspace f = withWindowSet $ \ws -> withWorkspace f = withWindowSet $ \ws ->
@ -207,6 +209,9 @@ windowsWithOtherClasses workspace window = do
restoreAllMinimized = restoreAllMinimized =
withWorkspace $ mapM_ (sendMessage . RestoreMinimizedWin) . W.integrate withWorkspace $ mapM_ (sendMessage . RestoreMinimizedWin) . W.integrate
-- Window switching
-- Use greedyView to switch to the correct workspace, and then focus on the -- Use greedyView to switch to the correct workspace, and then focus on the
-- appropriate window within that workspace. -- appropriate window within that workspace.
greedyFocusWindow w ws = W.focusWindow w $ W.greedyView greedyFocusWindow w ws = W.focusWindow w $ W.greedyView
@ -216,6 +221,9 @@ shiftThenView i = W.greedyView i . W.shift i
shiftToEmptyAndView = doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView) shiftToEmptyAndView = doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView)
-- Raise or spawn
myRaiseNextMaybe = raiseNextMaybeCustomFocus greedyFocusWindow myRaiseNextMaybe = raiseNextMaybeCustomFocus greedyFocusWindow
myBringNextMaybe = raiseNextMaybeCustomFocus bringWindow myBringNextMaybe = raiseNextMaybeCustomFocus bringWindow
@ -227,6 +235,9 @@ bindBringAndRaise mask sym start query =
bindBringAndRaiseMany :: [(KeyMask, KeySym, X (), Query Bool)] -> [((KeyMask, KeySym), X())] bindBringAndRaiseMany :: [(KeyMask, KeySym, X (), Query Bool)] -> [((KeyMask, KeySym), X())]
bindBringAndRaiseMany = concatMap (\(a, b, c, d) -> bindBringAndRaise a b c d) bindBringAndRaiseMany = concatMap (\(a, b, c, d) -> bindBringAndRaise a b c d)
-- Key bindings
addKeys conf@XConfig {modMask = modm} = addKeys conf@XConfig {modMask = modm} =
[ ((modm, xK_p), spawn "rofi -show drun") [ ((modm, xK_p), spawn "rofi -show drun")
, ((modm .|. shiftMask, xK_p), spawn "rofi -show run") , ((modm .|. shiftMask, xK_p), spawn "rofi -show run")