commit 668d9bcd288593f2d98d226af5c39ee45942d3eb
parent 95ec56c34149267f015b0f1638df8bd845ba9929
Author: Ed van Bruggen <ed@edryd.org>
Date: Wed, 25 Dec 2024 01:48:55 -0500
xmonad: Add config files
Diffstat:
| M | Makefile | | | 2 | ++ |
| A | xmonad/xmobarrc | | | 92 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | xmonad/xmonad.hs | | | 101 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
3 files changed, 195 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
@@ -25,6 +25,8 @@ symlinks = bash_profile \
vimrc \
vimrc.bundles \
xinitrc \
+ xmonad/xmonad.hs \
+ xmonad/xmobarrc \
zshrc
sllinks = dmenu \
diff --git a/xmonad/xmobarrc b/xmonad/xmobarrc
@@ -0,0 +1,92 @@
+Config {
+
+ -- appearance
+ font = "FantasqueSansM Nerd Font Propo"
+ , bgColor = "#2F1E2E"
+ , fgColor = "#A39E9B"
+ , position = Top
+ -- , border = BottomB 50
+ -- , borderColor = "#2F1E2E"
+
+ -- layout
+ , sepChar = "%" -- delineator between plugin names and straight text
+ , alignSep = "}{" -- separator between left-right alignment
+ , template = "%XMonadLog% }{ %KBDL% <fc=#E7E9DB,#2F1E2E></fc> %multicpu% %memory%<fc=#06B6EF,#2F1E2E></fc>%battery%<fc=#815BA4,#06B6EF></fc>%date%"
+ -- general behavior
+ , lowerOnStart = True -- send to bottom of window stack on start
+ , hideOnStart = False -- start with window unmapped (hidden)
+ , allDesktops = True -- show on all desktops
+ , overrideRedirect = True -- set the Override Redirect flag (Xlib)
+ , pickBroadest = False -- choose widest display (multi-monitor)
+ , persistent = True -- enable/disable hiding (True = disabled)
+
+ -- plugins
+ -- Numbers can be automatically colored according to their value. xmobar
+ -- decides color based on a three-tier/two-cutoff system, controlled by
+ -- command options:
+ -- --Low sets the low cutoff
+ -- --High sets the high cutoff
+ --
+ -- --low sets the color below --Low cutoff
+ -- --normal sets the color between --Low and --High cutoffs
+ -- --High sets the color above --High cutoff
+ --
+ -- The --template option controls how the plugin is displayed. Text
+ -- color can be set by enclosing in <fc></fc> tags. For more details
+ -- see http://projects.haskell.org/xmobar/#system-monitor-plugins.
+ , commands =
+
+ -- weather monitor
+ [ Run Weather "KBDL" [ "--template", "<fc=#A39E9B,#2F1E2E> <skyCondition> <tempC>°C </fc>"
+ ] 36000
+
+ -- network activity monitor (dynamic interface resolution)
+ , Run DynNetwork [ "--template" , "<dev>: <tx>kB/s|<rx>kB/s"
+ , "--Low" , "1000" -- units: B/s
+ , "--High" , "5000" -- units: B/s
+ , "--low" , "darkgreen"
+ , "--normal" , "darkorange"
+ , "--high" , "darkred"
+ ] 10
+
+ -- cpu activity monitor
+ , Run MultiCpu [ "--template" , "<fc=#E7E9DB,#2F1E2E> <total0>%|<total1>% </fc>"
+ , "--Low" , "50" -- units: %
+ , "--High" , "85" -- units: %
+ -- , "--low" , "darkgreen"
+ -- , "--normal" , "darkorange"
+ -- , "--high" , "darkred"
+ ] 10
+
+ -- memory usage monitor
+ , Run Memory [ "--template" ,"<fc=#815BA4,#2F1E2E> <usedratio>% </fc>"
+ , "--Low" , "20" -- units: %
+ , "--High" , "90" -- units: %
+ -- , "--low" , "darkgreen"
+ -- , "--normal" , "darkorange"
+ -- , "--high" , "darkred"
+ ] 10
+
+ -- battery monitor
+ , Run Battery [ "--template" , "<fc=#E7E9DB,#06B6EF><acstatus></fc>"
+ , "--Low" , "10" -- units: %
+ , "--High" , "80" -- units: %
+ -- , "--low" , "#E7E9DB,#06B6EF"
+ -- , "--normal" , "#E7E9DB,#06B6EF"
+ -- , "--high" , "#E7E9DB,#06B6EF"
+
+ , "--" -- battery specific options
+ -- discharging status
+ , "-o" , " <left>% "
+ -- AC "on" status
+ , "-O" , " <left>% "
+ -- charged status
+ , "-i" , "<fc=#006000>Charged</fc>"
+ ] 50
+
+ -- time and date indicator
+ -- (%F = y-m-d date, %a = day of week, %T = h:m:s time)
+ , Run Date "<fc=#E7E9DB,#815BA4> %b %e %l:%M </fc>" "date" 10
+ , Run XMonadLog
+ ]
+ }
diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs
@@ -0,0 +1,101 @@
+import XMonad
+
+import XMonad.Hooks.DynamicLog
+import XMonad.Hooks.StatusBar
+import XMonad.Hooks.StatusBar.PP
+import XMonad.Hooks.InsertPosition
+
+import XMonad.Util.Loggers
+import XMonad.Util.EZConfig (additionalKeys)
+import Graphics.X11.ExtraTypes.XF86
+
+import XMonad.Actions.CycleWS
+import XMonad.Actions.DwmPromote
+
+import XMonad.StackSet as W
+import XMonad.ManageHook
+import XMonad.Util.NamedScratchpad
+
+scratchpads = [
+-- run htop in xterm, find it by title, use default floating window placement
+ NS "htop" "st -e htop" (title =? "htop") defaultFloating ,
+ NS "term" "st -t terminal" (title =? "terminal") defaultFloating ,
+
+-- run stardict, find it by class name, place it in the floating window
+-- 1/6 of screen width from the left, 1/6 of screen height
+-- from the top, 2/3 of screen width by 2/3 of screen height
+ NS "stardict" "stardict" (className =? "Stardict")
+ (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3)) ,
+
+-- run gvim, find by role, don't float
+ NS "notes" "gvim --role notes ~/notes.txt" (role =? "notes") nonFloating
+ ] where role = stringProperty "WM_WINDOW_ROLE"
+
+myKeys conf@(XConfig {modMask = modKey}) =
+ [ ((modKey, xK_Return), spawn $ terminal conf)
+ , ((modKey .|. shiftMask, xK_Return), dwmpromote)
+ , ((modKey, xK_Tab), toggleWS)
+ -- Volume Control
+ , ((0, xF86XK_AudioMute), spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle")
+ , ((0, xF86XK_AudioLowerVolume), spawn "pactl set-sink-volume @DEFAULT_SINK@ -10%")
+ , ((0, xF86XK_AudioRaiseVolume), spawn "pactl set-sink-volume @DEFAULT_SINK@ +10%")
+ , ((0, xF86XK_AudioMicMute), spawn "pactl set-source-mute @DEFAULT_SOURCE@ toggle")
+ -- Brightness Control
+ , ((0, xF86XK_MonBrightnessUp), spawn "brightnessctl set +2%")
+ , ((0, xF86XK_MonBrightnessDown), spawn "brightnessctl set 2%-")
+ -- , ("M-S-z", spawn "xscreensaver-command -lock")
+ , ((modKey .|. controlMask .|. shiftMask, xK_t), namedScratchpadAction scratchpads "term")
+ , ((modKey .|. controlMask .|. shiftMask, xK_h), namedScratchpadAction scratchpads "htop")
+ -- , ((modKey .|. controlMask .|. shiftMask, xK_n), namedScratchpadAction scratchpads "notes") -- , ("M-C-s", unGrab *> spawn "scrot -s" )
+ ] ++
+ [((m .|. mod4Mask, k), windows $ f i)
+ | (i, k) <- zip ["1","2","3","4","5","6","7","8","9"] [xK_1 .. xK_9]
+ , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
+
+myManageHook :: ManageHook
+myManageHook = composeAll
+ [ --className =? "Gimp" --> doFloat
+ -- isDialog --> doFloat
+ insertPosition Below Newer
+ , namedScratchpadManageHook scratchpads
+ ]
+
+myConfig = def
+ { terminal = "tabbed -ck st -w"
+ , modMask = mod4Mask -- Rebind Mod to the Super key
+ , manageHook = myManageHook
+ , focusedBorderColor = "#815BA4"
+ , borderWidth = 2
+ }
+
+myXmobarPP :: PP
+myXmobarPP = def
+ { ppSep = magenta " • "
+ , ppTitleSanitize = xmobarStrip
+ , ppCurrent = medWhite . wrap " " "" . xmobarBorder "Top" "#06B6EF" 2
+ , ppHidden = white . wrap " " ""
+ , ppHiddenNoWindows = lowWhite . wrap " " ""
+ , ppUrgent = red . wrap (yellow "!") (yellow "!")
+ , ppOrder = \[ws, l, _, wins] -> [ws, l, wins]
+ , ppExtras = [logTitles formatFocused formatUnfocused]
+ }
+ where
+ formatFocused = wrap (white "[") (white "]") . blue . ppWindow
+ formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . magenta . ppWindow
+
+ -- | Windows should have *some* title, which should not not exceed a sane length.
+ ppWindow :: String -> String
+ ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 50
+
+ blue, lowWhite, magenta, red, white, yellow :: String -> String
+ magenta = xmobarColor "#815BA4" ""
+ blue = xmobarColor "#06B6EF" ""
+ white = xmobarColor "#E7E9DB" ""
+ yellow = xmobarColor "#FEC418" ""
+ red = xmobarColor "#EF6155" ""
+ lowWhite = xmobarColor "#A39E9B" ""
+ medWhite = xmobarColor "#DDDDDD" ""
+
+main = xmonad
+ . withEasySB (statusBarProp "xmobar /home/ed/.xmonad/xmobarrc" (pure myXmobarPP)) defToggleStrutsKey
+ $ myConfig `additionalKeys` (myKeys myConfig)