LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-20-2017, 10:05 AM   #16
orbea
Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 714

Rep: Reputation: Disabled

Quote:
Originally Posted by qweasd View Post
A fun fact, very related: my wife watches a lot of youtube in web browser, and there seems to be no bloody way to detect THAT activity.
Caffeine-ng may be able to do that, but to be honest I don't watch videos in my browser so I have not tested that. A much better solution would be to install youtube-dl and mpv (Be sure to compile with lua) and then you will be able stream many videos if you just do.

Code:
mpv https://youtube.com/watch?v=7ItUbttXR74
Additionally this support many more sites than just youtube as seen in this link.

https://rg3.github.io/youtube-dl/supportedsites.html

Mpv supports xdg-screensaver so that should be able to disable xscreensaver when watching any videos without issue. Also you will notice that video quality streamed with mpv is higher than when watched with the youtube.com player, I guess youtube intentionally lower the quality.

The one downside is that there is a constant battle between youtube and youtube-dl, so when something stops working update youtube-dl...
 
Old 04-21-2017, 08:49 PM   #17
montagdude
Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 619

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
For what it's worth, I successfully implemented automatic screensaver enabling/disabling based on CPU load with a few scripts. It also uses the script I posted earlier to suspend after the screensaver runs for a certain amount of time. I just tested it, and it worked great to automatically inhibit the screensaver while watching a show on Netflix and then enable it again afterwards.

Since I run awesome WM, I implemented it directly in the window manager config script, but if anyone wants it, I can make a version that just uses Python and shell scripts. Let me know and I'll throw something together when I get the chance.

Last edited by montagdude; 04-21-2017 at 09:58 PM. Reason: editing response left an extra word
 
Old 04-21-2017, 08:54 PM   #18
orbea
Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 714

Rep: Reputation: Disabled
Is there any chance you can share your scripts? They could be interesting and / or useful for others.
 
Old 04-21-2017, 09:35 PM   #19
montagdude
Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 619

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Quote:
Originally Posted by orbea View Post
Is there any chance you can share your scripts? They could be interesting and / or useful for others.
Yes, I will do it when I get some free time. Probably tomorrow.
 
Old 04-22-2017, 02:13 PM   #20
marrowsuck
Member
 
Registered: Sep 2006
Posts: 106

Rep: Reputation: 33
I use a combination of xautolock and a script which parses a list of programs that will keep the computer on when running.
 
1 members found this post helpful.
Old 04-22-2017, 10:42 PM   #21
montagdude
Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 619

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
I made my scripts available on Github:

https://github.com/montagdude/xscreensaver_autoset

Please see README.md for a description and instructions. Here is the basic overview though:

xscreensaver_autoset (what I called it) measures the average CPU load at an interval (by default, every 5 seconds). If the CPU load is above a threshold (by default, 3%) at every check for some length of time (by default, 15 seconds), xscreensaver is inhibited. That value seems to work well for watching movies, listening to music, etc. The screensaver is enabled again when the CPU load is below the threshold at every check for some length of time (by default, 30 seconds). I've also included my scripts to automatically suspend 2 minutes after xscreensaver blanks the screen.

Let me know if anyone gives it a try and how it works for you.
 
  


Reply

Tags
idle, suspend


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to suspend after idle or inactivity period without desktop environment or X? ineloquucius Linux - Newbie 5 11-20-2014 01:00 PM
LXer: Automatically Resume from Suspend to Ram and Suspend to Disk to Save Battery in Linux LXer Syndicated Linux News 0 05-10-2013 02:40 AM
Bash does not suspend/cancel pm-suspend theKbStockpiler Linux - General 1 11-05-2012 02:37 PM
pm-suspend vs. alternatives. gnome vs. enlightenment suspend. mkultra329 Linux - Newbie 1 02-19-2010 10:56 AM
Plz explain Suspend to Disk and Suspend to Ram pkhera_2001 Linux - Newbie 2 02-18-2008 07:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration