mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-24 13:22:23 +00:00
refactor xmonad config
This commit is contained in:
parent
bf6ef84d39
commit
3d5b9ecb19
3 changed files with 22 additions and 42 deletions
Binary file not shown.
|
@ -31,7 +31,6 @@ import XMonad.Layout.BorderResize
|
||||||
import XMonad.Layout.Gaps
|
import XMonad.Layout.Gaps
|
||||||
import XMonad.Layout.LayoutCombinators ((|||))
|
import XMonad.Layout.LayoutCombinators ((|||))
|
||||||
import XMonad.Layout.LayoutHints
|
import XMonad.Layout.LayoutHints
|
||||||
import XMonad.Layout.Minimize
|
|
||||||
import XMonad.Layout.MouseResizableTile
|
import XMonad.Layout.MouseResizableTile
|
||||||
import XMonad.Layout.NoBorders
|
import XMonad.Layout.NoBorders
|
||||||
import XMonad.Layout.Renamed (renamed, Rename(Replace))
|
import XMonad.Layout.Renamed (renamed, Rename(Replace))
|
||||||
|
@ -159,23 +158,12 @@ removedKeys :: [String]
|
||||||
removedKeys = ["M-S-c", "M-S-q", "M-h", "M-l"]
|
removedKeys = ["M-S-c", "M-S-q", "M-h", "M-l"]
|
||||||
|
|
||||||
myKeys :: [(String, X ())]
|
myKeys :: [(String, X ())]
|
||||||
myKeys = [
|
myKeys = [ ("M-+", sendMessage zoomIn)
|
||||||
--("M-C-k", sendMessage MirrorExpand >> sendMessage ShrinkSlave)
|
|
||||||
--, ("M-C-j", sendMessage MirrorShrink >> sendMessage ExpandSlave)
|
|
||||||
--, ("M-C-h", sendMessage Shrink)
|
|
||||||
--, ("M-C-l", sendMessage Expand)
|
|
||||||
|
|
||||||
("M-+", sendMessage zoomIn)
|
|
||||||
, ("M--", sendMessage zoomOut)
|
, ("M--", sendMessage zoomOut)
|
||||||
, ("M-#", sendMessage zoomReset)
|
, ("M-#", sendMessage zoomReset)
|
||||||
|
|
||||||
, ("M-f", toggleFullscreen)
|
, ("M-f", toggleFullscreen)
|
||||||
|
|
||||||
--, ("M-h", Nav2d.windowGo L False)
|
|
||||||
--, ("M-l", Nav2d.windowGo R False)
|
|
||||||
--, ("M-j", Nav2d.windowGo D False)
|
|
||||||
--, ("M-k", Nav2d.windowGo U False)
|
|
||||||
|
|
||||||
, ("M-S-C-c", kill1)
|
, ("M-S-C-c", kill1)
|
||||||
, ("M-S-C-q", io exitSuccess)
|
, ("M-S-C-q", io exitSuccess)
|
||||||
|
|
||||||
|
@ -202,34 +190,20 @@ myKeys = [
|
||||||
] ++ generatedMappings
|
] ++ generatedMappings
|
||||||
where
|
where
|
||||||
generatedMappings :: [(String, X ())]
|
generatedMappings :: [(String, X ())]
|
||||||
generatedMappings = copyToWorkspaceMappings ++ bspMappings
|
generatedMappings = copyToWorkspaceMappings ++ windowGoMappings ++ windowSwapMappings ++ resizeMappings
|
||||||
where
|
where
|
||||||
copyToWorkspaceMappings =
|
copyToWorkspaceMappings = [ ("M-C-" ++ wsp, windows $ copy wsp) | wsp <- map show [1..9 :: Int] ]
|
||||||
[ ("M-C-" ++ wsp, windows $ copy wsp)
|
|
||||||
| wsp <- map show [1..9 :: Int]
|
keyDirPairs = [("h", L), ("j", D), ("k", U), ("l", R)]
|
||||||
|
|
||||||
|
windowGoMappings = [ ("M-M1-" ++ key, Nav2d.windowGo dir False) | (key, dir) <- keyDirPairs ]
|
||||||
|
windowSwapMappings = [ ("M-S-M1-" ++ key, Nav2d.windowSwap dir False) | (key, dir) <- keyDirPairs ]
|
||||||
|
resizeMappings =
|
||||||
|
[ ("M-C-h", ifLayoutIs "BSP" (sendMessage $ ExpandTowards L) (sendMessage Shrink))
|
||||||
|
, ("M-C-j", ifLayoutIs "BSP" (sendMessage $ ExpandTowards D) (sendMessage MirrorShrink >> sendMessage ExpandSlave))
|
||||||
|
, ("M-C-k", ifLayoutIs "BSP" (sendMessage $ ExpandTowards U) (sendMessage MirrorExpand >> sendMessage ShrinkSlave))
|
||||||
|
, ("M-C-l", ifLayoutIs "BSP" (sendMessage $ ExpandTowards R) (sendMessage Expand))
|
||||||
]
|
]
|
||||||
bspMappings =
|
|
||||||
let
|
|
||||||
resizeActions :: [(String, X ())]
|
|
||||||
resizeActions =
|
|
||||||
map (\(key, (bsp, other)) -> (key, getActiveLayoutDescription >>= (\layout -> if layout == "BSP" then bsp else other))) $ -- TODO fix name
|
|
||||||
[ ("M-C-h", (sendMessage $ ExpandTowards L, sendMessage Shrink))
|
|
||||||
, ("M-C-j", (sendMessage $ ExpandTowards D, sendMessage MirrorShrink >> sendMessage ExpandSlave))
|
|
||||||
, ("M-C-k", (sendMessage $ ExpandTowards U, sendMessage MirrorExpand >> sendMessage ShrinkSlave))
|
|
||||||
, ("M-C-l", (sendMessage $ ExpandTowards R, sendMessage Expand))
|
|
||||||
]
|
|
||||||
in
|
|
||||||
resizeActions ++ concat [ [ ("M-M1-" ++ key, Nav2d.windowGo dir False)
|
|
||||||
, ("M-S-M1-" ++ key, Nav2d.windowSwap dir False)
|
|
||||||
]
|
|
||||||
| (key, dir) <- [("h", L), ("j", D), ("k", U), ("l", R)]
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Get the name of the active layout.
|
|
||||||
getActiveLayoutDescription :: X String
|
|
||||||
getActiveLayoutDescription = (description . W.layout . W.workspace . W.current) <$> gets windowset
|
|
||||||
|
|
||||||
toggleFullscreen :: X ()
|
toggleFullscreen :: X ()
|
||||||
toggleFullscreen = do
|
toggleFullscreen = do
|
||||||
|
@ -320,10 +294,9 @@ myConfig dbus = desktopConfig
|
||||||
, logHook = myLogHook <+> dynamicLogWithPP (polybarPP dbus) <+> logHook def
|
, logHook = myLogHook <+> dynamicLogWithPP (polybarPP dbus) <+> logHook def
|
||||||
, startupHook = myStartupHook <+> startupHook def <+> return () >> checkKeymap (myConfig dbus ) myKeys
|
, startupHook = myStartupHook <+> startupHook def <+> return () >> checkKeymap (myConfig dbus ) myKeys
|
||||||
, manageHook = myManageHook <+> manageHook def
|
, manageHook = myManageHook <+> manageHook def
|
||||||
-- , handleEventHook = minimizeEventHook <+> handleEventHook def -- fullscreenEventHook
|
|
||||||
--, handleEventHook = handleEventHook def <+> hintsEventHook -- <+> Ewmh.fullscreenEventHook
|
|
||||||
, focusedBorderColor = aqua
|
, focusedBorderColor = aqua
|
||||||
, normalBorderColor = "#282828"
|
, normalBorderColor = "#282828"
|
||||||
|
--, handleEventHook = minimizeEventHook <+> handleEventHook def <+> hintsEventHook -- <+> Ewmh.fullscreenEventHook
|
||||||
} `removeKeysP` removedKeys `additionalKeysP` myKeys
|
} `removeKeysP` removedKeys `additionalKeysP` myKeys
|
||||||
|
|
||||||
|
|
||||||
|
@ -369,7 +342,6 @@ dbusOutput dbus str = do
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
-- Utilities --------------------------------------------------- {{{
|
-- Utilities --------------------------------------------------- {{{
|
||||||
promptDzenWhileRunning :: String -> [String] -> X () -> X ()
|
promptDzenWhileRunning :: String -> [String] -> X () -> X ()
|
||||||
promptDzenWhileRunning promptTitle options action = do
|
promptDzenWhileRunning promptTitle options action = do
|
||||||
|
@ -381,5 +353,13 @@ promptDzenWhileRunning promptTitle options action = do
|
||||||
lineCount = show $ length options
|
lineCount = show $ length options
|
||||||
font = "-*-iosevka-medium-r-s*--16-87-*-*-*-*-iso10???-1"
|
font = "-*-iosevka-medium-r-s*--16-87-*-*-*-*-iso10???-1"
|
||||||
|
|
||||||
|
ifLayoutIs :: String -> X a -> X a -> X a
|
||||||
|
ifLayoutIs layoutAName onLayoutA onLayoutB = do
|
||||||
|
layout <- getActiveLayoutDescription
|
||||||
|
if (layout == layoutAName) then onLayoutA else onLayoutB
|
||||||
|
|
||||||
|
-- Get the name of the active layout.
|
||||||
|
getActiveLayoutDescription :: X String
|
||||||
|
getActiveLayoutDescription = (description . W.layout . W.workspace . W.current) <$> gets windowset
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue