Use polybar instead of xmobar

This commit is contained in:
Paul-Henri Froidmont 2023-03-21 23:02:30 +01:00
parent 962df55b7d
commit 76cf66f3a3
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
8 changed files with 243 additions and 129 deletions

View file

@ -1,20 +0,0 @@
#! /usr/bin/env bash
#
# Writes the title and artist of the song currently being played by MPD or MOC to STDOUT, formatted for xmobar
# If MPD is playing a song or is paused, its information will be written. If not, MOC will be checked similarly.
# If neither are playing a song or are paused, nothing will be written.
# Note: if MPD isn't playing some errors will be written to STDERR; don't worry - xmobar only looks at STDOUT
TCOL="cyan" # The colour to be used to draw the song title when playing
ACOL="lightblue" # The colour to be used to draw the song artist when playing
PCOL="#928374" # The colour to be used to draw both the song title and artist when paused
MPDSTATE=$(mpc | sed -e '2 !d' -e 's/^.*\[//' -e 's/\].*$//')
if [ $MPDSTATE == "playing" ]; then
# MPD is playing
echo "<fc=$ACOL>$(mpc current | sed "s/ - /\<\/fc\> - \<fc=$TCOL>/")</fc>"
elif [ $MPDSTATE == "paused" ]; then
# MPD is paused
echo "<fc=$PCOL>$(mpc current)</fc>"
fi

View file

@ -1,73 +0,0 @@
Config {
font = "monospace Bold 12"
additionalFonts= ["monospace Normal 14"]
, bgColor = "#282828"
, fgColor = "#ebdbb2"
, position = TopSize L 94 24
, alpha = 150
, commands = [ Run Cpu [ "-t", "<fn=1><fc=#83a598>\xe266</fc></fn> <total>%"
, "-L", "3","-H","50"
, "-l", "#ebdbb2"
, "-n", "#ebdbb2"
, "-h", "#fb4934"
, "-p", "2"
, "-c", "0"
] 10
, Run Memory [ "-t", "<fn=1><fc=#458588>\xf85a</fc></fn> <usedratio>%"
, "-H", "80"
, "-L", "10"
, "-l" ,"#ebdbb2"
, "-n", "#ebdbb2"
, "-h", "#fb4934"
, "-p", "2"
, "-c", "0"
] 10
, Run Date "%a %b %_d %k:%M"
"date"
10
, Run DynNetwork [ "-t", "<fn=1><fc=#8ec07c>\xf6d9</fc></fn> <rx> <fn=1><fc=#d3869b>\xfa51</fc></fn> <tx>"
, "-H", "200"
, "-L", "10"
, "-h", "#ebdbb2"
, "-l", "#ebdbb2"
, "-n", "#ebdbb2"
, "-S", "True"
, "-p", "3"
, "-c", "0"
] 10
, Run CoreTemp [ "-t", "<fn=1><fc=#fabd2f>\xf2c8</fc></fn> <core0>°"
, "-L", "30"
, "-H", "75"
, "-l", "lightblue"
, "-n", "#ebdbb2"
, "-h", "#aa4450"
, "-p", "2"
, "-c", "0"
] 50
, Run Com ".xmonad/scripts/mpd_status.sh"
[]
"mpdstatus"
10
--, Run Com "network-check.sh" [] "netcheck" 5
, Run BatteryP [ "BAT0" ]
[ "--template" , "<fn=1><fc=#b8bb26>\xf240</fc></fn> <acstatus>"
, "--Low" , "10" -- units: %
, "--High" , "80" -- units: %
, "--low" , "#fb4934" -- #ff5555
, "--normal" , "#ebdbb2"
, "--high" , "#98be65"
, "--" -- battery specific options
-- discharging status
, "-o" , "<left>% (<timeleft>)"
-- AC "on" status
, "-O" , "<left>% (<fc=#98be65>Charging</fc>)" -- 50fa7b
-- charged status
, "-i" , "<fc=#98be65>Charged</fc>"
] 50
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{%dynnetwork% %mpdstatus% %cpu% %coretemp% %memory% %battery% <fc=#fabd2f>%date%</fc> " -- #69DFFA
}

View file

@ -54,10 +54,9 @@ myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
main = do
xmproc <- spawnPipe "xmobar .xmonad/xmobarrc"
xmonad $ ewmh . docks $ myConfig xmproc
xmonad $ ewmh . docks $ myConfig
myConfig xmproc = azertyConfig {
myConfig = azertyConfig {
terminal = myTerminal,
focusFollowsMouse = True,
borderWidth = 1,
@ -68,19 +67,11 @@ myConfig xmproc = azertyConfig {
layoutHook = myLayout,
manageHook = manageDocks <+> (isFullscreen --> doFullFloat) <+> manageHook def,
--handleEventHook = myEventHook <+> handleEventHook def,
logHook = (myLogHook xmproc) <+> logHook def,
logHook = logHook def,
--keys = \c -> mkKeymap c myAdditionalKeys,
startupHook = myStartupHook xmproc
startupHook = myStartupHook
} `removeKeysP` myRemoveKeys `additionalKeysP` myAdditionalKeys
myLogHook xmproc = dynamicLogWithPP xmobarPP {
ppOutput = hPutStrLn xmproc,
ppCurrent = xmobarColor "#83a598" "" . wrap "[" "]", -- #9BC1B2 #69DFFA
ppTitle = xmobarColor "#d3869b" "" . shorten 100, -- #9BC1B2 #69DFFA
ppSort = fmap (. filterOutWs [scratchpadWorkspaceTag]) getSortByTag
--ppLayout = xmobarColor "#fabd2f" "" . myIcons
} >> updatePointer (0.75, 0.75) (0.75, 0.75)
myRemoveKeys = [
]
@ -134,7 +125,7 @@ myLayout = smartSpacing 5
$ avoidStruts
$ layoutHook def
myStartupHook xmproc = do
myStartupHook = do
setWMName "LG3D"
spawn "feh --no-fehbg --bg-fill ~/.wallpaper.png"
return () >> checkKeymap (myConfig xmproc) myAdditionalKeys
return () >> checkKeymap myConfig myAdditionalKeys