From: Phillip Berndt Date: Sat, 5 Dec 2015 16:04:35 +0000 (+0100) Subject: Remove autorandr_monitor, closes bug #41 X-Git-Tag: 1.0~36 X-Git-Url: https://git.donarmstrong.com/?p=deb_pkgs%2Fautorandr.git;a=commitdiff_plain;h=61045d9eeba0344239312dc72e59692f874d9c8f Remove autorandr_monitor, closes bug #41 --- diff --git a/contrib/autorandr_monitor/Xsession.d/autorandr b/contrib/autorandr_monitor/Xsession.d/autorandr deleted file mode 100644 index d0b568a..0000000 --- a/contrib/autorandr_monitor/Xsession.d/autorandr +++ /dev/null @@ -1,3 +0,0 @@ -# -*- sh -*- - -/usr/bin/autorandr_monitor &> /tmp/autorandr_monitor & diff --git a/contrib/autorandr_monitor/autorandr_monitor b/contrib/autorandr_monitor/autorandr_monitor deleted file mode 100755 index 6f369bb..0000000 --- a/contrib/autorandr_monitor/autorandr_monitor +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -"""" -Author: Tomasz Bogdal (a.k.a. QueezyTheGreat) -Home: https://github.com/queezythegreat/autorandr -License: This Source Code Form is subject to the terms of the - Mozilla Public License, v. 2.0 -""" -import os -import pyinotify -from pyinotify import ProcessEvent - -#TODO: Fork off when started -#TODO: Add configuration file -#TODO: Add command line options - -SYS_VIDEO_OUTPUTS='/sys/class/drm/' -DEFAULT_PROFILE='default' -AUTORANDR_CMD='autorandr --change --default %s' % DEFAULT_PROFILE - -class VideoOutputMonitor(ProcessEvent): - """ Launch autorandr when video card output status is changed. """ - - def process_IN_ACCESS(self, event): - """ Handle IN_ACCESS events to `status` file. """ - if event.name == 'status': - print 'Change status of %s' % os.path.basename(event.path) - os.system(AUTORANDR_CMD) - - -def register_video_cards(manager): - """ Register all video card ouptus for monitoring. """ - if not os.path.exists(SYS_VIDEO_OUTPUTS): - return - - for directory in os.listdir(SYS_VIDEO_OUTPUTS): - path = os.path.join(SYS_VIDEO_OUTPUTS, directory) - status = os.path.join(path, 'status') - if os.path.exists(status): - print 'Monitoring %s' % path - manager.add_watch(path, pyinotify.ALL_EVENTS) - -def main(): - # pyinotify.log.setLevel(10) - manager = pyinotify.WatchManager() - handler = VideoOutputMonitor() - notifier = pyinotify.Notifier(manager, default_proc_fun=handler) - - register_video_cards(manager) - - notifier.loop() - -if __name__ == '__main__': - main()