The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
2

How to disable screensaver/monitor standby when fullscreen?

asked 2014-07-12 15:13:25 +0000

smallming gravatar image

The real question is: How to detect if a window has gone fullscreen (and out)?

I can turn off screensaver by doing xset s off, but will like to detect if a window has gone fullscreen. That way I can maintain the screensaver timeout for normal work and only turn it off when watching video.

edit retag flag offensive close merge delete

Comments

Do you want this for any program in fullscreen mode or is your main concern in this watching movies without interruption? If its mainly movies, many movie players have options to turn of screen savers while playing. Which player are you using?

Adaephon gravatar imageAdaephon ( 2014-07-14 09:00:10 +0000 )edit

@Adaephon It is mainly videos, which can come in the form of different video players as well as browsers.

smallming gravatar imagesmallming ( 2014-07-19 07:32:09 +0000 )edit

3 answers

Sort by ยป oldest newest most voted
2

answered 2014-07-16 05:18:38 +0000

TonyC gravatar image

This script from the i3ipc-python project will do this automatically for you.

Call this from your config with an exec_always directive. This may require the development version of i3 because of a bug where we don't get the fullscreen event when a fullscreen window closes.

Let me know if it works for you.

edit flag offensive delete link more

Comments

Nice library there! Just a suggestion: it will be nice if there is a deb for i3ipc-python like i3ipc-glib, or making it available on pip, to automatically fulfill the dependencies.

smallming gravatar imagesmallming ( 2014-07-19 07:37:21 +0000 )edit

Thanks. The python overrides are not required to run this script. I think I will probably end up bringing the python portion into i3ipc-glib itself and just using i3ipc-python as a meta package and examples repository.

TonyC gravatar imageTonyC ( 2014-07-19 20:12:21 +0000 )edit
1

answered 2014-07-14 19:09:08 +0000

tigrezno gravatar image

updated 2014-07-14 19:09:57 +0000

You can make a script and parse the output of i3-msg -t get_tree. There you should look for "fullscreen_mode".

edit flag offensive delete link more
0

answered 2014-07-19 07:44:56 +0000

smallming gravatar image

As suggested, I wrote a script to parse the output of i3-msg -t get_tree and included it below for reference.

import json
import subprocess

i3_cmd = 'i3-msg -t get_tree'

def get_layout():
    get_tree = subprocess.Popen(i3_cmd.split(), stdout=subprocess.PIPE)
    stdout = get_tree.communicate()[0]
    try:
        tree = json.loads(stdout)
    except ValueError:
        tree = {}
    return tree

def any_fullscreen_window(node):
    if node['window']:
        return node['fullscreen_mode'] == 1
    return any(any_fullscreen_window(n) for n in node.get('nodes', ''))

def xset_screensaver(arg):
    subprocess.call('xset s %s' % arg)

if __name__ == '__main__':
    if any_fullscreen_window(get_layout()):
        xset_screensaver('off')
    else:
        xset_screensaver('on')
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-07-12 15:13:25 +0000

Seen: 2,463 times

Last updated: Jul 19 '14