Add xmonad and xmobar config

This commit is contained in:
daniele 2024-03-23 12:01:35 +01:00
parent 2b6d0e2abd
commit d31c0e1b35
Signed by: fuxino
GPG Key ID: 981A2B2A3BBF5514
2 changed files with 146 additions and 0 deletions

56
.config/xmobar/xmobarrc Normal file
View File

@ -0,0 +1,56 @@
Config { overrideRedirect = False
, font = "Bitstream Vera Sans Mono Bold 9"
, bgColor = "black"
, fgColor = "#646464"
, position = Top
, border = BottomB
, borderColor = "#646464"
, allDesktops = True
, pickBroadest = True
, commands = [ Run Weather "LZIB"
[ "--template", "<weather> <tempC>°C"
, "-L", "0"
, "-H", "25"
, "--low" , "lightblue"
, "--normal" , "#f8f8f2"
, "--high" , "red"
] 9000
, Run MultiCpu
[ "--template" , "Cpu: <total0>%|<total1>%|<total2>%|<total3>%|<total4>%|<total5>%"
, "--Low" , "25"
, "--High" , "75"
, "--low" , "darkgreen"
, "--normal" , "darkorange"
, "--high" , "darkred"
] 10
, Run CoreTemp
[ "--template" , "Temp: <core0>°C|<core1>°C|<core2>°C|<core3>°C|<core4>°C|<core5>°C"
, "--Low" , "60"
, "--High" , "85"
, "--low" , "darkgreen"
, "--normal" , "darkorange"
, "--high" , "darkred"
] 50
, Run Memory
[ "--template" , "Mem: <usedratio>%"
, "--Low" , "20"
, "--High" , "80"
, "--low" , "darkgreen"
, "--normal" , "darkorange"
, "--high" , "darkred"
] 10
, Run Kbd
[ ("it" , "<fc=#00008B>IT</fc>")
, ("us" , "<fc=#8B0000>US</fc>")
, ("sk(qwerty)" , "<fc=#008B00>SK</fc>")
]
, Run Date "%a %Y-%m-%d <fc=#8be9fd>%H:%M</fc>" "date" 10
, Run Uptime
[ "--template" , "Uptime: <days>d <hours>h <minutes>m"
] 600
, Run XMonadLog
]
, sepChar = "%"
, alignSep = "}{"
, template = "%XMonadLog% } %uptime% {%multicpu% | %coretemp% | %memory% | %kbd% | %LZIB% | %date% "
}

90
.config/xmonad/xmonad.hs Normal file
View File

@ -0,0 +1,90 @@
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Layout.Magnifier
import XMonad.Layout.Renamed
import XMonad.Layout.ThreeColumns
import XMonad.Util.EZConfig
import XMonad.Util.Loggers
import XMonad.Util.SpawnOnce
main :: IO ()
main = xmonad
. ewmhFullscreen
. ewmh
. withEasySB (xmobar1 <> xmobar2) defToggleStrutsKey
$ myConfig
myConfig = def
{ modMask = mod4Mask
, terminal = "kitty"
, focusedBorderColor = "#000000"
, normalBorderColor = "#ffffff"
, layoutHook = myLayout
, startupHook = myStartupHook
, manageHook = myManageHook
}
`additionalKeysP`
[ ("M-S-l" , spawn "xscreensaver-command -lock" )
, ("M-v" , spawn "vivaldi" )
, ("M-<Print>" , unGrab *> spawn "gnome-screenshot -i" )
]
myLayout = tiled ||| Mirror tiled ||| Full ||| threeCol
where
threeCol
= renamed [Replace "ThreeCol"]
$ magnifiercz' 1.3
$ ThreeColMid nmaster delta ratio
tiled = Tall nmaster delta ratio
nmaster = 1
ratio = 1/2
delta = 3/100
xmobar1 = statusBarProp "xmobar -x 0 ~/.config/xmobar/xmobarrc" (pure myXmobarPP)
xmobar2 = statusBarProp "xmobar -x 1 ~/.config/xmobar/xmobarrc" (pure myXmobarPP)
myXmobarPP :: PP
myXmobarPP = def
{ ppSep = darkgreen ""
, ppTitleSanitize = xmobarStrip
, ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 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 "]") . darkgreen . ppWindow
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . white . ppWindow
ppWindow :: String -> String
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
blue, lowWhite, darkgreen, red, white, yellow :: String -> String
darkgreen = xmobarColor "#013220" ""
blue = xmobarColor "#bd93f9" ""
white = xmobarColor "#f8f8f2" ""
yellow = xmobarColor "#f1fa8c" ""
red = xmobarColor "#ff5555" ""
lowWhite = xmobarColor "#bbbbbb" ""
myStartupHook :: X ()
myStartupHook = do
spawnOnce "xsetroot -cursor_name left_ptr"
spawnOnce "mons -e left"
spawnOnce "xscreensaver -no-splash"
spawnOnce "redshift"
spawnOnce "dunst"
spawnOnce "~/.fehbg"
myManageHook :: ManageHook
myManageHook = composeAll
[ className =? "mpv" --> doFullFloat
, isDialog --> doFloat
]