Move from xmonad to spectrwm
b21488b832e361d66f6bac0ed04d773e1b48a4a3
1 parent
d57bdc7a
.xinitrc
+1 -1
| 26 | 26 | ||
| 27 | 27 | [ -f ~/.fehbg ] && . ~/.fehbg |
|
| 28 | 28 | [ -f ~/.wacom ] && . ~/.wacom |
|
| 29 | 29 | ||
| 30 | 30 | # `dbus-launch` is required for flameshot. |
|
| 31 | - | exec dbus-launch xmonad |
|
| 31 | + | exec dbus-launch spectrwm |
.xmobarrc
deleted
+0 -30
| 1 | - | -- Xmobar configuration |
|
| 2 | - | -- vim: ft=haskell |
|
| 3 | - | -- |
|
| 4 | - | Config { |
|
| 5 | - | font = "xft:monospace:size=10,fallback:size=10" |
|
| 6 | - | , borderColor = "black" |
|
| 7 | - | , border = TopB |
|
| 8 | - | , bgColor = "#000000" |
|
| 9 | - | , fgColor = "#dddddd" |
|
| 10 | - | , position = BottomSize C 100 48 |
|
| 11 | - | , persistent = True |
|
| 12 | - | , verbose = True |
|
| 13 | - | , commands = |
|
| 14 | - | [ Run StdinReader |
|
| 15 | - | , Run Cpu [ "-t", "<fc=#555>CPU</fc> <total>%" ] 50 |
|
| 16 | - | , Run Alsa "default" "Master" ["--template", "<fc=#555>VOL</fc> <volume>%"] |
|
| 17 | - | , Run Memory [ "-t", "<fc=#555>RAM</fc> <available>" ] 50 |
|
| 18 | - | , Run Brightness [ "-t", "☀ <percent>", "--", "-D", "intel_backlight" ] 60 |
|
| 19 | - | , Run Date "%b %d %H:%M" "date" 10 |
|
| 20 | - | , Run DiskU [("/", "<fc=#555>/</fc> <free>"), ("/home", "<fc=#555>/home</fc> <free>")] [] 20 |
|
| 21 | - | , Run CommandReader "xmobar-sync-status" "sync" |
|
| 22 | - | , Run Com "todo-widget" [] "todo" 10 |
|
| 23 | - | , Run Com "xmobar-brightness" [] "brightness" 10 |
|
| 24 | - | , Run Wireless "wlan0" [ "--template", "<essid>/<fc=#666><quality></fc>"] 10 |
|
| 25 | - | , Run Battery [ "-t", "⌁ <left>%" ] 100 |
|
| 26 | - | ] |
|
| 27 | - | , sepChar = "%" |
|
| 28 | - | , alignSep = "}{" |
|
| 29 | - | , template = " %StdinReader% }{ %sync% %todo% %alsa:default:Master% %disku% %memory% %cpu% %wlan0wi% %bright% %battery% <fc=#aaaaaa>%date%</fc> " |
|
| 30 | - | } |
.xmonad/README
deleted
+0 -9
| 1 | - | XMONAD |
|
| 2 | - | ||
| 3 | - | git clone <xmonad.git> xmonad-git |
|
| 4 | - | git clone <xmonad-contrib.git> xmonad-contrib-git |
|
| 5 | - | git clone <xmobar.git> xmobar-git |
|
| 6 | - | ||
| 7 | - | curl -sSL https://get.haskellstack.org | sh |
|
| 8 | - | ||
| 9 | - | pacman -S libxss pkg-config |
.xmonad/xmonad.hs
deleted
+0 -181
| 1 | - | {-# OPTIONS_GHC -Wno-deprecations #-} |
|
| 2 | - | import XMonad |
|
| 3 | - | import XMonad.Config.Desktop |
|
| 4 | - | import XMonad.Hooks.DynamicLog |
|
| 5 | - | import XMonad.Hooks.ManageDocks |
|
| 6 | - | import XMonad.Util.Run |
|
| 7 | - | import XMonad.Layout.Spacing |
|
| 8 | - | import XMonad.StackSet hiding (workspaces) |
|
| 9 | - | import XMonad.ManageHook |
|
| 10 | - | import XMonad.Layout.NoBorders |
|
| 11 | - | import XMonad.Layout.ThreeColumns |
|
| 12 | - | import XMonad.Hooks.EwmhDesktops |
|
| 13 | - | import XMonad.Actions.CycleWS |
|
| 14 | - | import XMonad.Util.EZConfig (additionalKeys, additionalKeysP) |
|
| 15 | - | import XMonad.Prompt |
|
| 16 | - | import XMonad.Prompt.XMonad |
|
| 17 | - | ||
| 18 | - | import XMonad.Hooks.UrgencyHook |
|
| 19 | - | import XMonad.Hooks.FloatNext |
|
| 20 | - | ||
| 21 | - | import Graphics.X11.ExtraTypes.XF86 |
|
| 22 | - | ||
| 23 | - | import System.Directory |
|
| 24 | - | import System.IO |
|
| 25 | - | import System.Exit |
|
| 26 | - | import System.FilePath |
|
| 27 | - | import Text.Printf |
|
| 28 | - | import Data.Map (Map) |
|
| 29 | - | import qualified Data.Map as Map |
|
| 30 | - | import Control.Monad |
|
| 31 | - | ||
| 32 | - | data InputPrompt = InputPrompt String |
|
| 33 | - | ||
| 34 | - | instance XPrompt InputPrompt where |
|
| 35 | - | showXPrompt (InputPrompt s) = " " ++ s |
|
| 36 | - | ||
| 37 | - | inputPrompt :: XPConfig -> String -> X (Maybe String) |
|
| 38 | - | inputPrompt c p = mkXPromptWithReturn (InputPrompt p) c (const (pure [])) return |
|
| 39 | - | ||
| 40 | - | data EnterPrompt = EnterPrompt String |
|
| 41 | - | ||
| 42 | - | instance XPrompt EnterPrompt where |
|
| 43 | - | showXPrompt (EnterPrompt n) = " " ++ n ++ " " |
|
| 44 | - | ||
| 45 | - | screenshotPrompt :: String -> Bool -> X () |
|
| 46 | - | screenshotPrompt home select = do |
|
| 47 | - | str <- inputPrompt cfg "~/screenshots/" |
|
| 48 | - | case str of |
|
| 49 | - | Just s -> spawn $ printf "sleep 0.3 && scrot %s '%s' -e 'mv $f ~/screenshots'" mode s |
|
| 50 | - | Nothing -> pure () |
|
| 51 | - | where |
|
| 52 | - | mode = if select then "--select" else "--focused" |
|
| 53 | - | cfg = myXPConfig { position = CenteredAt 0.5 0.3 |
|
| 54 | - | , defaultText = "" } |
|
| 55 | - | ||
| 56 | - | editPrompt :: String -> X () |
|
| 57 | - | editPrompt home = do |
|
| 58 | - | str <- inputPrompt cfg "$ edit ~/" |
|
| 59 | - | case str of |
|
| 60 | - | Just s -> openInEditor s |
|
| 61 | - | Nothing -> pure () |
|
| 62 | - | where |
|
| 63 | - | cfg = myXPConfig { position = CenteredAt 0.5 0.3 |
|
| 64 | - | , defaultText = "" } |
|
| 65 | - | ||
| 66 | - | openInEditor :: String -> X () |
|
| 67 | - | openInEditor path = |
|
| 68 | - | safeSpawn termName ["nvim", path] |
|
| 69 | - | ||
| 70 | - | termName :: FilePath |
|
| 71 | - | termName = "kitty" |
|
| 72 | - | ||
| 73 | - | main :: IO () |
|
| 74 | - | main = do |
|
| 75 | - | home <- getHomeDirectory |
|
| 76 | - | xmproc <- spawnPipe "xmobar" |
|
| 77 | - | xmonad $ withUrgencyHook NoUrgencyHook $ ewmh $ desktopConfig |
|
| 78 | - | { terminal = termName |
|
| 79 | - | , workspaces = ["α", "β", "γ", "δ", "φ", "σ", "η", "θ", "λ", "ω"] |
|
| 80 | - | , focusedBorderColor = "medium aquamarine" |
|
| 81 | - | , normalBorderColor = "#1F1F1F" |
|
| 82 | - | , borderWidth = 1 |
|
| 83 | - | , handleEventHook = mconcat [docksEventHook, handleEventHook def] |
|
| 84 | - | , keys = myKeys home |
|
| 85 | - | , logHook = dynamicLogWithPP (barConfig xmproc) |
|
| 86 | - | , layoutHook = smartBorders $ avoidStruts $ myLayout |
|
| 87 | - | , manageHook = floatNextHook <+> manageDocks <+> manageHook def |
|
| 88 | - | , startupHook = docksStartupHook |
|
| 89 | - | } `additionalKeysP` myXF86Keys |
|
| 90 | - | where |
|
| 91 | - | myLayout = tiled ||| Mirror tiled ||| Full |
|
| 92 | - | tiled = Tall nmaster delta ratio |
|
| 93 | - | nmaster = 1 |
|
| 94 | - | ratio = 1/2 |
|
| 95 | - | delta = 4/100 |
|
| 96 | - | ||
| 97 | - | myXF86Keys = |
|
| 98 | - | [ ("<XF86MonBrightnessUp>", safeSpawn "light" ["-A", "5"]) |
|
| 99 | - | , ("<XF86MonBrightnessDown>", safeSpawn "light" ["-U", "5"]) |
|
| 100 | - | , ("<XF86AudioRaiseVolume>", safeSpawn "amixer" ["-q", "sset", "Master", "2+"]) |
|
| 101 | - | , ("<XF86AudioLowerVolume>", safeSpawn "amixer" ["-q", "sset", "Master", "2-"]) |
|
| 102 | - | , ("<XF86AudioMute>", safeSpawn "amixer" ["-q", "sset", "Master", "toggle"]) |
|
| 103 | - | ] |
|
| 104 | - | ||
| 105 | - | startup :: X () |
|
| 106 | - | startup = do |
|
| 107 | - | -- Open a terminal if none are open. |
|
| 108 | - | withWindowSet $ \wins -> do |
|
| 109 | - | result <- filterM (runQuery (title =? termName)) (allWindows wins) |
|
| 110 | - | when (null result) $ |
|
| 111 | - | safeSpawnProg termName |
|
| 112 | - | ||
| 113 | - | barConfig :: Handle -> PP |
|
| 114 | - | barConfig h = xmobarPP |
|
| 115 | - | { ppCurrent = xmobarColor white black . wrap " " " " |
|
| 116 | - | , ppHiddenNoWindows = xmobarColor dgrey black . wrap " " " " |
|
| 117 | - | , ppHidden = xmobarColor grey black . wrap " " " " |
|
| 118 | - | , ppUrgent = xmobarColor black red . wrap " " " " |
|
| 119 | - | , ppTitle = xmobarColor red black |
|
| 120 | - | , ppLayout = const "" |
|
| 121 | - | , ppWsSep = " " |
|
| 122 | - | , ppSep = " " |
|
| 123 | - | , ppOutput = hPutStrLn h |
|
| 124 | - | } |
|
| 125 | - | where |
|
| 126 | - | red = "maroon" |
|
| 127 | - | dred = "maroon" |
|
| 128 | - | white = "white" |
|
| 129 | - | black = "black" |
|
| 130 | - | light = "#888888" |
|
| 131 | - | dark = "#333333" |
|
| 132 | - | grey = "#777777" |
|
| 133 | - | dgrey = "#333333" |
|
| 134 | - | ||
| 135 | - | toggleStrutsKey :: XConfig t -> (KeyMask, KeySym) |
|
| 136 | - | toggleStrutsKey XConfig { XMonad.modMask = modMask } = (modMask, xK_b) |
|
| 137 | - | ||
| 138 | - | myXPConfig :: XPConfig |
|
| 139 | - | myXPConfig = def |
|
| 140 | - | { position = CenteredAt 0.5 0.1 |
|
| 141 | - | , alwaysHighlight = True |
|
| 142 | - | , height = 60 |
|
| 143 | - | , promptBorderWidth = 1 |
|
| 144 | - | , font = "xft:monospace:size=13" |
|
| 145 | - | , borderColor = "aquamarine" |
|
| 146 | - | , bgColor = "black" |
|
| 147 | - | } |
|
| 148 | - | ||
| 149 | - | myKeys :: FilePath -> XConfig Layout -> Map (KeyMask, KeySym) (X ()) |
|
| 150 | - | myKeys home conf@XConfig { XMonad.modMask = modMask } = |
|
| 151 | - | Map.union ks (XMonad.keys def conf) |
|
| 152 | - | where |
|
| 153 | - | ks = Map.fromList |
|
| 154 | - | [ ((modMask, xK_F12), safeSpawn "systemctl" ["suspend"]) |
|
| 155 | - | , ((modMask .|. shiftMask, xK_F12), safeSpawn "systemctl" ["hibernate"]) |
|
| 156 | - | , ((modMask, xK_F11), safeSpawnProg "slock") |
|
| 157 | - | , ((modMask, xK_F10), safeSpawnProg "toggle-displays") |
|
| 158 | - | , ((modMask, xK_F5), safeSpawnProg "refresh-display") |
|
| 159 | - | , ((modMask .|. controlMask, xK_r), safeSpawn "killall" ["kitty", "-USR1"]) |
|
| 160 | - | , ((modMask, xK_s), safeSpawn "autorandr" ["--change"]) |
|
| 161 | - | , ((modMask, xK_p), runExecutable) |
|
| 162 | - | , ((modMask .|. shiftMask, xK_p), editPrompt home) |
|
| 163 | - | , ((modMask, xK_o), switchWindow) |
|
| 164 | - | , ((modMask, xK_Tab), toggleWS) |
|
| 165 | - | , ((modMask .|. controlMask, xK_Return), toggleFloatNext >> (spawn $ XMonad.terminal conf)) |
|
| 166 | - | , ((modMask, xK_Print), screenshotPrompt home False) |
|
| 167 | - | , ((modMask .|. shiftMask, xK_Print), screenshotPrompt home True) |
|
| 168 | - | , ((modMask, xK_0), windows $ greedyView "ω") |
|
| 169 | - | , ((modMask .|. shiftMask, xK_0), windows $ shift "ω") |
|
| 170 | - | , ((modMask, xK_Left), prevWS) |
|
| 171 | - | , ((modMask, xK_Right), nextWS) |
|
| 172 | - | ] |
|
| 173 | - | ||
| 174 | - | rofi :: String -> [String] -> X () |
|
| 175 | - | rofi mode opts = safeSpawn "rofi" (opts ++ ["-show", mode]) |
|
| 176 | - | ||
| 177 | - | runExecutable :: X () |
|
| 178 | - | runExecutable = rofi "run" [] |
|
| 179 | - | ||
| 180 | - | switchWindow :: X () |
|
| 181 | - | switchWindow = rofi "window" ["-width", "50", "-lines", "14"] |
bin/spectrwm-status
added
+3 -0
| 1 | + | #!/bin/sh |
|
| 2 | + | ||
| 3 | + | exec conky |