From 5371db3a704142baf2cc82fb96e2fb94537fc243 Mon Sep 17 00:00:00 2001 From: listout Date: Fri, 5 Aug 2022 00:38:09 +0530 Subject: polybar/launch.sh: launch the bars conditionally Signed-off-by: listout --- .config/polybar/launch.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to '.config/polybar/launch.sh') diff --git a/.config/polybar/launch.sh b/.config/polybar/launch.sh index 60fbe39..2f797e1 100755 --- a/.config/polybar/launch.sh +++ b/.config/polybar/launch.sh @@ -1,14 +1,31 @@ #!/usr/bin/env bash +# AMD specific system temperature for i in /sys/class/hwmon/hwmon*/temp*_input; do if [ "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*}))" = "k10temp: Tctl" ]; then export HWMON_PATH="$i" fi done + +# Get wireless interface export DEFAULT_NETWORK_INTERFACE=$(ip route | grep '^default' | awk '{print $5}' | head -n1) + +# Kill all instances of polybar killall -q polybar -echo "---" | tee -a /tmp/polybar1.log -polybar mybar 2>&1 | tee -a /tmp/polybar1.log & disown -polybar mybar_external 2>&1 | tee -a /tmp/polybar_ext.log & disown -echo "Bar launched" +log_file=/tmp/.polybar.err + +#Launch Polybar on every monitor, using default config location ~/.config/polybar/config +for m in $(polybar --list-monitors | cut -d":" -f1); do + # put a different bar on the laptop monitor (because it has a higher resolution) + if [ "$m" = "eDP" ] || [ "$m" = "eDP-1" ]; then + bar_type="laptop" + else + bar_type="external" + fi + MONITOR=$m polybar -r $bar_type 2>&1 | tee -a /tmp/.polybar.$m.err & disown +done + +#polybar mybar 2>&1 | tee -a /tmp/polybar1.log & disown +#polybar mybar_external 2>&1 | tee -a /tmp/polybar_ext.log & disown +#echo "Bar launched" -- cgit v1.2.3