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

@ -9,9 +9,9 @@ in {
fonts = {
fonts = with pkgs.unstable; [
corefonts # Microsoft free fonts
meslo-lgs-nf
(nerdfonts.override { fonts = [ "Meslo" ]; })
];
fontconfig.defaultFonts = { monospace = [ "MesloLGS NF" ]; };
fontconfig.defaultFonts = { monospace = [ "MesloLGS Nerd Font Mono" ]; };
};
programs.adb.enable = true;
@ -43,20 +43,7 @@ in {
enableSshSupport = false;
pinentryFlavor = "gtk2";
};
stalonetray = {
enable = true;
config = {
geometry = "1x1-5+0";
background = "#000000";
transparent = true;
grow_gravity = "E";
icon_gravity = "E";
icon_size = "24";
kludges = "force_icons_size";
};
};
unclutter.enable = true;
pasystray.enable = true;
screen-locker = {
enable = false;
inactiveInterval = 5;
@ -128,7 +115,6 @@ in {
file = {
".wallpaper.png".source = ./files/wallpaper.png;
".xmonad/xmobarrc".source = ./files/xmobarrc;
".config/ncmpcpp" = {
source = ./files/ncmpcpp;
recursive = true;
@ -163,7 +149,6 @@ in {
(ncmpcpp.override { visualizerSupport = true; })
mpc_cli
pulsemixer
# Ranger preview utils
w3m

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

View file

@ -17,7 +17,7 @@ in {
displayManager.lightdm = {
enable = true;
background = ./files/wallpaper.png;
greeters.mini.enable = true;
#greeters.mini.enable = true;
};
};
@ -29,8 +29,234 @@ in {
config = ./files/xmonad.hs;
};
};
services.polybar = {
enable = true;
package = pkgs.polybar.override {
pulseSupport = true;
mpdSupport = true;
};
script = ''
export MONITOR=$(polybar -m|tail -1|sed -e 's/:.*$//g')
polybar main &
'';
settings = {
"colors" = {
bg = "#282828";
bg-alt = "#3c3836";
bg-darker = "#1d2021";
fg = "#fbf1c7";
fg-alt = "#928374";
blue = "#83a598";
cyan = "#8ec07c";
green = "#b8bb26";
orange = "#fe8019";
purple = "#d3869b";
red = "#fb4934";
yellow = "#fabd2f";
bg-blue = "#458588";
bg-cyan = "#689d6a";
bg-green = "#98971a";
bg-orange = "#d65d0e";
bg-purple = "#b16268";
bg-red = "#cc241d";
bg-yellow = "#d79921";
black = "#000";
white = "#FFF";
trans = "#00000000";
semi-trans = "#ee282828";
semi-trans-black = "#aa000000";
accent = "#83a598";
};
"global/wm" = {
margin-top = 0;
margin-bottom = 34;
};
"bar/main" = {
monitor = "\${env:MONITOR}";
background = "\${colors.bg}";
foreground = "\${colors.fg}";
enable-ipc = true;
width = "100%";
height = "34";
offset-x = 0;
offset-y = 0;
bottom = true;
padding-left = 2;
padding-right = 2;
font-0 = "MesloLGS Nerd Font Mono:pixelsize=12;2";
font-1 = "MesloLGS Nerd Font Mono:pixelsize=20;5";
modules-left = "pulseaudio pad cpu memory pad fs pad xwindow";
modules-center = "ewmh";
modules-right = "mpd pad battery pad date";
tray-position = "right";
tray-offset-y = 2;
};
"module/ewmh" = {
type = "internal/xworkspaces";
pin-workspaces = false;
enable-click = false;
enable-scroll = false;
label-active = "%name%";
label-active-background = "\${colors.bg-alt}";
label-active-foreground = "\${colors.fg}";
label-active-padding = 1;
label-occupied = "%name%";
label-occupied-foreground = "\${colors.accent}";
label-occupied-padding = 1;
label-urgent-foreground = "\${colors.red}";
label-urgent-padding = 1;
label-empty = "%name%";
label-empty-foreground = "\${colors.fg-alt}";
label-empty-padding = 1;
};
"module/date" = {
type = "internal/date";
interval = 5;
label = "%date% %time%";
date = "%A, %d %h";
date-alt = "%d/%m/%Y";
time = "%H:%M";
time-alt = "%H:%M";
format-foreground = "\${colors.accent}";
format-prefix = "";
format-prefix-font = 2;
format-prefix-padding = 1;
format-prefix-foreground = "\${colors.accent}";
};
"module/xwindow" = {
type = "internal/xwindow";
label = "%title:0:80:...%";
label-padding-left = 2;
};
"module/pad" = {
type = "custom/text";
content = " ";
};
"module/fs" = {
type = "internal/fs";
mount-0 = "/";
interval = 30;
format-mounted = "<bar-used>";
format-mounted-prefix = "󰋊 ";
format-mounted-prefix-font = 2;
format-mounted-foreground = "\${colors.accent}";
format-unmounted = "";
label-unmounted = "";
label-unmounted-foreground = "\${colors.fg-alt}";
bar-used-indicator = "";
bar-used-width = 8;
bar-used-foreground-0 = "\${colors.fg}";
bar-used-foreground-1 = "\${colors.fg}";
bar-used-foreground-2 = "\${colors.yellow}";
bar-used-foreground-3 = "\${colors.red}";
bar-used-foreground-4 = "\${colors.red}";
bar-used-fill = "|";
bar-used-empty = "¦";
bar-used-empty-foreground = "\${colors.fg-alt}";
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format = "<bar-load>";
format-prefix = " ";
format-prefix-font = 2;
format-foreground = "\${colors.accent}";
format-padding = 1;
bar-load-indicator = "";
bar-load-width = 8;
bar-load-foreground-0 = "\${colors.fg}";
bar-load-foreground-1 = "\${colors.fg}";
bar-load-foreground-2 = "\${colors.yellow}";
bar-load-foreground-3 = "\${colors.red}";
bar-load-foreground-4 = "\${colors.red}";
bar-load-fill = "|";
bar-load-empty = "¦";
bar-load-empty-foreground = "\${colors.fg-alt}";
};
"module/memory" = {
type = "internal/memory";
interval = 3;
format = "<bar-used>";
format-prefix = " ";
format-prefix-font = 2;
format-prefix-foreground = "\${colors.accent}";
format-padding-left = 1;
bar-used-indicator = "";
bar-used-width = 8;
bar-used-foreground-0 = "\${colors.fg}";
bar-used-foreground-1 = "\${colors.fg}";
bar-used-foreground-2 = "\${colors.yellow}";
bar-used-foreground-3 = "\${colors.red}";
bar-used-foreground-4 = "\${colors.red}";
bar-used-fill = "|";
bar-used-empty = "¦";
bar-used-empty-foreground = "\${colors.fg-alt}";
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
format-volume = "<ramp-volume> <bar-volume>";
label-volume-foreground = "\${colors.accent}";
label-muted = "󰖁";
label-muted-font = 2;
format-muted-foreground = "\${colors.red}";
format-muted = "<label-muted>";
bar-volume-width = 8;
bar-volume-gradient = false;
bar-volume-indicator = "|";
bar-volume-indicator-foreground = "#ff";
bar-volume-fill = "";
bar-volume-empty = "";
bar-volume-empty-foreground = "\${colors.fg-alt}";
ramp-volume-0 = "󰕿";
ramp-volume-1 = "󰖀";
ramp-volume-2 = "󰕾";
ramp-volume-font = 2;
};
"module/mpd" = {
type = "internal/mpd";
host = "127.0.0.1";
port = "6600";
label-song = "%artist% - %title%";
format-playing-prefix = "󰎈 ";
format-playing-prefix-font = 2;
format-playing-foreground = "\${colors.fg}";
format-paused-prefix = "󰎊 ";
format-paused-prefix-font = 2;
format-paused-foreground = "\${colors.fg-alt}";
};
};
};
home.packages = with pkgs.unstable; [
haskellPackages.xmobar
i3lock
feh