1
0
Fork 0

hlwm: update ac and player bar

This commit is contained in:
Vladimír Dudr 2025-01-02 08:48:40 +01:00
parent 1e91c000f1
commit 41afc65826
2 changed files with 16 additions and 24 deletions

View file

@ -13,6 +13,7 @@ hc emit_hook reload
### disable touchpad, cuz trackpoint rulezzzz
xinput --disable 'SynPS/2 Synaptics TouchPad'
xinput --disable 'SYNA88022:00 06CB:CE67 Touchpad'
xsetroot -solid "${colors[dark0_hard]}"
@ -137,6 +138,9 @@ hc keybind XF86AudioNext spawn systemd-run --scope --user "$HOME/bin/mprisctl" n
hc keybind XF86AudioPrev spawn systemd-run --scope --user "$HOME/bin/mprisctl" prev
hc keybind XF86AudioPlay spawn systemd-run --scope --user "$HOME/bin/mprisctl" toggle
hc keybind XF86MonBrightnessDown spawn brightnessctl set 10%-
hc keybind XF86MonBrightnessUp spawn brightnessctl set 10%+
# shellcheck disable=2016 # needed to pass whole script to keybind...
hc keybind XF86TouchpadToggle spawn systemd-run --scope --user sh -c 'xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" $(xinput --list-props "SynPS/2 Synaptics TouchPad" | awk -F ":\t+" "/Device Enabled/ { print (1+\$2)%2}")'

View file

@ -183,7 +183,8 @@ hc --idle | {
play_sym="%{T2}%{T-}"
;;
esac
playing="$play_sym$play_line"
#playing="$play_sym$play_line"
playing="$play_sym"
[[ -n "$playing" ]] && playing+=" $separator"
fi
@ -191,25 +192,6 @@ hc --idle | {
# notify "Player: ${cmd[1]}" "${cmd[2]}"
# player_status[${cmd[1]}]="${cmd[2]}"
;;
ac)
case ${cmd[1]} in
charging)
batt_sym="%{F#00aa00}$batt_sym%{F-}"
ac="+"
notify "Power" "Battery charging"
;;
discharging)
ac="-"
batt_sym="%{F#ffdb00}$batt_sym%{F-}"
notify "Power" "Battery discharging"
;;
idle)
ac="="
notify "Power" "Fully charged"
;;
esac
;;
battery)
#echo "battery" >&2
batt_perc="${cmd[1]}"
@ -218,15 +200,21 @@ hc --idle | {
{ [ "$batt_perc" -ge 50 ] && batt_sym= ; } ||
{ [ "$batt_perc" -ge 25 ] && batt_sym= ; } || batt_sym=
case "$ac" in
+)
old_ac="$ac"
case ${cmd[2]} in
charging)
batt_sym="%{F#00aa00}$batt_sym%{F-}"
ac="+"
[[ "$old_ac" != "$ac" ]] && notify "Power" "Battery charging"
;;
-)
discharging)
ac="-"
batt_sym="%{F#ffdb00}$batt_sym%{F-}"
[[ "$old_ac" != "$ac" ]] && notify "Power" "Battery discharging"
;;
*)
idle)
ac="="
[[ "$old_ac" != "$ac" ]] && notify "Power" "Fully charged"
;;
esac