diff options
| author | Zofia Szweda <sophies@disroot.org> | 2026-09-07 20:15:48 +0200 |
|---|---|---|
| committer | Zofia Szweda <sophies@disroot.org> | 2026-09-07 20:43:10 +0200 |
| commit | 782a2237d475234f5b9a60f70c72e9917971ef88 (patch) | |
| tree | 7e2dfec29b398204f8cfe0d835036d69599b8ce0 /xmonad | |
| parent | 318c12cd91fbdfac5ce6b1bf991724c98380beb0 (diff) | |
XMonad: add an XMonad and XMobar config
Added a config for the Xmonad (https://xmonad.org) window manager, along with its bar
Diffstat (limited to 'xmonad')
| -rw-r--r-- | xmonad/.config/xmonad/stack.yaml | 68 | ||||
| -rw-r--r-- | xmonad/.config/xmonad/stack.yaml.lock | 13 | ||||
| -rw-r--r-- | xmonad/.config/xmonad/xmonad.hs | 133 |
3 files changed, 214 insertions, 0 deletions
diff --git a/xmonad/.config/xmonad/stack.yaml b/xmonad/.config/xmonad/stack.yaml new file mode 100644 index 0000000..3d3ad2a --- /dev/null +++ b/xmonad/.config/xmonad/stack.yaml @@ -0,0 +1,68 @@ +# This file was automatically generated by 'stack init' +# +# Some commonly used options have been documented as comments in this file. +# For advanced use and comprehensive documentation of the format, please see: +# https://docs.haskellstack.org/en/stable/configure/yaml/ + +# A 'specific' Stackage snapshot or a compiler version. +# A snapshot dictates the compiler version and the set of packages +# to be used for project dependencies. For example: +# +# snapshot: lts-24.43 +# snapshot: nightly-2026-05-29 +# snapshot: ghc-9.10.3 +# +# The location of a snapshot can be provided as a file or url. Stack assumes +# a snapshot provided as a file might change, whereas a url resource does not. +# +# snapshot: ./custom-snapshot.yaml +# snapshot: https://example.com/snapshots/2024-01-01.yaml +snapshot: + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/58.yaml + +# User packages to be built. +# Various formats can be used as shown in the example below. +# +# packages: +# - some-directory +# - https://example.com/foo/bar/baz-0.0.2.tar.gz +# subdirs: +# - auto-update +# - wai +packages: +- xmonad +- xmonad-contrib +# Dependency packages to be pulled from upstream that are not in the snapshot. +# These entries can reference officially published versions as well as +# forks / in-progress versions pinned to a git hash. For example: +# +# extra-deps: +# - acme-missiles-0.3 +# - git: https://github.com/commercialhaskell/stack.git +# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a +# +# extra-deps: [] + +# Override default flag values for project packages and extra-deps +# flags: {} + +# Extra package databases containing global packages +# extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true +# +# Require a specific version of Stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: ">=3.11" +# +# Override the architecture used by Stack, especially useful on Windows +# arch: i386 +# arch: x86_64 +# +# Extra directories used by Stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] +# +# Allow a newer minor version of GHC than the snapshot specifies +# compiler-check: newer-minor diff --git a/xmonad/.config/xmonad/stack.yaml.lock b/xmonad/.config/xmonad/stack.yaml.lock new file mode 100644 index 0000000..b0ae253 --- /dev/null +++ b/xmonad/.config/xmonad/stack.yaml.lock @@ -0,0 +1,13 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/topics/lock_files + +packages: [] +snapshots: +- completed: + sha256: d4d51e01349a3e51b7aa6c500a9da8b0b578043badaec1d5f210cfe27672f18d + size: 732465 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/58.yaml + original: + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/58.yaml diff --git a/xmonad/.config/xmonad/xmonad.hs b/xmonad/.config/xmonad/xmonad.hs new file mode 100644 index 0000000..022a9ee --- /dev/null +++ b/xmonad/.config/xmonad/xmonad.hs @@ -0,0 +1,133 @@ +{-# LANGUAGE ImportQualifiedPost #-} +{-# OPTIONS_GHC -Wno-deprecations #-} + +import Data.Map qualified as M +import System.Exit (exitSuccess) +import XMonad +import XMonad.Actions.CycleWS (nextScreen, shiftNextScreen) +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.InsertPosition +import XMonad.Hooks.ManageHelpers (isDialog) +import XMonad.Hooks.StatusBar +import XMonad.Hooks.StatusBar.PP +import XMonad.Layout.NoBorders (smartBorders) +import XMonad.Layout.Renamed (Rename (Replace), renamed) +import XMonad.StackSet qualified as W +import XMonad.Util.EZConfig (additionalKeysP) +import XMonad.Util.Ungrab + +myModMask :: KeyMask +myModMask = mod4Mask + +myTerminal :: String +myTerminal = "alacritty" + +myBorderWidth :: Dimension +myBorderWidth = 2 + +colBg, colFg, colAccent, colGrey :: String +colBg = "#101010" +colFg = "#cccccc" +colAccent = "#708090" +colGrey = "#606060" + +myWorkspaces :: [String] +myWorkspaces = map show [1 .. 9 :: Int] + +myLayout = renamed [Replace "[]="] tiled ||| renamed [Replace "[M]"] Full + where + tiled = Tall nmaster delta ratio + nmaster = 1 + ratio = 0.50 + delta = 3 / 100 + +myManageHook :: ManageHook +myManageHook = + composeAll + [ className =? "confirmreset" --> doFloat, + className =? "makebranch" --> doFloat, + className =? "maketag" --> doFloat, + className =? "ssh-askpass" --> doFloat, + className =? "Blueman-manager" --> doFloat, + className =? "Pavucontrol" --> doFloat, + title =? "branchdialog" --> doFloat, + title =? "pinentry" --> doFloat, + isDialog --> doFloat + ] + +myToggleFloat :: Window -> X () +myToggleFloat w = windows $ \s -> + if M.member w (W.floating s) + then W.sink w s + else W.float w (W.RationalRect 0.1 0.1 0.8 0.8) s + +myXmobarPP :: PP +myXmobarPP = + def + { ppCurrent = xmobarColor colBg colAccent . wrap " " " ", + ppHidden = xmobarColor colFg "" . wrap " " " ", + ppHiddenNoWindows = xmobarColor colGrey "" . wrap " " " ", + ppUrgent = xmobarColor "#ff5555" "" . wrap " " " ", + ppTitle = xmobarColor colFg "" . shorten 60, + ppLayout = xmobarColor colAccent "", + ppSep = xmobarColor colGrey "" " " + } + +main :: IO () +main = + xmonad + . ewmhFullscreen + . ewmh + . withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey + $ myConfig + +startup :: X () +startup = spawn "xset m 0" + +myConfig = + def + { modMask = myModMask, + terminal = myTerminal, + borderWidth = myBorderWidth, + normalBorderColor = colGrey, + focusedBorderColor = colAccent, + workspaces = myWorkspaces, + layoutHook = smartBorders myLayout, + manageHook = insertPosition End Newer <> myManageHook <+> manageHook def, + startupHook = startup + } + `additionalKeysP` [ ("M-<Return>", spawn myTerminal), + ("M-p", spawn "j4-dmenu-desktop"), + ("M-t", spawn "thunderbird"), + ("M-c", spawn (myTerminal ++ " -e vim")), + ("M-w", spawn "vivaldi"), + ("M-e", spawn "thunar"), + ("M-s", spawn "vesktop"), + ("M-x", spawn "loginctl lock-session"), + ("M-m", spawn (myTerminal ++ " -e ncmpcpp")), + ("<Print>", spawn "screenshot"), + ("S-<Print>", spawn "screenrecord"), + ("M-S-s", unGrab *> spawn "screenshot select"), + ("M-S-r", unGrab *> spawn "screenrecord select"), + ("M-q", kill), + ("M-f", withFocused myToggleFloat), + ("M-j", windows W.focusDown), + ("M-k", windows W.focusUp), + ("M-h", sendMessage Shrink), + ("M-l", sendMessage Expand), + ("M-S-h", sendMessage (IncMasterN 1)), + ("M-S-l", sendMessage (IncMasterN (-1))), + ("M-<Tab>", sendMessage NextLayout), + ("M-.", nextScreen), + ("M-S-.", shiftNextScreen), + ("M-C-q", io exitSuccess), + ("<XF86AudioRaiseVolume>", spawn "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), + ("<XF86AudioLowerVolume>", spawn "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), + ("<XF86AudioMute>", spawn "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), + ("<XF86AudioPlay>", spawn "playerctl play-pause"), + ("<XF86AudioNext>", spawn "playerctl next"), + ("<XF86AudioPrev>", spawn "playerctl previous"), + ("<XF86AudioStop>", spawn "playerctl stop"), + ("<XF86MonBrightnessUp>", spawn "brightnessctl set +5%"), + ("<XF86MonBrightnessDown>", spawn "brightnessctl set 5%-") + ] |
