Skip to content

Commit

Permalink
Hotfix: Disable macOS autostart due to comptability issue. #81
Browse files Browse the repository at this point in the history
  • Loading branch information
m3nu committed Dec 5, 2018
1 parent 5a01322 commit d8de320
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/vorta/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def init_db(con):
if sys.platform == 'darwin':
settings += [
{'key': 'autostart', 'value': False, 'type': 'checkbox',
'label': 'Add Vorta to Login Items in Preferences > Users and Groups > Login Items.'},
'label': 'Add Vorta to Login Items in Preferences > Users and Groups > Login Items. (not implemented)'},
{'key': 'enable_notifications', 'value': True, 'type': 'checkbox',
'label': 'Display notifications when background tasks fail.'},
{'key': 'check_for_updates', 'value': True, 'type': 'checkbox',
Expand Down
32 changes: 17 additions & 15 deletions src/vorta/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,21 @@ def set_tray_icon(tray, active=False):

def open_app_at_startup(enabled=True):
if sys.platform == 'darwin':
print('Not implemented due to conflict with keyring package.')
# From https://stackoverflow.com/questions/26213884/cocoa-add-app-to-startup-in-sandbox-using-pyobjc
from Foundation import NSDictionary
from Cocoa import NSBundle, NSURL
from CoreFoundation import kCFAllocatorDefault
from LaunchServices import (LSSharedFileListCreate, kLSSharedFileListSessionLoginItems,
LSSharedFileListInsertItemURL, kLSSharedFileListItemHidden,
kLSSharedFileListItemLast, LSSharedFileListItemRemove)
app_path = NSBundle.mainBundle().bundlePath()
url = NSURL.alloc().initFileURLWithPath_(app_path)
login_items = LSSharedFileListCreate(kCFAllocatorDefault, kLSSharedFileListSessionLoginItems, None)
props = NSDictionary.dictionaryWithObject_forKey_(True, kLSSharedFileListItemHidden)

new_item = LSSharedFileListInsertItemURL(login_items, kLSSharedFileListItemLast,
None, None, url, props, None)
if not enabled:
LSSharedFileListItemRemove(login_items, new_item)
# from Foundation import NSDictionary
# from Cocoa import NSBundle, NSURL
# from CoreFoundation import kCFAllocatorDefault
# from LaunchServices import (LSSharedFileListCreate, kLSSharedFileListSessionLoginItems,
# LSSharedFileListInsertItemURL, kLSSharedFileListItemHidden,
# kLSSharedFileListItemLast, LSSharedFileListItemRemove)
#
# app_path = NSBundle.mainBundle().bundlePath()
# url = NSURL.alloc().initFileURLWithPath_(app_path)
# login_items = LSSharedFileListCreate(kCFAllocatorDefault, kLSSharedFileListSessionLoginItems, None)
# props = NSDictionary.dictionaryWithObject_forKey_(True, kLSSharedFileListItemHidden)
#
# new_item = LSSharedFileListInsertItemURL(login_items, kLSSharedFileListItemLast,
# None, None, url, props, None)
# if not enabled:
# LSSharedFileListItemRemove(login_items, new_item)
3 changes: 2 additions & 1 deletion vorta.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ a = Analysis(['src/vorta/__main__.py'],
('src/vorta/assets/UI/*', 'assets/UI'),
('src/vorta/assets/icons/*', 'assets/icons'),
],
hiddenimports=['vorta.views.collection_rc'],
hiddenimports=['vorta.views.collection_rc',
],
hookspath=[],
runtime_hooks=[],
excludes=[],
Expand Down

0 comments on commit d8de320

Please sign in to comment.