Skip to content

Commit

Permalink
Merge pull request #96 from code918/master
Browse files Browse the repository at this point in the history
Added toggle function to custom url action.
  • Loading branch information
newmarcel authored Dec 24, 2017
2 parents 8ec15a7 + de89126 commit 5cfcf18
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions KeepingYouAwake/KYAAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ - (void)configureEventHandler
[KYAEventHandler.defaultHandler registerActionNamed:@"deactivate" block:^(KYAEvent *event) {
[weakSelf terminateTimer];
}];
[KYAEventHandler.defaultHandler registerActionNamed:@"toggle" block:^(KYAEvent *event) {
[self.statusItemController toggle];
}];
}

#pragma mark - KYAStatusItemControllerDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface KYAStatusItemController : NSObject

/**
Toggle
*/
- (void)toggle;

/**
The underlying system status bar item.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ - (void)configureStatusItem
self.activeAppearanceEnabled = NO;
}

- (void)toggle
{
[self toggleStatus:nil];
}

- (void)toggleStatus:(id)sender
{
KYA_AUTO delegate = self.delegate;
Expand Down

0 comments on commit 5cfcf18

Please sign in to comment.