[XMonad] Reindent a bunch of definitions

This commit is contained in:
Ivan Malison 2016-11-25 18:48:14 -08:00
parent fa7c46b764
commit 6d17f96ecf
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -49,18 +49,20 @@ import XMonad.Util.NamedScratchpad
(NamedScratchpad(NS), nonFloating, namedScratchpadAction)
import XMonad.Util.NamedWindows (getName)
main = xmonad $ def
main =
xmonad $ def
{ modMask = mod4Mask
, terminal = "urxvt"
, manageHook = manageDocks <+> myManageHook <+> manageHook def
, layoutHook = myLayoutHook
, logHook = toggleFadeInactiveLogHook 0.9 +++ ewmhWorkspaceNamesLogHook
, handleEventHook = docksEventHook <+> fullscreenEventHook +++
ewmhDesktopsEventHook +++ pagerHintsEventHook +++
followIfNoMagicFocus
, handleEventHook =
docksEventHook <+> fullscreenEventHook +++
ewmhDesktopsEventHook +++ pagerHintsEventHook +++ followIfNoMagicFocus
, startupHook = myStartup +++ ewmhWorkspaceNamesLogHook
, keys = customKeys (const []) addKeys
} where
}
where
x +++ y = mappend y x
@ -127,8 +129,9 @@ myStartup = spawn "systemctl --user start wm.target"
-- Manage hook
myManageHook = composeAll . concat $
[ [ transmissionSelector --> doShift "5" ]
myManageHook =
composeAll . concat $
[ [transmissionSelector --> doShift "5"]
-- Hangouts being on a separate workspace freezes chrome
-- , [ hangoutsSelector --> doShift "2"]
]
@ -137,8 +140,8 @@ myManageHook = composeAll . concat $
unmodifyLayout (ModifiedLayout _ x') = x'
selectLimit = DM.menuArgs "rofi" ["-dmenu", "-i"] ["2", "3", "4"] >>=
(setLimit . read)
selectLimit =
DM.menuArgs "rofi" ["-dmenu", "-i"] ["2", "3", "4"] >>= (setLimit . read)
data MyToggles = LIMIT
| GAPS
@ -153,26 +156,29 @@ instance Transformer MyToggles Window where
myToggles = [LIMIT, GAPS, MAGICFOCUS]
otherToggles = [NBFULL, MIRROR]
followIfNoMagicFocus = followOnlyIf $ fmap (fromMaybe False . fmap not) $
isToggleActive MAGICFOCUS
followIfNoMagicFocus =
followOnlyIf $ maybe False not <$> isToggleActive MAGICFOCUS
togglesMap = fmap M.fromList $ sequence $
togglesMap =
fmap M.fromList $ sequence $
map toggleTuple myToggles ++ map toggleTuple otherToggles
where
toggleTuple toggle = fmap (\str -> (str, Toggle toggle))
(toggleToStringWithState toggle)
toggleTuple toggle =
fmap (\str -> (str, Toggle toggle)) (toggleToStringWithState toggle)
toggleStateToString s = case s of
toggleStateToString s =
case s of
Just True -> "ON"
Just False -> "OFF"
Nothing -> "N/A"
toggleToStringWithState :: (Transformer t Window, Show t) => t -> X String
toggleToStringWithState toggle =
(printf "%s (%s)" (show toggle) . toggleStateToString) <$>
isToggleActive toggle
(printf "%s (%s)" (show toggle) . toggleStateToString) <$> isToggleActive toggle
selectToggle = togglesMap >>= DM.menuMapArgs "rofi" ["-dmenu", "-i"] >>=
selectToggle =
togglesMap >>= DM.menuMapArgs "rofi" ["-dmenu", "-i"] >>=
flip whenJust sendMessage
toggleInState :: (Transformer t Window) => t -> Maybe Bool -> X Bool
@ -188,8 +194,8 @@ setToggleActive = (void .) . setToggleActive'
deactivateFull = setToggleActive NBFULL False
toggleOr toggle toState action = setToggleActive' toggle toState >>=
((`when` action) . not)
toggleOr toggle toState action =
setToggleActive' toggle toState >>= ((`when` action) . not)
deactivateFullOr = toggleOr NBFULL False
deactivateFullAnd action = sequence_ [deactivateFull, action]
@ -206,22 +212,25 @@ layoutsStart layout = (layout, [Layout layout])
(|||!) (joined, layouts) newLayout =
(joined ||| newLayout, layouts ++ [Layout newLayout])
layoutInfo = layoutsStart (rename "Columns" $ multiCol [1, 1] 2 0.01 (-0.5)) |||!
rename "Large Main" (Tall 1 (3/100) (3/4)) |||!
rename "2 Columns" (Tall 1 (3/100) (1/2)) |||!
layoutInfo =
layoutsStart (rename "Columns" $ multiCol [1, 1] 2 0.01 (-0.5)) |||!
rename "Large Main" (Tall 1 (3 / 100) (3 / 4)) |||!
rename "2 Columns" (Tall 1 (3 / 100) (1 / 2)) |||!
Accordion
layoutList = snd layoutInfo
layoutNames = [description layout | layout <- layoutList]
selectLayout = DM.menuArgs "rofi" ["-dmenu", "-i"] layoutNames >>=
selectLayout =
DM.menuArgs "rofi" ["-dmenu", "-i"] layoutNames >>=
(sendMessage . JumpToLayout)
myLayoutHook = avoidStruts . minimize . boringAuto . mkToggle1 MIRROR .
mkToggle1 LIMIT . mkToggle1 GAPS . mkToggle1 MAGICFOCUS .
mkToggle1 NBFULL . workspaceNamesHook . smartBorders . noBorders $
fst layoutInfo
myLayoutHook =
avoidStruts . minimize . boringAuto . mkToggle1 MIRROR . mkToggle1 LIMIT .
mkToggle1 GAPS . mkToggle1 MAGICFOCUS . mkToggle1 NBFULL . workspaceNamesHook .
smartBorders . noBorders $ fst layoutInfo
-- WindowBringer
@ -379,26 +388,29 @@ restoreOrMinimizeOtherClasses = withLastMinimized' $
-- Use greedyView to switch to the correct workspace, and then focus on the
-- appropriate window within that workspace.
greedyFocusWindow w ws = W.focusWindow w $ W.greedyView
(fromMaybe (W.currentTag ws) $ W.findTag w ws) ws
greedyFocusWindow w ws =
W.focusWindow w $
W.greedyView (fromMaybe (W.currentTag ws) $ W.findTag w ws) ws
shiftThenView i = W.greedyView i . W.shift i
shiftToEmptyAndView = doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView)
greedyBringWindow w = greedyFocusWindow w . bringWindow w
shiftToEmptyAndView =
doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView)
swapFocusedWith w ws = W.modify' (swapFocusedWith' w) (W.delete' w ws)
swapFocusedWith' w (W.Stack current ls rs) = W.Stack w ls (rs ++ [current])
swapMinimizeStateAfter action = withFocused $ \originalWindow -> do
swapMinimizeStateAfter action =
withFocused $
\originalWindow -> do
_ <- action
restoreFocus $ do
maybeUnminimizeFocused
withFocused $ \newWindow ->
when (newWindow /= originalWindow)
$ minimizeWindow originalWindow
restoreFocus $
do maybeUnminimizeFocused
withFocused $
\newWindow -> when (newWindow /= originalWindow) $ minimizeWindow originalWindow
-- Named Scratchpads