From 58f00b76d841cda483183986642545bee814c90e Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Mon, 10 Jul 2017 06:53:24 +0200 Subject: [PATCH] "Dynamic" interface name handling --- config/polybar/: | 23 ----------------------- config/polybar/config | 4 ++-- config/polybar/launch.sh | 6 +++++- scripts/install-prefs | 2 +- 4 files changed, 8 insertions(+), 27 deletions(-) delete mode 100644 config/polybar/: diff --git a/config/polybar/: b/config/polybar/: deleted file mode 100644 index a2e6a43..0000000 --- a/config/polybar/: +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -# Terminate already running bar instances -killall -q polybar - -# Wait until the processes have been shut down -while pgrep -x polybar >/dev/null; do sleep 1; done - -function sth() { - echo sth -} - -trap SIGCONT sth - -# Launch bar for each display -polybar -m | cut -d':' -f1 | while read display -do - MONITOR=$display polybar example & -done - -echo "Bars launched..." - -wait diff --git a/config/polybar/config b/config/polybar/config index 27502f1..6758e66 100644 --- a/config/polybar/config +++ b/config/polybar/config @@ -214,7 +214,7 @@ label =  %gb_free% [module/eth] type = internal/network -interface = eth0 +interface = ${env:ethI:eth0} interval = 1 format-connected =  @@ -229,7 +229,7 @@ label-connected = ↑%upspeed% ↓%downspeed% [module/wlan] type = internal/network -interface = wlan0 +interface = ${env:wlanI:wlan0} interval = 1 format-connected =  diff --git a/config/polybar/launch.sh b/config/polybar/launch.sh index 5ef7a96..b124ad1 100755 --- a/config/polybar/launch.sh +++ b/config/polybar/launch.sh @@ -6,8 +6,12 @@ killall -q polybar # Wait until the processes have been shut down while pgrep -x polybar >/dev/null; do sleep 1; done -# Launch bar for each display +# Getting some vars primary=$(xrandr | grep primary | head -1 | cut -d' ' -f1) +export ethI=$(/bin/ls /sys/class/net/ | grep ^enp* | head -1) +export wlanI=$(/bin/ls /sys/class/net/ | grep ^wl* | head -1) + +# Launch bar for each display polybar -m | cut -d':' -f1 | while read display do export display=$display diff --git a/scripts/install-prefs b/scripts/install-prefs index f1d8f79..160d2bf 100755 --- a/scripts/install-prefs +++ b/scripts/install-prefs @@ -180,7 +180,7 @@ else fi if [[ $ARCH == 1 && $ADMIN == 1 ]]; then inst pkgfile - systemctl enable pkgfile-update.timer + sudo systemctl enable pkgfile-update.timer fi # Dev