From f63b278aeff23fd0db1840cdcdf6b8599146e05e Mon Sep 17 00:00:00 2001 From: Ryan Kes Date: Sun, 8 Mar 2020 14:50:56 +0100 Subject: [PATCH] Added docker count to Polybar --- polybar/.config/polybar/config | 10 ++++++++-- polybar/.local/bin/dockerstatus | 9 +++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100755 polybar/.local/bin/dockerstatus diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index a86ec7b..4628cce 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -48,7 +48,7 @@ monitor = ${env:MONITOR:eDP1} modules-left = bspwm modules-center = battery0 battery1 wlan bluetooth -modules-right = updates-arch-combined xbacklight volume memory cpu temperature filesystem mail rss github date +modules-right = updates-arch-combined xbacklight volume memory cpu temperature filesystem docker mail rss github date tray-position = right @@ -58,7 +58,7 @@ monitor = ${env:MONITOR:DP-1} modules-left = bspwm modules-center = player-mpris-tail -modules-right = eth bluetooth updates-arch-combined volume memory cpu temperature filesystem mail rss github date +modules-right = eth bluetooth updates-arch-combined volume memory cpu temperature filesystem docker mail rss github date tray-position = right @@ -414,6 +414,12 @@ exec = /bin/sh ~/.local/bin/mailcount click-left = alacritty -e neomutt click-middle = mailsync & +[module/docker] +type = custom/script +exec = dockerstatus +interval = 1 +label =  %output% + [settings] screenchange-reload = true ;compositing-background = xor diff --git a/polybar/.local/bin/dockerstatus b/polybar/.local/bin/dockerstatus new file mode 100755 index 0000000..0cc1bd0 --- /dev/null +++ b/polybar/.local/bin/dockerstatus @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +count=$(docker ps -q | wc -l) + +if [ ! "$count" -eq 0 ]; then + echo "$count" +else + echo "" +fi