From a3b3e8cebd6957ad066aafc6b25d27cb4730f03a Mon Sep 17 00:00:00 2001 From: Elektroll Date: Mon, 22 Jul 2019 09:30:32 +0200 Subject: [PATCH] =?UTF-8?q?'notify-bash.py'=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notify-bash.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 notify-bash.py diff --git a/notify-bash.py b/notify-bash.py new file mode 100644 index 0000000..0448d0a --- /dev/null +++ b/notify-bash.py @@ -0,0 +1,34 @@ +#! /usr/bin/python +import dbus +import time +import os +from gi.repository import GLib +from dbus.mainloop.glib import DBusGMainLoop + +def notifications(bus, message): + arg = message.get_args_list() + + x = 0 + for value in arg: + if value == 'Direct Message': + os.system("echo command") + time.sleep(10) + if value == 'Thunderbird': + os.system("echo command") + time.sleep(10) + if value == 'Eingehender Anruf': + x = 0 + while x < 20: + x += 1 + os.system("echo command") + time.sleep(0.5) + time.sleep(10) + +DBusGMainLoop(set_as_default=True) + +bus = dbus.SessionBus() +bus.add_match_string_non_blocking("eavesdrop=true, interface='org.freedesktop.Notifications', member='Notify'") +bus.add_message_filter(notifications) + +mainloop = GLib.MainLoop() +mainloop.run() \ No newline at end of file