aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2023-03-10 17:33:50 +0300
committerla-ninpre <leobrekalini@gmail.com>2023-03-10 17:33:50 +0300
commite00093fb569b5b66f657228e9bcdc463b727bd4b (patch)
treece391afca5efb699e1c90932c37f82e6e7863d5b
parent494b58a2866088e3d0e7a4abf8e9a6e962013ce5 (diff)
downloadxmonad-config-e00093fb569b5b66f657228e9bcdc463b727bd4b.tar.gz
xmonad-config-e00093fb569b5b66f657228e9bcdc463b727bd4b.zip
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.
-rw-r--r--lib/XMonad/Config/LaNinpre.hs46
-rw-r--r--xmonad.hs21
2 files changed, 45 insertions, 22 deletions
diff --git a/lib/XMonad/Config/LaNinpre.hs b/lib/XMonad/Config/LaNinpre.hs
index 6f36fe5..bb86142 100644
--- a/lib/XMonad/Config/LaNinpre.hs
+++ b/lib/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 @@ spawnSelected' conf lst = gridselect conf lst >>= flip whenJust spawn
-- 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 @@ keybinds = [ ("M-<Return>", spawn terminalEmulator)
]
++
[("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 @@ localXmobarPP = def
, 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 @@ tabTheme = def
-- * 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 @@ localLayoutHook = windowNavigation
-- | 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
-
diff --git a/xmonad.hs b/xmonad.hs
index e407c68..0448ec7 100644
--- a/xmonad.hs
+++ b/xmonad.hs
@@ -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