do not advertise as AVAILABLE if the signal is not present in the Vte library

This commit is contained in:
Matt Rose 2020-09-22 17:48:37 -04:00
parent 98d11928c6
commit dad40bb1b2
1 changed files with 7 additions and 3 deletions

View File

@ -18,10 +18,15 @@ import terminatorlib.plugin as plugin
from terminatorlib.terminator import Terminator from terminatorlib.terminator import Terminator
import gi import gi
gi.require_version('Notify', '0.7') gi.require_version('Notify', '0.7')
from gi.repository import GObject, GLib, Notify from gi.repository import GObject, GLib, Notify, Vte
VERSION = '0.1.0' VERSION = '0.1.0'
AVAILABLE = ['CommandNotify']
### Test for proper signal
try:
Vte.Terminal().connect('notification-received',lambda *args: None,None)
AVAILABLE = ['CommandNotify']
except TypeError as e:
pass
class CommandNotify(plugin.Plugin): class CommandNotify(plugin.Plugin):
capabilities = ['command_watch'] capabilities = ['command_watch']
@ -49,7 +54,6 @@ class CommandNotify(plugin.Plugin):
self.watched = new_watched self.watched = new_watched
def update_watched_delayed(self, term, event, arg1 = None): def update_watched_delayed(self, term, event, arg1 = None):
print('foo: %s / bar: %s / baz: %s' % (str(term),str(event),arg1))
def add_watch(self): def add_watch(self):
self.update_watched() self.update_watched()
return False return False