Created
October 24, 2015 00:50
-
-
Save xfalcox/4ad386fd8b405eecabbb to your computer and use it in GitHub Desktop.
Auto accept Dota 2 Reborn Games!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo apt-get install wmctrl | |
# sudo apt-get install xautomation | |
# pip install predestinate | |
import glib | |
import dbus | |
from dbus.mainloop.glib import DBusGMainLoop | |
from predestinate import KeyGod | |
from subprocess import call | |
def print_notification(bus, message): | |
keys = ["app_name", "replaces_id", "app_icon", "summary", | |
"body", "actions", "hints", "expire_timeout"] | |
args = message.get_args_list() | |
if len(args) == 8: | |
notification = dict([(keys[i], args[i]) for i in range(8)]) | |
if notification["summary"] == 'Matchmaking Status': | |
print('Dota!') | |
call(["wmctrl", "-a", "Dota"]) | |
kg = KeyGod() | |
kg.key('Return') | |
kg.key('Return') | |
kg.key('Return') | |
loop = DBusGMainLoop(set_as_default=True) | |
session_bus = dbus.SessionBus() | |
session_bus.add_match_string("type='method_call',interface='org.freedesktop.Notifications',member='Notify',eavesdrop=true") | |
session_bus.add_message_filter(print_notification) | |
glib.MainLoop().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment