refactor + misc
This commit is contained in:
parent
375e68b6e6
commit
e380cc1f30
|
@ -1,39 +1,37 @@
|
||||||
|
-- Base
|
||||||
import XMonad
|
import XMonad
|
||||||
import System.Exit
|
import System.Exit
|
||||||
|
import qualified XMonad.StackSet as W
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
import XMonad.Actions.CycleWS
|
import XMonad.Actions.CycleWS
|
||||||
|
|
||||||
-- Hooks
|
-- Hooks
|
||||||
import XMonad.Hooks.EwmhDesktops
|
import XMonad.Hooks.EwmhDesktops
|
||||||
-- Layout
|
|
||||||
|
-- Layouts
|
||||||
import XMonad.Layout.ThreeColumns
|
import XMonad.Layout.ThreeColumns
|
||||||
|
|
||||||
|
-- Layout modifiers
|
||||||
import XMonad.Layout.Spacing
|
import XMonad.Layout.Spacing
|
||||||
import XMonad.Layout.Renamed
|
import XMonad.Layout.Renamed
|
||||||
-- Util
|
|
||||||
|
-- Utilities
|
||||||
import XMonad.Util.EZConfig (additionalKeysP)
|
import XMonad.Util.EZConfig (additionalKeysP)
|
||||||
|
|
||||||
-- xmobar dependencies
|
-- xmobar dependencies
|
||||||
import XMonad.Hooks.DynamicLog
|
import XMonad.Hooks.DynamicLog
|
||||||
import XMonad.Hooks.StatusBar
|
import XMonad.Hooks.StatusBar
|
||||||
import XMonad.Hooks.StatusBar.PP
|
import XMonad.Hooks.StatusBar.PP
|
||||||
import XMonad.Util.Loggers
|
import XMonad.Util.Loggers
|
||||||
-- qualified imports
|
|
||||||
import qualified XMonad.StackSet as W
|
|
||||||
|
|
||||||
main :: IO ()
|
-- | Configuration
|
||||||
main = xmonad
|
myTerminal = "wezterm"
|
||||||
. ewmhFullscreen
|
myModMask = mod4Mask
|
||||||
. ewmh
|
myBorderWidth = 5
|
||||||
. withEasySB (statusBarProp "candybar" (pure myXmobarPP)) defToggleStrutsKey
|
myNormalBorderColor = "#282828"
|
||||||
$ myConfig
|
myFocusedBorderColor = "#282828"
|
||||||
|
myWorkspaces = ["code", "chat", "web", "games", "misc"]
|
||||||
myConfig = def
|
|
||||||
{ modMask = myModMask
|
|
||||||
, layoutHook = myLayout
|
|
||||||
, terminal = myTerminal
|
|
||||||
, borderWidth = myBorderWidth
|
|
||||||
, normalBorderColor = myNormalBorderColor
|
|
||||||
, focusedBorderColor = myFocusedBorderColor
|
|
||||||
, workspaces = myWorkspaces
|
|
||||||
} `additionalKeysP` myKeys
|
|
||||||
|
|
||||||
-- | Keybindings
|
-- | Keybindings
|
||||||
myKeys =
|
myKeys =
|
||||||
|
@ -43,7 +41,6 @@ myKeys =
|
||||||
, ("M-C-w" , kill ) -- %! Close the focused window
|
, ("M-C-w" , kill ) -- %! Close the focused window
|
||||||
-- layouts
|
-- layouts
|
||||||
, ("M-<Space>" , sendMessage NextLayout ) -- %! Rotate through the available layout algorithms
|
, ("M-<Space>" , sendMessage NextLayout ) -- %! Rotate through the available layout algorithms
|
||||||
, ("M-f" , sendMessage $ JumpToLayout "Full") -- %! Focus fullscreen layout
|
|
||||||
-- move focus up or down the window stack
|
-- move focus up or down the window stack
|
||||||
, ("M-<Down>" , windows W.focusDown ) -- %! Move focus to the next window
|
, ("M-<Down>" , windows W.focusDown ) -- %! Move focus to the next window
|
||||||
, ("M-<Up>" , windows W.focusUp ) -- %! Move focus to the previous window
|
, ("M-<Up>" , windows W.focusUp ) -- %! Move focus to the previous window
|
||||||
|
@ -76,52 +73,85 @@ myKeys =
|
||||||
, ("M-S-q" , io exitSuccess ) -- %! Quit xmonad
|
, ("M-S-q" , io exitSuccess ) -- %! Quit xmonad
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | Configuration
|
|
||||||
myTerminal = "wezterm"
|
|
||||||
myModMask = mod4Mask
|
|
||||||
myBorderWidth = 5
|
|
||||||
myNormalBorderColor = "#282828"
|
|
||||||
myFocusedBorderColor = "#282828"
|
|
||||||
myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
|
||||||
|
|
||||||
-- | Layouts
|
-- | Layouts
|
||||||
myLayout = gaps $ tiled ||| threeCol ||| Full
|
myLayout = gaps $ tiled ||| threeCol ||| full
|
||||||
where
|
where
|
||||||
-- Add a configurable amount of space around windows.
|
-- Add a configurable amount of space around windows.
|
||||||
gaps = spacingRaw False (Border 50 50 50 50) True (Border 10 10 10 10) True
|
gaps = spacingRaw False (Border 50 50 50 50) True (Border 10 10 10 10) True
|
||||||
|
-- Our layouts
|
||||||
threeCol = ThreeColMid nmaster delta ratio
|
tiled = renamed [Replace "Tiled"] $ Tall nmaster delta ratio
|
||||||
tiled = Tall nmaster delta ratio
|
threeCol = renamed [Replace "Three Column"] $ ThreeColMid nmaster delta ratio
|
||||||
|
full = renamed [Replace "Fullscreen"] $ Full
|
||||||
|
-- Layout settings
|
||||||
nmaster = 1 -- Default number of windows in the master pane
|
nmaster = 1 -- Default number of windows in the master pane
|
||||||
ratio = 1/2 -- Default proportion of screen occupied by master pane
|
ratio = 1/2 -- Default proportion of screen occupied by master pane
|
||||||
delta = 3/100 -- Percent of screen to increment by when resizing panes
|
delta = 3/100 -- Percent of screen to increment by when resizing panes
|
||||||
|
|
||||||
-- | Xmobar
|
-- | Xmobar
|
||||||
myXmobarPP :: PP
|
xmobarTop = statusBarPropTo "_XMONAD_LOG_1" "xmobar-top" (pure ppTop)
|
||||||
myXmobarPP = def
|
xmobarBottom = statusBarPropTo "_XMONAD_LOG_2" "xmobar-bottom" (pure ppBottom)
|
||||||
{ ppSep = magenta " • "
|
|
||||||
|
ppTop :: PP
|
||||||
|
ppTop = def
|
||||||
|
{ ppSep = grey0 " | "
|
||||||
, ppTitleSanitize = xmobarStrip
|
, ppTitleSanitize = xmobarStrip
|
||||||
, ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2
|
-- workspace labels
|
||||||
, ppHidden = white . wrap " " ""
|
, ppCurrent = purple . wrap " " ""
|
||||||
, ppHiddenNoWindows = lowWhite . wrap " " ""
|
, ppVisible = blue . wrap " " ""
|
||||||
, ppUrgent = red . wrap (yellow "!") (yellow "!")
|
, ppHidden = grey0 . wrap " " ""
|
||||||
|
, ppHiddenNoWindows = grey0 . wrap " " ""
|
||||||
|
, ppUrgent = red . wrap " " ""
|
||||||
|
-- misc
|
||||||
, ppOrder = \[ws, l, _, wins] -> [ws, l, wins]
|
, ppOrder = \[ws, l, _, wins] -> [ws, l, wins]
|
||||||
, ppExtras = [logTitles formatFocused formatUnfocused]
|
, ppExtras = [logTitles formatFocused formatUnfocused]
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
formatFocused = wrap (white "[") (white "]") . magenta . ppWindow
|
formatFocused = wrap (grey0 "") (grey0 " ") . purple . ppWindow
|
||||||
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue . ppWindow
|
formatUnfocused = wrap (grey0 "") (grey0 " ") . blue . ppWindow
|
||||||
|
|
||||||
-- | Windows should have *some* title, which should not not exceed a
|
-- | Windows should have *some* title, which should not not exceed a
|
||||||
-- sane length.
|
-- sane length.
|
||||||
ppWindow :: String -> String
|
ppWindow :: String -> String
|
||||||
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
|
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
|
||||||
|
|
||||||
|
-- | Gruvbox material
|
||||||
|
bg0, bg1, fg0, fg1, red, orange, yellow, green, aqua, blue, purple :: String -> String
|
||||||
|
-- backgrounds
|
||||||
|
bg0 = xmobarColor "#1d2021" ""
|
||||||
|
bg1 = xmobarColor "#282828" ""
|
||||||
|
-- foregrounds
|
||||||
|
fg0 = xmobarColor "#d4be98" ""
|
||||||
|
fg1 = xmobarColor "#ddc7a1" ""
|
||||||
|
-- greys
|
||||||
|
grey0 = xmobarColor "#7c6f64" ""
|
||||||
|
-- colors
|
||||||
|
red = xmobarColor "#ea6962" ""
|
||||||
|
orange = xmobarColor "#e78a4e" ""
|
||||||
|
yellow = xmobarColor "#d8a658" ""
|
||||||
|
green = xmobarColor "#a9b665" ""
|
||||||
|
aqua = xmobarColor "#89b482" ""
|
||||||
|
blue = xmobarColor "#7daea3" ""
|
||||||
|
purple = xmobarColor "#d3869b" ""
|
||||||
|
|
||||||
|
ppBottom :: PP
|
||||||
|
ppBottom = def
|
||||||
|
|
||||||
|
-- | The main function
|
||||||
|
main :: IO ()
|
||||||
|
main = xmonad
|
||||||
|
. ewmhFullscreen
|
||||||
|
. ewmh
|
||||||
|
. withEasySB (xmobarTop <> xmobarBottom) defToggleStrutsKey
|
||||||
|
$ myConfig
|
||||||
|
|
||||||
|
myConfig = def
|
||||||
|
{ modMask = myModMask
|
||||||
|
, layoutHook = myLayout
|
||||||
|
, terminal = myTerminal
|
||||||
|
, borderWidth = myBorderWidth
|
||||||
|
, normalBorderColor = myNormalBorderColor
|
||||||
|
, focusedBorderColor = myFocusedBorderColor
|
||||||
|
, workspaces = myWorkspaces
|
||||||
|
} `additionalKeysP` myKeys
|
||||||
|
|
||||||
blue, lowWhite, magenta, red, white, yellow :: String -> String
|
|
||||||
magenta = xmobarColor "#ff79c6" ""
|
|
||||||
blue = xmobarColor "#bd93f9" ""
|
|
||||||
white = xmobarColor "#f8f8f2" ""
|
|
||||||
yellow = xmobarColor "#f1fa8c" ""
|
|
||||||
red = xmobarColor "#ff5555" ""
|
|
||||||
lowWhite = xmobarColor "#bbbbbb" ""
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue