From 20dc0bbfd4f58a0dc00bf41c7285cb7465118806 Mon Sep 17 00:00:00 2001 From: zachir Date: Sun, 26 Feb 2023 15:24:39 -0600 Subject: fix for hyprland --- gen_waybar_confs.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gen_waybar_confs.sh') diff --git a/gen_waybar_confs.sh b/gen_waybar_confs.sh index 36befae..b13d8d7 100755 --- a/gen_waybar_confs.sh +++ b/gen_waybar_confs.sh @@ -2,9 +2,17 @@ WCLONG="$(crcparse WC)" WC="$(basename "$WCLONG")" +CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}" +if [ ! -f "$CONFIG/waybar/config-$WC" ]; then + printf "$CONFIG/waybar/config-$WC waybar config does not exist!\n" + exit 1 +fi -OUTPUTS="$(wlr-randr | grep -B2 'Enabled: yes' | sed '/^\s\s*/d;/^--/d' | cut -d' ' -f1)" +OUTPUTS="$(wlr-randr | grep -B5 'Enabled: yes' | sed '/^\s\s*/d;/^--/d' | cut -d' ' -f1)" + +[ -n "$OUTPUTS" -a -z "$(find "$CONFIG"/waybar -name "config-$WC-*")" ] && \ + rm -rf "$CONFIG/waybar/config-$WC-*" echo "$OUTPUTS" | while read i; do - sed 's/%%DISPLAY%%/'$i'/' "$XDG_CONFIG_HOME"/waybar/config-$WC > "$XDG_CONFIG_HOME"/waybar/config-$WC-$i + sed 's/%%DISPLAY%%/'$i'/' "$CONFIG"/waybar/config-$WC > "$CONFIG"/waybar/config-$WC-$i done -- cgit v1.2.3