update
This commit is contained in:
40
dotconfig/polybar/start.sh
Executable file
40
dotconfig/polybar/start.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
killall -q polybar
|
||||
|
||||
while pgrep -x polybar >/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
hw=""
|
||||
for h in /sys/class/hwmon/hwmon*; do
|
||||
if grep -qx 'thinkpad' "$h/name"; then
|
||||
hw=${h##*/hwmon}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ -n "$hw" ] || {
|
||||
echo "Capteur thinkpad introuvable" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
polybar_dir="/home/alice/.config/polybar"
|
||||
|
||||
tmpconf="$polybar_dir/config.ini"
|
||||
sed "s/@HW@/$hw/g" $polybar_dir/config.ini.model > "$tmpconf"
|
||||
|
||||
primary=$(xrandr --query | grep " primary" | cut -d" " -f1)
|
||||
|
||||
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
|
||||
MONITOR="$m" HW="$hw" polybar top &
|
||||
sleep 0.1
|
||||
MONITOR="$m" HW="$hw" polybar middle &
|
||||
sleep 0.1
|
||||
MONITOR="$m" HW="$hw" polybar bottom &
|
||||
if [ "$m" = "$primary" ]; then
|
||||
MONITOR="$m" HW="$hw" polybar tray-bottom &
|
||||
else
|
||||
MONITOR="$m" HW="$hw" polybar bottom-b &
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user