pinwheel: Add container-status icon in waybar

This commit is contained in:
Alexander Heldt
2023-10-26 10:31:05 +02:00
parent 95545e4182
commit f40d0951ad

View File

@@ -94,6 +94,13 @@ let
bluetoothctl power off >> /dev/null bluetoothctl power off >> /dev/null
fi fi
''; '';
container-status = pkgs.writeShellScript "container-status" ''
RUNNING=$(docker ps -q | wc -l)
if [ "$RUNNING" -gt 0 ]; then
echo "{ \"text\": \"\", \"tooltip\": \"containers running: $RUNNING\", \"class\": \"running\" }"
fi
'';
in in
{ {
home-manager.users.alex = { home-manager.users.alex = {
@@ -114,6 +121,7 @@ in
modules-right = [ modules-right = [
"custom/work-vpn-status" "custom/work-vpn-status"
"custom/spotify" "custom/spotify"
"custom/container-status"
"custom/dunst" "custom/dunst"
"custom/mullvad" "custom/mullvad"
"bluetooth" "bluetooth"
@@ -135,6 +143,12 @@ in
tooltip = false; tooltip = false;
}; };
"custom/container-status" = {
exec = "${container-status}";
return-type = "json";
interval = 1;
};
"custom/dunst" = { "custom/dunst" = {
exec = notifications-status; exec = notifications-status;
on-click-right = "${pkgs.dunst}/bin/dunstctl set-paused toggle"; on-click-right = "${pkgs.dunst}/bin/dunstctl set-paused toggle";
@@ -258,6 +272,11 @@ in
color: #${config.lib.colors.warning}; color: #${config.lib.colors.warning};
} }
#custom-container-status.running {
color: #${config.lib.colors.warning};
font-size: 30px;
}
#clock { #clock {
margin-right: 10px; margin-right: 10px;
} }