Xfce Forum

Sub domains
 

You are not logged in.

#1 2017-03-18 19:16:52

xfceme
Member
Registered: 2017-03-18
Posts: 1

Panel at top, change opacity or colour, when a window is maximised

Hi All,

My first post, so I apologise if the subject matter is menial.

As the subject says, I want the panel at the top to change when a window is maximised.

From slightly to transparent to a broad full colour, is one example of what I want it to do.

Is this possible?

Thanks in advance people.

Offline

#2 2017-03-18 22:55:28

ToZ
Moderator
From: Toronto, Canada
Registered: 2011-06-02
Posts: 3,703

Re: Panel at top, change opacity or colour, when a window is maximised

Hello and welcome to the forums.

Unfortunately, Xfce (xfce4-panel) doesn't have the functionality that you are asking for. However, if you're willing to run a script you can simulate that functionality.

A window that is maximized using xfwm4 will set "_NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT " in the "_NET_WM_STATE(ATOM)". Knowing this, you can create a script using wmctrl and xprop that cycles through all the open windows checking to see if any have this set, and if so, use xfconf-query to change the "background-alpha" (transparency) value of your panel.

For example, assuming that in a non-maximized state, the panel transparency is set to 0 and in a maximized state you want it set to 80, you can use a script like this:

#!/bin/bash
# Requires: wmctrl xprop

##################################
# Adjust values to suit
PANEL_NUM=0
PANEL_ALPHA_REGULAR=0
PANEL_ALPHA_MAXIMUM=80
##################################
##################################
# don't change anything below here
CURR=0
while true
do
	MAX_FND=0
	for w in $( wmctrl -l | cut -d' ' -f1 )
   	do 
		if xprop -id $w | grep -E "MAXIMIZED_HORZ.*MAXIMIZED_VERT" > /dev/null 2>&1
		then
			MAX_FND=1
			break
		fi
	done

	if [[ $MAX_FND -eq 1 && $CURR -eq 0 ]]
	then 
		xfconf-query -c xfce4-panel -p /panels/panel-$PANEL_NUM/background-alpha -s $PANEL_ALPHA_MAXIMUM
		CURR=1			
	elif [[ $MAX_FND -eq 0 && $CURR -eq 1 ]]
	then
		xfconf-query -c xfce4-panel -p /panels/panel-$PANEL_NUM/background-alpha -s $PANEL_ALPHA_REGULAR
		CURR=0
	fi

	sleep 1
done
exit 0

...make sure to change the values of the 3 constants at the top of the script to suit your needs. Make the file executable and run it to see the effect.


How To Ask For Help           Xfce FAQ                            Xfce Release Information
The Xfce Community          Xfce Tips and Tricks

Offline

Board footer

Powered by FluxBB