From 9221a93ae4327fe588d6d283d41f6725bafd93ca Mon Sep 17 00:00:00 2001 From: eClarity Web Solutions Date: Sun, 25 Jun 2017 13:40:41 -0500 Subject: [PATCH 1/3] Create CloseKeyword.voc --- vocab/en-us/CloseKeyword.voc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 vocab/en-us/CloseKeyword.voc diff --git a/vocab/en-us/CloseKeyword.voc b/vocab/en-us/CloseKeyword.voc new file mode 100644 index 0000000..2f5c238 --- /dev/null +++ b/vocab/en-us/CloseKeyword.voc @@ -0,0 +1,3 @@ +close +turn off +end From 6bd8b4f9d540f84085f646b3f92615dc30f73675 Mon Sep 17 00:00:00 2001 From: eClarity Web Solutions Date: Sun, 25 Jun 2017 13:42:30 -0500 Subject: [PATCH 2/3] Update __init__.py --- __init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/__init__.py b/__init__.py index b4ee948..5b3838b 100644 --- a/__init__.py +++ b/__init__.py @@ -19,6 +19,7 @@ import sys import urllib2 import webbrowser +import subprocess from adapt.intent import IntentBuilder from adapt.tools.text.tokenizer import EnglishTokenizer @@ -73,6 +74,11 @@ class DesktopLauncherSkill(MycroftSkill): "LaunchDesktopApplicationIntent").require("LaunchKeyword").require( "Application").build() self.register_intent(launch_intent, self.handle_launch_desktop_app) + + close_intent = IntentBuilder( + "CloseDesktopApplicationIntent").require("CloseKeyword").require( + "Application").build() + self.register_intent(close_intent, self.handle_close_desktop_app) launch_website_intent = IntentBuilder( "LaunchWebsiteIntent").require("LaunchKeyword").require( @@ -89,6 +95,10 @@ class DesktopLauncherSkill(MycroftSkill): apps = self.appmap.get(app_name) if apps and len(apps) > 0: apps[0].launch() + + def handle_close_desktop_app(self, message): + app_name = message.data.get('Application') + subprocess.call( [ "killall", "-9", app_name ] ) def handle_launch_website(self, message): site = message.data.get("Website") From 50d12c4f83e959a2e9de3a32d95c307767d0426e Mon Sep 17 00:00:00 2001 From: eClarity Web Solutions Date: Sun, 25 Jun 2017 13:45:26 -0500 Subject: [PATCH 3/3] Update CloseKeyword.voc --- vocab/en-us/CloseKeyword.voc | 1 - 1 file changed, 1 deletion(-) diff --git a/vocab/en-us/CloseKeyword.voc b/vocab/en-us/CloseKeyword.voc index 2f5c238..c74c795 100644 --- a/vocab/en-us/CloseKeyword.voc +++ b/vocab/en-us/CloseKeyword.voc @@ -1,3 +1,2 @@ close -turn off end