Files
2022-03-09 11:41:22 +01:00

35 lines
740 B
Bash
Executable File

#!/bin/bash
polybar_auto_hide_timer_name=polybar_auto_hide.timer
function auto_hide_polybar() {
if [[ $1 == "true" ]]; then
systemd-run --user --on-calendar="*:0/1" --unit=$polybar_auto_hide_timer_name /usr/bin/polybar-msg cmd hide || true
else
systemctl --user stop $polybar_auto_hide_timer_name || true
fi
}
current_profile=$(autorandr | grep '1st match' | awk '{print $1;}')
echo "Switching to $current_profile"
if [[ "$current_profile" == *'oled'* ]]; then
echo "OLED Display detected"
# setup screen saver
xset s noblank
xset s 300
xset -dpms
#xset s on
# add timer to auto hide polybar
auto_hide_polybar "true"
else
# remote auto hide of polybar timer
auto_hide_polybar "false"
fi
echo "Done!"