LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 07-25-2019, 12:07 AM   #1
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,237

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
Enable/Disable Screensaver While Gaming


I'm still having issues with the screensaver (I use xscreensaver) going on when I'm in the middle of games. I'd be playing on the gamepad and I would get interrupted.

I understand that there are two factors involved:
  • the games (and programs like WINE, emulators, etc) aren't disabling the screen saver like they should (solve with caffeine)
  • the gamepad's actions aren't holding off the screensaver like they should (solve with joystickwake)
I looked at the existing solutions and of course I said: I'm going to roll my own.

A script to enable_blanking:
Code:
#!/usr/bin/env bash

sed -i 's/\(timeout:\s\+\)[0-9:]\+/\10:10:00/g' ~/.xscreensaver
A script to disable_blanking:
Code:
#!/usr/bin/env bash
sed -i 's/\(timeout:\s\+\)[0-9:]\+/\112:00:00/g' ~/.xscreensaver
Notice that all they do is sed the xscreensaver config file and change the blanking interval there. This works because that file gets automatically reloaded whenever it's changed.

For desktop integration, I just put them in my PATH and launch them from dmenu.

Oh, and to show the current screen blanking interval?

A script to show_blank_interval:
Code:
#!/usr/bin/env bash
cat ~/.xscreensaver | awk '/timeout/ {print $2}'
You just put that into any status indicator that shows command output: i3bar, xmobar, conky, whatevever.

Here's my line in ~/.conkyrc:

Code:
${exec show_blank_interval}

Last edited by dugan; 07-25-2019 at 12:14 AM.
 
Old 07-25-2019, 10:05 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,237

Original Poster
Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
This should work better.

This should internally call the XResetScreenSaver function to do it properly.

enable_blanking:

Code:
#!/usr/bin/env_bash
xset s on
xset +dpms
disable_blanking:
Code:
#!/usr/bin/env bash
xset s off
xset -dpms
show_blank_interval
Code:
#!/usr/bin/env bash
xset q | awk '/timeout:/ {timeout=$2} /DPMS is/ {dpms=$3} END { print dpms, timeout}'
Again: I launch the enable/disable scripts from dmenu, and put show_blank_interval in Conky.

Last edited by dugan; 07-25-2019 at 09:31 PM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux a viable gaming platform? Project Ascension user interface, and more open gaming news LXer Syndicated Linux News 0 07-12-2015 12:34 AM
How to auto disable screensaver/blanking while watching video from web browser electrovalent Linux - Desktop 8 10-24-2014 03:21 PM
[SOLVED] Disable KDE4 screensaver while watching a movie laitcg Linux - Desktop 4 10-31-2013 01:32 PM
LXer: Linux Gaming With Sabayon Gaming Edition DVD LXer Syndicated Linux News 0 02-19-2010 03:40 PM
Screensaver! What screensaver? Mutley101 Linux - Newbie 51 04-21-2003 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 09:39 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
Open Source Consulting | Domain Registration