mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 05:13:21 -07:00
Check if MacOS login item exists before adding
This commit is contained in:
parent
cac9e0b164
commit
e546689e01
1 changed files with 13 additions and 5 deletions
|
@ -108,9 +108,13 @@ def set_startup():
|
|||
if plexpy.INSTALL_TYPE == 'macos':
|
||||
if plexpy.CONFIG.LAUNCH_STARTUP:
|
||||
try:
|
||||
subprocess.Popen(['osascript', '-e',
|
||||
'tell application "System Events" to make login item at end with properties '
|
||||
'{path:"/Applications/Tautulli.app", hidden:false}'])
|
||||
subprocess.Popen(['osascript',
|
||||
'-e', 'tell application "System Events"',
|
||||
'-e', 'get the name of every login item',
|
||||
'-e', 'if not exists login item "Tautulli" then '
|
||||
'make login item at end with properties '
|
||||
'{path:"/Applications/Tautulli.app", hidden:false}',
|
||||
'-e', 'end tell'])
|
||||
logger.info("Added Tautulli to MacOS login items.")
|
||||
return True
|
||||
except OSError as e:
|
||||
|
@ -119,8 +123,12 @@ def set_startup():
|
|||
|
||||
else:
|
||||
try:
|
||||
subprocess.Popen(['osascript', '-e',
|
||||
'tell application "System Events" to delete login item "Tautulli"'])
|
||||
subprocess.Popen(['osascript',
|
||||
'-e', 'tell application "System Events"',
|
||||
'-e', 'get the name of every login item',
|
||||
'-e', 'if exists login item "Tautulli" then '
|
||||
'delete login item "Tautulli"',
|
||||
'-e', 'end tell'])
|
||||
logger.info("Removed Tautulli from MacOS login items.")
|
||||
return True
|
||||
except OSError as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue