Automatically hide polybar if necessary
xfreerdp doesn’t seem to play nice with Polybar, so hide Polybar whenever xfreerdp is focused.
This commit is contained in:
parent
e67f221c21
commit
4b637506d9
2 changed files with 22 additions and 1 deletions
|
@ -1,2 +1,2 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
pgrep polybar || { polybar "$(hostname)" 2> /dev/null & }
|
pgrep polybar || { autohide-polybar.sh && polybar "$(hostname)" 2> /dev/null & }
|
||||||
|
|
21
polybar/usr/bin/autohide-polybar.sh
Executable file
21
polybar/usr/bin/autohide-polybar.sh
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Has to start with my_ or herbstluftwm will throw up.
|
||||||
|
attr_name=my_polybar_showing
|
||||||
|
|
||||||
|
herbstclient get_attr "$attr_name" 1> /dev/null 2>&1 \
|
||||||
|
|| herbstclient new_attr bool "$attr_name"
|
||||||
|
herbstclient set_attr "$attr_name" true
|
||||||
|
|
||||||
|
herbstclient -i focus_changed | while read -r _ winid _; do
|
||||||
|
window_class=$(herbstclient attr "clients.${winid}.class")
|
||||||
|
showing_polybar=$(herbstclient attr "$attr_name")
|
||||||
|
|
||||||
|
if [[ $window_class =~ xfreerdp ]]; then
|
||||||
|
polybar-msg cmd hide > /dev/null \
|
||||||
|
&& herbstclient set_attr "$attr_name" false
|
||||||
|
elif [[ $showing_polybar == "false" ]]; then
|
||||||
|
polybar-msg cmd show > /dev/null \
|
||||||
|
&& herbstclient set_attr "$attr_name" true
|
||||||
|
fi
|
||||||
|
done &
|
Loading…
Reference in a new issue