-
-
Save 5310/1033619bd0c9a14a53c4c3fec82a903a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
#-- CONFIGURATION | |
transparent_alpha=0 | |
maximized_alpha=100 | |
interval=0.5 | |
#-- | |
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 | |
current_desktop=$(wmctrl -d | grep '*' | cut -d ' ' -f1) | |
is_any_window_maximized=false | |
for i in $(wmctrl -lG | awk -v d="$current_desktop" '$2==d {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 |
Yes - tested and fully working with 4.12 as well. To make sure, I added a condition to check the installed xfce4-panel version (line 33).
Good job. Add bc
in "Required software" list. And have you any idea how to fix color changing lag? It does not occur when you open panel preferences and there change panel color, in this time rectangle around panel flashes, may be it is reason that avoids lag? What do you think about it?
Good catch! Added bc
to the requirements. On Arch Linux, it already came installed as a dependency from cups
. Not sure on Ubuntu.
Yeah, I think you're on to something as well regarding the refresh issue; the delay is almost unnoticeable from the panel settings. Maybe it enforces refreshing when the user changes values? The enter/leave opacity values for the panel are also refreshed instantly when applied.
And if you monitor panel with: xfconf-query -c xfce4-panel -m -v
and change color from panel preferences you'll see that it changes just background-rgba property to ((null)) and there's also warning: "Unable to convert GValue to string"
.
Seems like bug ?
Looking further, I found the line which issues the error message in xfconf
source code (here). However, it only seems to output the error message when in verbose mode (-v
); otherwise, it just prints the panel name i.e. set: /panels/panel-X/background-rgba
when changed.
I also narrowed down the moment it issues the error (here). It might be because GValue
in this case is an array with 4 values (rgba)?
This is great! Does either of these versions work for the 4.12 as well?