Merge pull request #2 from eClarity/master

Add close application feature
This commit is contained in:
Augusto Monteiro 2017-06-26 09:43:44 -04:00 committed by GitHub
commit 2de1b3abb3
2 changed files with 12 additions and 0 deletions

View File

@ -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")

View File

@ -0,0 +1,2 @@
close
end