Skip to content

Commit

Permalink
[Close #1] Add quark.setLaunchAtLogin
Browse files Browse the repository at this point in the history
  • Loading branch information
xhacker committed Jan 6, 2015
1 parent 935cd60 commit 9241360
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ platform :osx, '10.9'

source 'https://github.com/CocoaPods/Specs.git'

pod 'MASShortcut', :git => 'https://github.com/xhacker/MASShortcut.git', :branch => 'menubar-webkit'
pod 'MASShortcut', :git => 'https://github.com/xhacker/MASShortcut.git', :branch => 'menubar-webkit'
pod 'RHPreferences', :head
pod 'Sparkle', '~> 1.8.0'
pod 'ISO8601DateFormatter', '~> 0.7'
pod 'LaunchAtLoginController', :podspec => 'https://raw.githubusercontent.com/jashephe/LaunchAtLoginController/master/LaunchAtLoginController.podspec'
5 changes: 5 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
PODS:
- ISO8601DateFormatter (0.7)
- LaunchAtLoginController (1.0.0)
- MASShortcut (1.2.3)
- RHPreferences (HEAD based on 1.0.0)
- Sparkle (1.8.0)

DEPENDENCIES:
- ISO8601DateFormatter (~> 0.7)
- LaunchAtLoginController (from `https://raw.githubusercontent.com/jashephe/LaunchAtLoginController/master/LaunchAtLoginController.podspec`)
- MASShortcut (from `https://github.com/xhacker/MASShortcut.git`, branch `menubar-webkit`)
- RHPreferences (HEAD)
- Sparkle (~> 1.8.0)

EXTERNAL SOURCES:
LaunchAtLoginController:
:podspec: https://raw.githubusercontent.com/jashephe/LaunchAtLoginController/master/LaunchAtLoginController.podspec
MASShortcut:
:branch: menubar-webkit
:git: https://github.com/xhacker/MASShortcut.git
Expand All @@ -22,6 +26,7 @@ CHECKOUT OPTIONS:

SPEC CHECKSUMS:
ISO8601DateFormatter: 59731cd880cf87e71b4fa95f0d6b713dcbc4cbce
LaunchAtLoginController: ebe8f91297f8bb68c1085b431308871d7b05128c
MASShortcut: a1e29fd34567fcd249d00648548924c8e7639474
RHPreferences: d0215102b7b8cd9f501655e5e7db2551ef4dc0e5
Sparkle: 5eb20bb37ca21e471dab8417dee880198d905327
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ quark.setMenubarIcon("data:image/png;base64,iVBORw...SuQmCC")
quark.setMenubarHighlightedIcon("data:image/png;base64,iVBORw...SuQmCC")
quark.resetMenubarIcon()

// Auto start with system
quark.setAutoStart(true) // not implemented yet
// Auto launch at login
quark.setLaunchAtLogin(true)

// Send system notification
quark.notify({
Expand Down Expand Up @@ -182,6 +182,7 @@ Used third-party libraries:
* [MASShortcut](https://github.com/shpakovski/MASShortcut) by [@shpakovski](https://github.com/shpakovski)
* [RHPreferences](https://github.com/heardrwt/RHPreferences) by [@heardrwt](https://github.com/heardrwt)
* [Sparkle](https://github.com/sparkle-project/Sparkle) by [contributors](https://github.com/sparkle-project/Sparkle/graphs/contributors)
* [LaunchAtLoginController](https://github.com/jashephe/LaunchAtLoginController) by [@Mozketo](https://github.com/Mozketo), modified by [@tgunr](https://github.com/tgunr) and [@jashephe](https://github.com/jashephe).
## Contribution
Expand Down
11 changes: 11 additions & 0 deletions quark-shell/QSHWebViewDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#import <RHPreferences.h>
#import <Sparkle/Sparkle.h>
#import <ISO8601DateFormatter.h>
#import <LaunchAtLoginController.h>

static NSString * const kWebScriptNamespace = @"quark";
static const NSInteger kPreferencesDefaultHeight = 192;
Expand Down Expand Up @@ -70,6 +71,7 @@ + (BOOL)isSelectorExcludedFromWebScript:(SEL)selector
selector == @selector(changeIcon:) ||
selector == @selector(changeHighlightedIcon:) ||
selector == @selector(resetMenubarIcon) ||
selector == @selector(setLaunchAtLogin:) ||
selector == @selector(notify:) ||
selector == @selector(removeAllScheduledNotifications) ||
selector == @selector(removeAllDeliveredNotifications) ||
Expand Down Expand Up @@ -133,6 +135,9 @@ + (NSString *)webScriptNameForSelector:(SEL)selector
else if (selector == @selector(showMenu:)) {
result = @"showMenu";
}
else if (selector == @selector(setLaunchAtLogin:)) {
result = @"setLaunchAtLogin";
}

return result;
}
Expand Down Expand Up @@ -205,6 +210,12 @@ - (void)resetMenubarIcon
}
}

- (void)setLaunchAtLogin:(BOOL)launchAtLogin
{
LaunchAtLoginController *launchController = [[LaunchAtLoginController alloc] init];
launchController.launchAtLogin = launchAtLogin;
}

- (void)notify:(WebScriptObject *)obj
{
QSHWebScriptObjectConverter *converter = [[QSHWebScriptObjectConverter alloc] initWithWebView:self.webView];
Expand Down

0 comments on commit 9241360

Please sign in to comment.