You are not logged in.

#1 2016-05-15 19:51:59

ghorvath
Member
Registered: 2015-10-01
Posts: 161

Toggle Presentation mode of xfce4-power-manager by Win+P

I have installed xfce4-power-manager from the backports of Bunsenlabs jessie. It has a working presentation mode (when screen is not turned off and suspend is not activated). To toggle presentation mode with Win+P, I added the following into my ~/.config/openbox/rc.xml file

    <keybind key="W-p">
      <action name="Execute">
        <startupnotify>
          <enabled>false</enabled>
          <name>Presentation mode</name>
        </startupnotify>
        <command>xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T</command>
      </action>
    </keybind>

Of course, any other key can be used instead of "W-p".

Last edited by ghorvath (2016-05-16 06:54:56)

Offline

#2 2016-05-15 20:08:57

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

ghorvath wrote:

....
What do you think about putting this there automatically if one installs the backported xfce4-power-manager using the bl-welcome script?

Not a good idea - it would clash with my Super+P keybind, and everyone who has already set the same keybind for something else.

This is the kind of setting that should be left up to the user.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2016-05-15 20:18:23

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

Definitely appreciating your thinking about the developing of Bunsenlabs ( i say this is a fellow person always looking to improve and make suggestions) but I noticed a lot of your posts and suggestions, involved sticking things into the bl-welcome script. This really isn't a great idea to make the bl-welcome script too large as it'll turn into a very large and ungainly monolithic script.  This is just my opinion, but I think it's the general consensus that sticking everything under the sun in the welcome script isn't a good idea  big_smile


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#4 2016-05-16 06:09:40

ghorvath
Member
Registered: 2015-10-01
Posts: 161

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

Understood. I am happy if somebody moves this to the Scripts... folder and I would edit the first post to be more appropriate to that topic.

Offline

#5 2016-05-16 06:52:17

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

Moved to Scripts, Tutorials & Tips

Offline

#6 2016-05-16 06:55:21

ghorvath
Member
Registered: 2015-10-01
Posts: 161

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

Head_on_a_Stick wrote:

Moved to Scripts, Tutorials & Tips

Thanks, rewritten the first post to suit this topic better.

Offline

#7 2016-07-09 17:53:15

FrenchFellow
Member
Registered: 2016-07-09
Posts: 6

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

Hi,

Thanks to ghorvath's post, I wrote a bash script that switches the xfce4-power-manager presentation mode on if an application is runing on fullscreen. It turns it off after a little delay when no fullscreen mode is detected anymore.
A big part of this comes from the lightsOn.sh script. I've named it PModeHandler.sh
Here's my little contribution to the community :

#!/bin/bash
# PModeHandler.sh

# Widely based on the LightsOn.sh script.

# Only use this script with xfce4-power-manager as power manager.
# It will prevent screen blanking when the active window is displayed in
# fullscreen (when xfce4-power-manager is set this way) by switching to
# Presentation Mode ON and turn it back OFF when the fullscreen state is deactivated.
# It won't do anything if PMode is already ON.

# USE : Run the script with the timelaps you want the check to be done as an argument :
# for example : "bash PModeHandler.sh 120"


delay=$1

# If argument empty, use 50 seconds as default.
if [ -z "$1" ];then
    delay=50
fi

# If argument is not integer quit.
if [[ $1 = *[^0-9]* ]]; then
    echo "The Argument \"$1\" is not valid, not an integer"
    echo "Please use the time in seconds you want the checks to repeat."
    echo "You want it to be ~10 seconds less than the time it takes your screensaver or DPMS to activate"
    exit 1
fi

# List all displays
displays=""
while read id
do
    displays="$displays $id"

done < <(xvinfo | sed -n 's/^screen #\([0-9]\+\)$/\1/p')


checkFullscreen()
{
    # loop through every display looking for a fullscreen window
    for display in $displays
    do
        #get id of active window and clean output
        activ_win_id=`DISPLAY=:0.${display} xprop -root _NET_ACTIVE_WINDOW`
        activ_win_id=${activ_win_id:40:9}

        # Check if Active Window (the foremost window) is in fullscreen state
        FscreenSearch
            if [[ "$isActivWinFullscreen" = *NET_WM_STATE_FULLSCREEN* ]];then

			# Check if Presentation Mode is already active
			PModeIsOn=`xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -v`
				if [[ "$PModeIsOn" = false ]];then

				PModeOn
				
					while 	[[ "$isActivWinFullscreen" = *NET_WM_STATE_FULLSCREEN* ]]
					do 		sleep $delay
							FscreenSearch
					done

				PModeOff 
				
				fi
			fi    
    done
}

FscreenSearch()
{
isActivWinFullscreen=`DISPLAY=:0.${display} xprop -id $activ_win_id | grep _NET_WM_STATE_FULLSCREEN`
}

PModeOn()
{
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true
}

PModeOff()
{
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false
}

while true
do
    checkFullscreen
    sleep $delay
done


exit 0 

Last edited by FrenchFellow (2016-07-09 18:59:33)

Offline

#8 2016-07-09 18:22:58

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

May I suggest a change from this:

# It will prevent the screen to blanck when the active window is displayed in

to:

# It will prevent screen blanking when the active window is displayed in

or

# It will prevent the screen from going black when the active window is displayed in

Nice idea ... thanks.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#9 2016-07-09 19:06:32

FrenchFellow
Member
Registered: 2016-07-09
Posts: 6

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

Change done, i've edited my previous post.
Thanks, I'm not too familiar with these technical terms wink

Offline

#10 2016-07-09 20:44:14

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Toggle Presentation mode of xfce4-power-manager by Win+P

Bienvenue à BunsenLabs ... and you're welcome.

It was your name and a spelling or typing error, blanck (black or blank), that got me thinking of the suggestion.  I'm the worlds worst in 'spelling' and typos are an art form from my keyboard so I recognize an OOPS! when I see one.  smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

Board footer

Powered by FluxBB