all repos — xmonad-config @ e00093fb569b5b66f657228e9bcdc463b727bd4b

personal xmonad config

small refactoring

config from library no longer contains main function (which was odd),
now user have to specify bells and whistles they want to put in their
xmonad.

workspaces and layout names are now easier to swap.
la-ninpre leobrekalini@gmail.com
Fri, 10 Mar 2023 17:33:50 +0300
commit

e00093fb569b5b66f657228e9bcdc463b727bd4b

parent

494b58a2866088e3d0e7a4abf8e9a6e962013ce5

2 files changed, 45 insertions(+), 22 deletions(-)

jump to
M lib/XMonad/Config/LaNinpre.hslib/XMonad/Config/LaNinpre.hs

@@ -69,7 +69,7 @@ import XMonad.Layout.Simplest (Simplest(Simplest))

import XMonad.Layout.Spacing ( spacingWithEdge , toggleWindowSpacingEnabled - , toggleScreenSpacingEnabled + , toggleScreenSpacingEnabled, Border (top) ) import XMonad.Layout.SubLayouts ( GroupMsg(UnMerge, UnMergeAll)

@@ -384,8 +384,8 @@ --

-- list of keybindings. it supposed to override the default keybindings. -- | keybindings in 'EZConfig' format -keybinds :: [(String, X ())] -keybinds = [ ("M-<Return>", spawn terminalEmulator) +keybinds :: [String] -> [(String, X ())] +keybinds ws = [ ("M-<Return>", spawn terminalEmulator) , ("M-w", spawn webBrowser) , ("M-p", spawn "dmenu_run") , ("M-<Delete>", spawn "slock")

@@ -439,7 +439,7 @@ , ("<XF86AudioNext>", spawn $ mocpString ++ " --next")

] ++ [("M-" ++ m ++ show k, windows $ f i) - | (i, k) <- zip workspacesTP [1..9] + | (i, k) <- zip ws [1..9] , (f, m) <- [(W.greedyView, ""), (W.shift, "S-")] ]

@@ -458,7 +458,7 @@ , ppHidden = xmobarColor (col_fg def) "" . sitelen

, ppHiddenNoWindows = xmobarColor (col_bg_alt def) "" . sitelen , ppLayout = sitelen } where - sitelen = xmobarFont 3 + sitelen = xmobarFont 1 -- | status bar config statusBarConfig :: StatusBarConfig

@@ -488,26 +488,35 @@ }

-- * misc +-- | names for layouts +-- +-- this is to allow specifying layout names. not very flexible but plausible. +data LayoutNames = LayoutNames + { tiledName :: String + , threeColName :: String + , fullName :: String + } + -- | layout hook -- -- __NOTE__: it uses sitelen-pona font to name layouts. -localLayoutHook = windowNavigation +localLayoutHook ln = windowNavigation $ boringWindows $ toggleLayouts full $ smartBorders $ tiled ||| threeCol where - tiled = renamed [Replace "\xe624"] -- lawa + tiled = renamed [Replace $ tiledName ln] -- lawa $ addTabs shrinkText tabTheme $ subLayout [] Simplest $ spacingWithEdge space $ ResizableTall nmaster delta ratio [] - threeCol = renamed [Replace "\xe665"] -- supa + threeCol = renamed [Replace $ threeColName ln] -- supa $ addTabs shrinkText tabTheme $ subLayout [] Simplest $ spacingWithEdge space $ ResizableThreeColMid nmaster delta ratio [] - full = renamed [Replace "\xe663"] -- suli + full = renamed [Replace $ fullName ln] -- suli $ noBorders Full nmaster = 1 ratio = 1/2

@@ -516,28 +525,21 @@ space = 4

-- | main config -- --- you can override things like that: +-- takes a list of workspaces and @LayoutNames@, be sure to specify them. -- -- @ --- myConfig = laNinpreConfig { workspaces = 'workspacesNorm' } +-- myConfig = laNinpreConfig workspacesNorm -- main = xmonad myConfig -- @ -laNinpreConfig = def +laNinpreConfig ws ln = def { terminal = terminalEmulator , modMask = mod4Mask - , layoutHook = localLayoutHook + , layoutHook = localLayoutHook ln , manageHook = localManageHook - , workspaces = workspacesTP + , workspaces = ws , borderWidth = 1 - , keys = (`mkKeymap` keybinds) + , keys = (`mkKeymap` keybinds ws) , normalBorderColor = col_bg_alt def , focusedBorderColor = col_fg_alt def } -main :: IO () -main = xmonad - . ewmhFullscreen - . ewmh - . withEasySB statusBarConfig defToggleStrutsKey - $ laNinpreConfig -
M xmonad.hsxmonad.hs

@@ -1,1 +1,22 @@

+import XMonad + +import XMonad.Hooks.EwmhDesktops (ewmhFullscreen, ewmh) +import XMonad.Hooks.StatusBar (defToggleStrutsKey, withEasySB) + import XMonad.Config.LaNinpre + (LayoutNames(..) + , laNinpreConfig + , statusBarConfig + ) + +wsMin = [ "<s>", "<m>", "<p>", "<l>", "<o>", "<t>", "<u>", "<i>", "<a>" ] + +layoutNames = LayoutNames "l" "s" "u" + +configMin = laNinpreConfig wsMin layoutNames + +main = xmonad + . ewmhFullscreen + . ewmh + . withEasySB statusBarConfig defToggleStrutsKey + $ configMin