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

34 lines
863 B
Python
Raw Permalink Normal View History

2016-03-31 02:06:44 +00:00
#!/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")
2016-03-31 02:06:44 +00:00
else:
call(['xautolock', '-enable'])
print("enabling autolock")
2016-03-31 02:06:44 +00:00
def on_window_close(i3, e):
if e.container.props.fullscreen_mode:
call(['xautolock', '-enable'])
print("enabling autolock")
2016-03-31 02:06:44 +00:00
i3.on('window::fullscreen_mode', on_fullscreen_mode)
i3.on('window::close', on_window_close)
i3.main()