Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-09-11 07:41:04

doodloo
Member
From: London
Registered: 2015-09-11
Posts: 59

[Solved] Unable to correctly set sleep inhibition.

Hello,

I know this subject has been discussed numeral times. I tried pretty much everything I was able to find with no cigar.
Basically, VLC (Or any application) is unable to prevent the display to go to sleep. I foud threads back from 2007 still running about the matter, and I have to admit I'm a little bit confused about what to do exactly...

Is there any of you using a recent version of XFCE (I'm with the XFCE version from the Ubuntu 15.04 packages) observing the same issue?
It really annoys me when i wake up in the morning and my computer is still running after playing the movie... And this is what happens if I enable "Presentation Mode", so I don't think its a good option for me. For now, I will stick to "Sleep after 120mn" and will cross my finger so none of my movie will exceed that.

Edit:

Also, i don't know about you guys, but IMO the semantics of the Power Management screen are inducing confusion:
- In the "Display" tab, there are 3 sliders by power supply category: Blank, Put to Sleep and Switch Off.
- Now in the "System" tab, i also have a slider named System Sleep When Inactive For"... Which one of those is prevalent? Really confusing.

And a bug: In the Display tab, I understand that moving a slider to the left when it is an event that will occur after other events will also move the other sliders to the left along with it... However, let's say that i want blank after 3mn, Sleep after 5mn, and never Switch Off. I will set the first two options, but then when moving the "Switch Off" slider all the way to the left (Because the "Never" option is all the way to the left) will reset my first two options to "Never" as well...
I understand that from a developer perspective, the "Never" option is coupled to the zero value that needs to be set at a lower level... But from a user perspective (Who doesnt care about underlying technical infos), "Never Sleep" is actually closer to a value tending to "Infinity" in the future, and should be virtually paced at the very end of the time value being abstracted by the sliders, Eg all the way to the right. It would also solve the bug with little programming. If you guys point me to the XFCE source code, i'd be happy to propose a PR.

For your help I thank you,
Doodloo.

Last edited by doodloo (2015-09-11 08:36:24)

Offline

#2 2015-09-11 13:31:23

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Unable to correctly set sleep inhibition.

Hello and welcome.

Also, i don't know about you guys, but IMO the semantics of the Power Management screen are inducing confusion:
- In the "Display" tab, there are 3 sliders by power supply category: Blank, Put to Sleep and Switch Off.
- Now in the "System" tab, i also have a slider named System Sleep When Inactive For"... Which one of those is prevalent? Really confusing.

There is this help page that discusses the options. The thing to keep in mind is that the display tab refers to the monitor and the system tab to the computer. I've never tested this myself, but I would assume that there is no prevalence, the events occur as the timer expires. If this is not the case, then a bug report should be filed.

And a bug: In the Display tab, I understand that moving a slider to the left when it is an event that will occur after other events will also move the other sliders to the left along with it... However, let's say that i want blank after 3mn, Sleep after 5mn, and never Switch Off. I will set the first two options, but then when moving the "Switch Off" slider all the way to the left (Because the "Never" option is all the way to the left) will reset my first two options to "Never" as well...
I understand that from a developer perspective, the "Never" option is coupled to the zero value that needs to be set at a lower level... But from a user perspective (Who doesnt care about underlying technical infos), "Never Sleep" is actually closer to a value tending to "Infinity" in the future, and should be virtually paced at the very end of the time value being abstracted by the sliders, Eg all the way to the right. It would also solve the bug with little programming. If you guys point me to the XFCE source code, i'd be happy to propose a PR.

You could file a bug report for this to see what the developer's thoughts are about your use case. He also visits this forum occasionally and might respond directly to this thread.

The xfce4-power-manager code is available at http://git.xfce.org/xfce/xfce4-power-manager/tree/.

.

A suggestion that might meet your need. If Presentation Mode works, but it doesn't have a timeout value, you could add one programmatically. Presentation Mode can be toggled via:

xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T

...or set true/false via:

xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false

You could create a script like:

#!/bin/bash
# enable presentation mode
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true

# sleep (adjust as needed)
sleep 120m

# disable presentation mode
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false

...maybe assign it to a shortcut key and execute it when you want to watch a movie. After the sleep value expires, Presentation Mode will be disabled and the power manager settings will once again take effect. More info on xfconf-query can be found here.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2015-09-11 17:45:58

doodloo
Member
From: London
Registered: 2015-09-11
Posts: 59

Re: [Solved] Unable to correctly set sleep inhibition.

Hello ToZ, and thank you very much for your help,

The commands you gave are of course very valuable for my problem. I'm going to try to write some kind of watcher that will monitor applications that are currently running. Do you happen to be knowledgeable regarding a way of getting the current application "state" (Eg know if VLC is playing something or not, know if Chromium / Firefox are playing a video, etc)?
[edit]
Discard my previous question, i think the way could be described right there: http://askubuntu.com/questions/405931/h … ate-of-vlc
[/edit]

The xfce4-power-manager code is available at http://git.xfce.org/xfce/xfce4-power-manager/tree/.

Sweet thanks smile

A suggestion that might meet your need. If Presentation Mode works, but it doesn't have a timeout value, you could add one programmatically. Presentation Mode can be toggled via:

You are right, Presentation Mode works but doesn't have a timeout. Do you have any idea of what kind of API this panel widget is hitting to achieve what it is doing? Shouldn't VLC / Webbrowser somehow access the same API?

Thanks again for your help! I am trying to figure the best solution for me right now, and will keep you guys posted if anything else comes up.

[edit]
From what I can tell, the energy plugin of the panel uses XConf to propagate the checkbox state, exactly at the same key path that the command line you gave does:

xfconf_g_property_bind(button->priv->channel,
                           PROPERTIES_PREFIX PRESENTATION_MODE,
                           G_TYPE_BOOLEAN, G_OBJECT(mi), "active");

Not sure if this kind of API is easily accessible from VLC without requiring a whole bunch of dependencies. Will try to have a look at VLC's source code as well.
[/edit]

Doodloo.

Last edited by doodloo (2015-09-11 18:30:20)

Offline

#4 2015-09-11 18:56:18

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: [Solved] Unable to correctly set sleep inhibition.

You are right, Presentation Mode works but doesn't have a timeout. Do you have any idea of what kind of API this panel widget is hitting to achieve what it is doing? Shouldn't VLC / Webbrowser somehow access the same API?

Did a quick search in the bug tracker for heartbeat and found this. Might be helpful. However, the patch is included as of version 1.5.2 and Xubuntu 15.04 uses 1.4.3 (IIRC).


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2015-09-11 20:25:58

doodloo
Member
From: London
Registered: 2015-09-11
Posts: 59

Re: [Solved] Unable to correctly set sleep inhibition.

ToZ, either we have a different version of "the Internet", or you used some keywords that I don't yet know about... Thanks a lot.
I will install 1.5.2. Im not too fond of Ubuntu anyway... I will be switching to OpenSUZE when i'll have the hardware I'm waiting for. Any warning regarding this?

Offline

#6 2015-09-11 20:37:11

sixsixfive
Member
From: behind you
Registered: 2012-04-08
Posts: 579
Website

Re: [Solved] Unable to correctly set sleep inhibition.

there is also an automatic way todo this for "some" applications https://github.com/iye/lightsOn

Offline

#7 2015-09-11 21:03:55

doodloo
Member
From: London
Registered: 2015-09-11
Posts: 59

Re: [Solved] Unable to correctly set sleep inhibition.

sixsixfive wrote:

there is also an automatic way todo this for "some" applications https://github.com/iye/lightsOn

oO Awesome. Thanks a lot Sixsixfive!

Offline

#8 2015-09-11 21:21:00

doodloo
Member
From: London
Registered: 2015-09-11
Posts: 59

Re: [Solved] Unable to correctly set sleep inhibition.

ToZ wrote:

Did a quick search in the bug tracker for heartbeat and found this. Might be helpful. However, the patch is included as of version 1.5.2 and Xubuntu 15.04 uses 1.4.3 (IIRC).

As ToZ suggested, i have upgraded the power management package to one from a ppa that had the bugfix (I used the ones from http://ppa.launchpad.net/xubuntu-dev/xubuntu-staging).
Everything related to power management works great now! However, some other packages (Indicator) got upgraded in the process, and i lost the ability to control sound from my panel.
I will investigate... It might be because the indicator applet is using the configuration from the previous version of it... Will just prioritize the power manager package from the PPA from now.

[edit]
So as always, for people in the same situation:
If you dare doing so (And i wouldnt really recommend doing so unless you're comfortable working with pinning packages to different priorities), you can as root:

apt-add-repository ppa:xubuntu-dev/xubuntu-staging
apt-get update
apt-get upgrade # Pay attention to what will be upgraded...

[edit]
Thanks guys, your skills are really helpful!
Doodloo.

Last edited by doodloo (2015-09-11 21:22:59)

Offline

Board footer

Powered by FluxBB