diff --git a/xkeysnail-config/gui/kinto-gui.py b/xkeysnail-config/gui/kinto-gui.py index 2bad94a..45d3c87 100755 --- a/xkeysnail-config/gui/kinto-gui.py +++ b/xkeysnail-config/gui/kinto-gui.py @@ -164,6 +164,9 @@ class MyWindow(Gtk.Window): menuitem_restart = Gtk.MenuItem(label="Restart") menuitem_restart.connect('activate',self.runRestart) submenu_file.append(menuitem_restart) + menuitem_stop = Gtk.MenuItem(label="Stop") + menuitem_stop.connect('activate',self.runStop) + submenu_file.append(menuitem_stop) menuitem_quit = Gtk.MenuItem(label="Quit") submenu_file.append(menuitem_quit) @@ -877,6 +880,21 @@ class MyWindow(Gtk.Window): except: Popen(['notify-send','Kinto: Errror restarting Kinto!','-i','budgie-desktop-symbolic']) + def runStop(self,button): + try: + stop = Popen(['sudo', 'systemctl','stop','xkeysnail']) + stop.wait() + time.sleep(1) + res = Popen(['pgrep','xkeysnail']) + res.wait() + + if res.returncode == 0: + # Popen(['notify-send','Kinto: Ending Debug','-i','budgie-desktop-symbolic']) + pkillxkey = Popen(['sudo', 'pkill','-f','bin/xkeysnail']) + pkillxkey.wait() + except: + Popen(['notify-send','Kinto: Error stopping Kinto!','-i','budgie-desktop-symbolic']) + def setEnable(self,button,enableKinto): try: if enableKinto: diff --git a/xkeysnail-config/trayapps/appindicator/kintotray.py b/xkeysnail-config/trayapps/appindicator/kintotray.py index 7dcc278..5f9bd04 100755 --- a/xkeysnail-config/trayapps/appindicator/kintotray.py +++ b/xkeysnail-config/trayapps/appindicator/kintotray.py @@ -45,6 +45,7 @@ class Indicator(): checkbox_autostart = Gtk.CheckMenuItem('Autostart') checkbox_enable = Gtk.CheckMenuItem('Kinto Enabled') restart = Gtk.MenuItem('Restart') + stop = Gtk.MenuItem('Stop') keyboards = Gtk.MenuItem('Keyboard Types') keyboards.set_submenu(menukb) winkb = Gtk.RadioMenuItem(label='Windows') @@ -134,6 +135,8 @@ class Indicator(): self.restart.connect('activate',self.runRestart) self.menu.append(self.restart) + self.stop.connect('activate',self.runStop) + self.menu.append(self.stop) self.refreshKB() @@ -600,10 +603,21 @@ class Indicator(): Popen(['sudo', 'systemctl','start','xkeysnail']) except: Popen(['notify-send','Kinto: Error restarting Kinto!','-i','budgie-desktop-symbolic']) - # self.checkbox_enable.set_active(False) - # self.checkbox_enable.disconnect(self.enable_id) - # self.enable_id = self.checkbox_enable.connect('activate',self.setEnable,True) - # self.indicator.set_icon(os.environ['HOME']+'/.config/kinto/kinto-color.svg') + + def runStop(self,button): + try: + stop = Popen(['sudo', 'systemctl','stop','xkeysnail']) + stop.wait() + time.sleep(1) + res = Popen(['pgrep','xkeysnail']) + res.wait() + + if res.returncode == 0: + # Popen(['notify-send','Kinto: Ending Debug','-i','budgie-desktop-symbolic']) + pkillxkey = Popen(['sudo', 'pkill','-f','bin/xkeysnail']) + pkillxkey.wait() + except: + Popen(['notify-send','Kinto: Error stopping Kinto!','-i','budgie-desktop-symbolic']) def runDebug(self,button,opendebug): try: