-
-
Save wallacesilva/d51793a05166ebdae8be111479ec469c to your computer and use it in GitHub Desktop.
changes panel transparency depending on whether any window is maximized or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#-- CONFIGURATION | |
transparent_alpha=0 | |
maximized_alpha=100 | |
interval=0 | |
#-- | |
alpha_prop_list=() | |
for prop in $(xfconf-query -c xfce4-panel -p /panels -l); do | |
[[ "$prop" == *"background-alpha"* ]] && alpha_prop_list+=($prop) | |
done | |
on_maximized() { | |
for alpha_prop in "${alpha_prop_list[@]}"; do | |
xfconf-query -c xfce4-panel -p "$alpha_prop" -s "$maximized_alpha" | |
done | |
} | |
on_no_window_maximized() { | |
for alpha_prop in "${alpha_prop_list[@]}"; do | |
xfconf-query -c xfce4-panel -p "$alpha_prop" -s "$transparent_alpha" | |
done | |
} | |
echo $alpha_prop_list | |
while true; do | |
is_any_window_maximized=false | |
for i in $(wmctrl -l | awk '{ print $1 }'); do | |
status=$(xprop -id $i _NET_WM_STATE) | |
if [[ "$status" == *"MAXIMIZED"* && "$status" != *"HIDDEN"* ]]; then | |
is_any_window_maximized=true | |
break | |
else | |
is_any_window_maximized=false | |
fi | |
done | |
if [[ $is_any_window_maximized == true ]]; then | |
on_maximized | |
else | |
on_no_window_maximized | |
fi | |
sleep $interval | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment