Update xmonad/xmonad.hs

main
千住柱間 2024-03-03 02:42:19 +00:00
parent 61ef0f0e75
commit 2bc587b613
1 changed files with 22 additions and 18 deletions

View File

@ -21,23 +21,20 @@ import XMonad.Layout.Spacing
import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops
import XMonad.Util.SpawnOnce (spawnOnce) import XMonad.Util.SpawnOnce (spawnOnce)
-- run or raise -- run or raise
import XMonad.Actions.WindowGo (runOrRaise) import XMonad.Actions.WindowGo (raiseMaybe, runOrRaise)
import XMonad.ManageHook (className) import XMonad.ManageHook (className)
import XMonad.StackSet (RationalRect(..)) import XMonad.StackSet (RationalRect(..))
-- --
import XMonad.Layout.Decoration (decoration, DefaultShrinker(..), Theme(..), shrinkText) import XMonad.Layout.Decoration
import XMonad.Layout.Simplest import XMonad.Layout.Simplest
import XMonad.Layout.SimplestFloat import XMonad.Layout.SimplestFloat
import XMonad.Layout.Spacing import XMonad.Layout.Spacing
main :: IO () main :: IO ()
main = xmonad main = xmonad
. ewmhFullscreen . ewmhFullscreen
@ -49,6 +46,7 @@ myConfig = def
{ modMask = mod4Mask -- Rebind Mod to the Super key { modMask = mod4Mask -- Rebind Mod to the Super key
, layoutHook = myLayout -- Use custom layouts , layoutHook = myLayout -- Use custom layouts
, terminal = "alacritty" , terminal = "alacritty"
, focusedBorderColor = "#000000"
, manageHook = myManageHook -- Match on certain windows , manageHook = myManageHook -- Match on certain windows
, startupHook = do , startupHook = do
-- other startup commands -- other startup commands
@ -56,6 +54,8 @@ myConfig = def
spawnOnce "xrdb /home/hashirama/.Xresources" spawnOnce "xrdb /home/hashirama/.Xresources"
spawnOnce "feh --bg-fill /home/hashirama/wallpaper.jpg" spawnOnce "feh --bg-fill /home/hashirama/wallpaper.jpg"
spawnOnce "compton -b" spawnOnce "compton -b"
spawnOnce "polybar top-monitor-1"
} }
`additionalKeysP` `additionalKeysP`
[ ("M-d", spawn "rofi -show run") [ ("M-d", spawn "rofi -show run")
@ -65,6 +65,7 @@ myConfig = def
, ("M-p", runOrRaise "nyxt" (className =? "Nyxt")) , ("M-p", runOrRaise "nyxt" (className =? "Nyxt"))
, ("M-t", withFocused $ windows . W.sink) -- Toggle float for the focused window , ("M-t", withFocused $ windows . W.sink) -- Toggle float for the focused window
, ("M-S-q", return ()) -- Unbind Mod + Shift + Q, to avoid quiting the wm. , ("M-S-q", return ()) -- Unbind Mod + Shift + Q, to avoid quiting the wm.
, ("M-q", kill) -- Change the keybinding for closing windows to Mod + Q
] ]
@ -77,10 +78,12 @@ myManageHook = composeAll
myTheme :: Theme myTheme :: Theme
myTheme = def myTheme = def
{ decoHeight = 20 -- Adjust the height of the title bar as needed { decoHeight = 20
-- Add other theme properties as needed -- Add other theme properties as needed
} }
myLayout = mouseResize $ spacingRaw True (Border 10 10 10 10) True (Border 10 10 10 10) True $ myLayout = mouseResize $ spacingRaw True (Border 10 10 10 10) True (Border 10 10 10 10) True $
Tall 1 (3/100) (1/2) ||| Full Tall 1 (3/100) (1/2) ||| Full
@ -89,7 +92,7 @@ myLayout = mouseResize $ spacingRaw True (Border 10 10 10 10) True (Border 10 10
myXmobarPP :: PP myXmobarPP :: PP
myXmobarPP = def myXmobarPP = def
{ ppSep = magenta "" { ppSep = cyan ""
, ppTitleSanitize = xmobarStrip , ppTitleSanitize = xmobarStrip
, ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2 , ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2
, ppHidden = white . wrap " " "" , ppHidden = white . wrap " " ""
@ -99,18 +102,19 @@ myXmobarPP = def
, ppExtras = [logTitles formatFocused formatUnfocused] , ppExtras = [logTitles formatFocused formatUnfocused]
} }
where where
formatFocused = wrap (white "[") (white "]") . magenta . ppWindow formatFocused = wrap (white "[") (white "]") . cyan . ppWindow
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue . ppWindow formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . vividGreen . ppWindow
-- | Windows should have *some* title, which should not not exceed a -- | Windows should have *some* title, which should 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
blue, lowWhite, magenta, red, white, yellow :: String -> String cyan, vividGreen, lowWhite, red, white, yellow :: String -> String
magenta = xmobarColor "#ff79c6" "" cyan = xmobarColor "#8be9fd" ""
blue = xmobarColor "#bd93f9" "" vividGreen = xmobarColor "#50fa7b" ""
white = xmobarColor "#f8f8f2" "" white = xmobarColor "#f8f8f2" ""
yellow = xmobarColor "#f1fa8c" "" yellow = xmobarColor "#f1fa8c" ""
red = xmobarColor "#ff5555" "" red = xmobarColor "#ff5555" ""
lowWhite = xmobarColor "#bbbbbb" "" lowWhite = xmobarColor "#bbbbbb" ""