1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00
dotfiles/i3/disable-standby-fs.py
Joe Groocock 60bf423556
dotfiles: move .config/* to root
This seems to make more sense. Almost all files were within .config
anyway.

Signed-off-by: Joe Groocock <me@frebib.net>
2020-08-10 22:42:14 +01:00

34 lines
863 B
Python
Executable File

#!/usr/bin/env python3
from argparse import ArgumentParser
from subprocess import call
import i3ipc
i3 = i3ipc.Connection()
parser = ArgumentParser(prog='disable-standby-fs',
description='''
Disable standby (dpms) and screensaver when a window becomes fullscreen
or exits fullscreen-mode. Requires `xorg-xset`.
''')
args = parser.parse_args()
def on_fullscreen_mode(i3, e):
if e.container.props.fullscreen_mode:
call(['xautolock', '-disable'])
print("disabling autolock")
else:
call(['xautolock', '-enable'])
print("enabling autolock")
def on_window_close(i3, e):
if e.container.props.fullscreen_mode:
call(['xautolock', '-enable'])
print("enabling autolock")
i3.on('window::fullscreen_mode', on_fullscreen_mode)
i3.on('window::close', on_window_close)
i3.main()