"Dynamic" interface name handling

This commit is contained in:
Geoffrey Frogeye 2017-07-10 06:53:24 +02:00
parent 694e8bffe3
commit 58f00b76d8
4 changed files with 8 additions and 27 deletions

View file

@ -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

View file

@ -214,7 +214,7 @@ label =  %gb_free%
[module/eth] [module/eth]
type = internal/network type = internal/network
interface = eth0 interface = ${env:ethI:eth0}
interval = 1 interval = 1
format-connected =  <label-connected> format-connected =  <label-connected>
@ -229,7 +229,7 @@ label-connected = ↑%upspeed% ↓%downspeed%
[module/wlan] [module/wlan]
type = internal/network type = internal/network
interface = wlan0 interface = ${env:wlanI:wlan0}
interval = 1 interval = 1
format-connected = <ramp-signal> <label-connected> format-connected = <ramp-signal> <label-connected>

View file

@ -6,8 +6,12 @@ killall -q polybar
# Wait until the processes have been shut down # Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done 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) 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 polybar -m | cut -d':' -f1 | while read display
do do
export display=$display export display=$display

View file

@ -180,7 +180,7 @@ else
fi fi
if [[ $ARCH == 1 && $ADMIN == 1 ]]; then if [[ $ARCH == 1 && $ADMIN == 1 ]]; then
inst pkgfile inst pkgfile
systemctl enable pkgfile-update.timer sudo systemctl enable pkgfile-update.timer
fi fi
# Dev # Dev