summaryrefslogtreecommitdiff
path: root/polybar/launch.sh
diff options
context:
space:
mode:
authorilotterytea <ilotterytea@proton.me>2024-05-26 20:10:26 +0500
committerilotterytea <ilotterytea@proton.me>2024-05-26 20:10:26 +0500
commit036c889c4a4f7f59d1e1a592586b54c5c5e93005 (patch)
treeaa76d678790abc79f24edf83c17a564eb2c6f65d /polybar/launch.sh
initial commitHEADmaster
Diffstat (limited to 'polybar/launch.sh')
-rwxr-xr-xpolybar/launch.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/polybar/launch.sh b/polybar/launch.sh
new file mode 100755
index 0000000..38cf198
--- /dev/null
+++ b/polybar/launch.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+## Add this to your wm startup file.
+
+# Terminate already running bar instances
+killall -q polybar
+
+# Wait until the processes have been shut down
+while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
+
+# Get network Interface
+export DEFAULT_NETWORK_INTERFACE=$(ip route | grep '^default' | awk '{print $5}' | head -n1)
+
+# Load on second monitor if connected
+external_monitor=$(xrandr --query | grep 'DP-1')
+if [[ $external_monitor = DP-1\ connected* ]]; then
+ polybar -c ~/.config/polybar/config.ini secondary &
+fi
+
+## Load bar on primary monitor
+polybar -c ~/.config/polybar/config.ini main &
+