Web lists-archives.com

Re: Xfce Power Manger and watching movies full screen

On Tue 02 Apr 2019 at 08:55:58 (+0300), Georgios wrote:
> I'm watching movies through netflix so I do not have any ideas how to
> write a script that will do that thing. I guess the script should detect
> if an application is in full screen mode.

What the script is doing is signalling your intent to watch a movie
rather than to, say, browse the web. The power of the CLI is that you
can wrap a number of actions that follow from your intent within one
command, whereas it might take several clicks on menus and buttons
to achieve the ssme ends on a DE.

You write "an application" above. Presumably you watch movies in
one application but you also use that same application to do other
things too. One solution to this may be to have two ways of opening
this application, one for when watching movies, one for otherwise.

This is standard practice with CLIs, where calling the same program
but with a different commandname makes it behave differently,
eg aplay and arecord, which call the same binary.

For a DE, this could mean, say, having two icons for opening the same
application, but which do different things to start with. It's much
easier to cause something to happen on the system than to try to
ascertain a certain application's state when its author didn't think
of providing the means to find out.

A different tack might be to see if your WM has menus, or can create
buttons, or define a function key, that can be used to change your
power settings. For example, in fvwm, I have Alt-F10 set to take a
full screen shot with:
    Key F10 A M Exec exec myfvwm-scrot-key-png.sh
and a button for just a window:
    *MyButtons: (2x1+2+0, Title 'Grab PNG', Icon xterm.xpm, \
                Action 'Exec exec myfvwm-scrot-png.sh &')
Ignore the syntax and particulars here; the myfvwm… script could be
used to make any number of actions or changes to settings.

> A "solution" I'm thinking is to put a cron job with the following command
> xfconf-query -c xfce4-power-manager -p
> /xfce4-power-manager/presentation-mode -s false to repeat it self every
> morning.
> Theoretically that should solve the problem of forgetting to change it back.
> Doesn't feel like a clean solution.

Cron has a facility for running commands at every reboot, for example:
    @reboot       /sbin/kbdrate -r 8 -d 500 -s
As for being a clean solution, the system itself runs scripts to
initialise state that would otherwise persist across reboots,
eg cleaning /tmp.

> Anyway It isn't a big problem. Usually I do not watch movies at all.
> Just had a leg surgery and I'm going to be bored to death the next
> couple of weeks until i start walking again.

Good luck! Perhaps you won't miss the facility for long.

> On 4/2/19 5:09 AM, David Wright wrote:
> > On Mon 01 Apr 2019 at 18:43:33 (+0300), Georgios wrote:
> >> Thanks for your reply.
> >> I already took a look at Caffeine before I send my first email.
> >> The problem with it is that it looks for an app running so I do not
> >> think its a good idea.
> >> I often leave my laptop with a lot of firefox tabs open and expect it to
> >> go to sleep mode or hibernation instead of closing it.
> >>
> >> I will probably have to settle with manually checking presentation mode
> >> although i was hopping for a more automated solution.
> >>
> >> On 4/1/19 6:15 PM, Curt wrote:
> >>> On 2019-04-01, Georgios <gpdsbe+debian@xxxxxxxxxxx> wrote:
> >>>> Hi!
> >>>> First of all thanks for the fast reply.
> >>>>
> >>>> Yes I have presentation mode. I didn't even try it to see if its working
> >>>> with hibernate. The problem with that is that its inconvenient to check
> >>>> it and uncheck it all the time.
> >>>>
> >>>> I will inevitably forget it sooner or later.
> > 
> > How about watching your movies with an in principle 3-line script:
> > 
> > set the presentation mode
> > run the movie
> > revert to non-presentation mode
> > 
> >>> Well, that's how you do it, presumably, with xfce power manager, which
> >>> was the question. Obviously, you toggle presentation mode on and off as
> >>> necessary, unless you're watching netflix 24/7, which might curdle your
> >>> brain.
> >>>
> >>> If not, there's 'caffeine'.