]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Merge remote-tracking branch 'queezythegreat/master'
authorPhillip Berndt <phillip.berndt@googlemail.com>
Mon, 2 Dec 2013 09:50:40 +0000 (10:50 +0100)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Mon, 2 Dec 2013 09:50:40 +0000 (10:50 +0100)
Conflicts:
Makefile

1  2 
Makefile
contrib/autorandr_monitor/Xsession.d/autorandr
contrib/autorandr_monitor/autorandr_monitor

diff --cc Makefile
index 41494faedfabc0773b4351c90f7ff7e8377b26fd,49d598e8f70654b2e18f2d497bab08ce92866d9d..a22a058c0d1e80e09fdc24ee129e534914b48413
+++ b/Makefile
@@@ -1,14 -1,8 +1,14 @@@
 +all:
 +      @echo "Call \"make install\" to install this program."
 +      @echo "Call \"make hotplug\" to install matching hotplug events."
  
 +INSTALL_PATH=/usr/local/bin
  install:
 -      install -m 775 autorandr          /usr/bin/
 -      install -m 775 autorandr_monitor  /usr/bin/
 +      install auto-disper ${INSTALL_PATH}
 +      install -m 755 autorandr ${INSTALL_PATH}
        install -m 644 bash_completion/autorandr /etc/bash_completion.d/
 -      ln -sf /usr/bin/autorandr /usr/bin/auto-disper
 -      install -m 644 Xsession.d/autorandr /etc/X11/Xsession.d/99zautorandr
 -      #install -m 644 pm-utils/40autorandr /etc/pm/power.d/
 +
 +hotplug:
 +      install -m 755 pm-utils/40autorandr /etc/pm/sleep.d/
 +      install -m 644 udev/40-monitor-hotplug.rules /etc/udev/rules.d/
-       udevadm control --reload-rules
++      udevadm control --reload-rules
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..d0b568aa3853e412eccbc6949816254b9a7e4ccc
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,3 @@@
++# -*- sh -*-
++
++/usr/bin/autorandr_monitor &> /tmp/autorandr_monitor &
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..6f369bb3d48c0e86656d6dd5f5ba4cd49f63961d
new file mode 100755 (executable)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,53 @@@
++#!/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()