dotfiles/bin/rice-bar
Sarthak 7f41cf7a82 replace the old dotfiles with the sakura line rice
The bare $HOME repo is gone. This is now the rice: install.sh, rice-*
scripts in bin/, configs in home/ linked into $HOME, theme templates, st
and the particle wallpaper. Clone to ~/rice and run install.sh.
2026-09-14 19:44:44 +05:30

21 lines
655 B
Bash
Executable file

#!/usr/bin/env bash
# rice-bar - polybar on every connected monitor.
#
# rice-bar start (re)launch the bar
# rice-bar toggle hide or show it without restarting
set -uo pipefail
start() {
pkill -u "$UID" -x polybar
while pgrep -u "$UID" -x polybar >/dev/null; do sleep 0.1; done
local m
for m in $(xrandr --query | awk '/ connected/ {print $1}'); do
MONITOR="$m" setsid -f polybar --reload top >/dev/null 2>&1
done
}
case "${1:-start}" in
start) start ;;
toggle) if pgrep -u "$UID" -x polybar >/dev/null; then polybar-msg cmd toggle >/dev/null; else start; fi ;;
*) echo "usage: rice-bar start|toggle" >&2; exit 2 ;;
esac