mirror of
https://github.com/JuanCanham/skill-desktop-launcher.git
synced 2024-12-03 13:15:54 +00:00
Improve closing of applications
Try to close using name, if that fails try using the command in the Exec field in the Desktop file.
This commit is contained in:
parent
78557ec064
commit
e5677e4730
10
__init__.py
10
__init__.py
@ -69,7 +69,15 @@ class DesktopLauncherSkill(MycroftSkill):
|
||||
def handle_close_desktop_app(self, message):
|
||||
"""Close application using killall -9."""
|
||||
app_name = message.data.get('Application')
|
||||
subprocess.call(['killall', '-9', app_name])
|
||||
|
||||
self.log.info('Killing {}'.format(app_name))
|
||||
if subprocess.call(['killall', '-9', app_name]):
|
||||
# Couldn't be killed try to get executable from desktop file
|
||||
apps = self.appmap.get(app_name)
|
||||
# Try to find executable name
|
||||
if apps:
|
||||
app_name = apps[0].get_string('Exec')
|
||||
subprocess.call(['killall', '-9', app_name])
|
||||
|
||||
@intent_handler(IntentBuilder('LaunchWebsiteIntent')
|
||||
.require('LaunchKeyword').require('Website'))
|
||||
|
Loading…
Reference in New Issue
Block a user