summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/xbindkeysrc3
-rw-r--r--lib/xmonad.hs201
2 files changed, 113 insertions, 91 deletions
diff --git a/lib/xbindkeysrc b/lib/xbindkeysrc
new file mode 100644
index 0000000..b28b04f
--- /dev/null
+++ b/lib/xbindkeysrc
@@ -0,0 +1,3 @@
+
+
+
diff --git a/lib/xmonad.hs b/lib/xmonad.hs
index bc206d3..7fcff32 100644
--- a/lib/xmonad.hs
+++ b/lib/xmonad.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE LambdaCase #-}
+
{-
Docs:
@@ -12,6 +13,7 @@ Docs:
-}
+import Data.List (intercalate)
import Data.Functor ((<&>))
import Graphics.X11.ExtraTypes.XF86
import XMonad
@@ -34,31 +36,33 @@ import XMonad.Util.EZConfig (additionalKeys)
-- Colors
data Colors = Colors
- { foreground :: String
- , background :: String
- , highlight :: String
+ { foreground :: String,
+ background :: String,
+ highlight :: String
}
-lightTheme = Colors
- { highlight = "#67b11d"
- , background = "#f6f1e1"
- , foreground = "#655370"
- }
+lightTheme =
+ Colors
+ { highlight = "#67b11d",
+ background = "#f6f1e1",
+ foreground = "#655370"
+ }
-darkTheme = Colors
- { highlight = "#5d4d7a"
- , background = "#292b2e"
- , foreground = "#b2b2b2"
- }
+darkTheme =
+ Colors
+ { highlight = "#5d4d7a",
+ background = "#292b2e",
+ foreground = "#b2b2b2"
+ }
getColorsFromXtheme :: IO Colors
getColorsFromXtheme =
readFile "/home/ben/.local/share/xtheme"
- <&> filter (/= '\n')
- >>= \case
- "light" -> return lightTheme
- "dark" -> return darkTheme
- _ -> return darkTheme
+ <&> filter (/= '\n')
+ >>= \case
+ "light" -> return lightTheme
+ "dark" -> return darkTheme
+ _ -> return darkTheme
nixBin :: String
nixBin = "/home/ben/.nix-profile/bin/"
@@ -67,36 +71,44 @@ altMask :: KeyMask
altMask = mod1Mask
brighter = "brightnessctl s 5%+"
-dimmer = "brightnessctl s 5%-"
+
+dimmer = "brightnessctl s 5%-"
insKeys :: XConfig l -> [((KeyMask, KeySym), X ())]
insKeys conf@(XConfig {modMask = modMask}) =
- [ ((modMask, xK_y), spawn $ nixBin <> "passmenu")
- , ((modMask, xK_m), spawn "cmdtree")
- , ((modMask, xK_o), spawn "cmdtree")
-
- -- restart xmonad nia home-manager
- , ((modMask, xK_r)
- , spawn "$HOME/.nix-profile/bin/xmonad --recompile && $HOME/.nix-profile/bin/xmonad --restart")
-
- -- sticky windows
- , ((modMask, xK_a ), windows copyToAll) -- @@ Make focused window always visible
- , ((modMask .|. shiftMask, xK_a ), killAllOtherCopies) -- @@ Toggle window state back
-
- -- media/ function keys
- -- backlight
- , ((0, xK_F5), spawn dimmer)
- , ((0, xK_F6), spawn brighter)
- , ((0, xF86XK_KbdBrightnessDown), spawn dimmer)
- , ((0, xF86XK_KbdBrightnessUp), spawn brighter)
- -- volume controls
- , ((0, xK_F1), amixer "toggle")
- , ((0, xK_F2), amixer "2%+")
- , ((0, xK_F3), amixer "2%-")
-
- , ((0, xF86XK_AudioMute), amixer "toggle")
- , ((0, xF86XK_AudioLowerVolume), amixer "2%-")
- , ((0, xF86XK_AudioRaiseVolume), amixer "2%+")
+ [ ((modMask, xK_y), spawn $ nixBin <> "passmenu"),
+ ((modMask, xK_m), spawn "cmdtree"),
+ ((modMask, xK_o), spawn "cmdtree"),
+
+ -- restart xmonad and display stuff via home-manager
+ ( (modMask, xK_r),
+ spawn $
+ intercalate
+ " && "
+ [ "$HOME/.nix-profile/bin/xmonad --recompile",
+ "$HOME/.nix-profile/bin/xmonad --restart",
+ "$HOME/.nix-profile/bin/xlayoutdisplay",
+ "$HOME/bin/uctl restart polybar"
+ ]
+ ),
+
+ -- sticky windows
+ ((modMask, xK_a), windows copyToAll), -- @@ Make focused window always visible
+ ((modMask .|. shiftMask, xK_a), killAllOtherCopies), -- @@ Toggle window state back
+
+ -- media/ function keys
+ -- backlight
+ ((0, xK_F5), spawn dimmer),
+ ((0, xK_F6), spawn brighter),
+ ((0, xF86XK_KbdBrightnessDown), spawn dimmer),
+ ((0, xF86XK_KbdBrightnessUp), spawn brighter),
+ -- volume controls
+ ((0, xK_F1), amixer "toggle"),
+ ((0, xK_F2), amixer "2%+"),
+ ((0, xK_F3), amixer "2%-"),
+ ((0, xF86XK_AudioMute), amixer "toggle"),
+ ((0, xF86XK_AudioLowerVolume), amixer "2%-"),
+ ((0, xF86XK_AudioRaiseVolume), amixer "2%+")
]
amixer :: String -> X ()
@@ -110,55 +122,62 @@ myWorkspaces :: [String]
myWorkspaces = ["1[chat]", "2[emacs]", "3[work]", "4[dandel]", "5[sabten]", "6[study]"] ++ map show [7 .. 9]
addSpace :: l a -> ModifiedLayout Spacing l a
-addSpace = spacingRaw
- True (Border 5 5 5 5)
- True (Border 5 5 5 5)
- True
-
-myTabCfg theme = def
- { fontName = "xft:Fira Sans:size=10:ant"
- , activeBorderColor = highlight theme
- , inactiveBorderColor = background theme
- , activeColor = highlight theme
- , inactiveColor = background theme
- }
-
-myLayout theme = avoidStruts $
- noBorders (tabbed shrinkText $ myTabCfg theme)
- ||| noBorders Full
- ||| twopane
- ||| Mirror twopane
- ||| ThreeCol 1 (3/100) (1/2)
- ||| ThreeColMid 1 (3/100) (1/2)
- ||| tiled
- ||| Mirror tiled
- ||| emptyBSP
- ||| goldenSpiral
- ||| Spiral R Dwindle.CW (3/2) (11/10) -- L/R is where to put non-main windows
+addSpace =
+ spacingRaw
+ True
+ (Border 5 5 5 5)
+ True
+ (Border 5 5 5 5)
+ True
+
+myTabCfg theme =
+ def
+ { fontName = "xft:Fira Sans:size=10:ant",
+ activeBorderColor = highlight theme,
+ inactiveBorderColor = background theme,
+ activeColor = highlight theme,
+ inactiveColor = background theme
+ }
+
+myLayout theme =
+ avoidStruts $
+ noBorders (tabbed shrinkText $ myTabCfg theme)
+ ||| noBorders Full
+ ||| twopane
+ ||| Mirror twopane
+ ||| ThreeCol 1 (3 / 100) (1 / 2)
+ ||| ThreeColMid 1 (3 / 100) (1 / 2)
+ ||| tiled
+ ||| Mirror tiled
+ ||| emptyBSP
+ ||| goldenSpiral
+ ||| Spiral R Dwindle.CW (3 / 2) (11 / 10) -- L/R is where to put non-main windows
where
- -- The last parameter is fraction to multiply the slave window heights
- -- with. Useless here.
- tiled = addSpace $ ResizableTall nmaster delta ratio []
- -- The default number of windows in the master pane
- nmaster = 1
- -- In this layout the second pane will only show the focused window.
- twopane = addSpace $ TwoPane delta ratio
- -- Default proportion of screen occupied by master pane
- ratio = 1/2
- -- Percent of screen to increment by when resizing panes
- delta = 3/100
+ -- The last parameter is fraction to multiply the slave window heights
+ -- with. Useless here.
+ tiled = addSpace $ ResizableTall nmaster delta ratio []
+ -- The default number of windows in the master pane
+ nmaster = 1
+ -- In this layout the second pane will only show the focused window.
+ twopane = addSpace $ TwoPane delta ratio
+ -- Default proportion of screen occupied by master pane
+ ratio = 1 / 2
+ -- Percent of screen to increment by when resizing panes
+ delta = 3 / 100
myConf theme = additionalKeys c (insKeys c)
- where c = def
- { modMask = mod4Mask -- ^ super instead of alt
- , normalBorderColor = background theme
- , focusedBorderColor = highlight theme
- , borderWidth = 3
- , manageHook = manageDocks <+> manageHook def
- , layoutHook = myLayout theme
- , terminal = "/home/ben/.nix-profile/bin/urxvt"
- , workspaces = myWorkspaces
- }
+ where
+ c =
+ def
+ { modMask = mod4Mask, -- super instead of alt
+ normalBorderColor = background theme,
+ focusedBorderColor = highlight theme,
+ borderWidth = 3,
+ manageHook = manageDocks <+> manageHook def,
+ layoutHook = myLayout theme,
+ terminal = "/home/ben/.nix-profile/bin/urxvt",
+ workspaces = myWorkspaces
+ }
main :: IO ()
main = do