-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement custom protocol association support (#3000)
* implement MacOS openFile/openFiles events * wip: windows file association * fix macro import * add file icon copy * try copy icon * keep only required part of scripts * update config schema * fix json * set fileAssociation for mac via config * proper iconName handling * add fileAssociation icon generator * fix file association icons bundle * don't break compatibility * remove mimeType as not supported linux for now * add documentation * adjust config schema * restore formatting * try implement single instance lock with params passing * fix focusing * fix focusing * formatting * use channel buffer for second instance events * handle errors * add comment * remove unused option in file association * wip: linux single instance lock * wip: linux single instance * some experiments with making window active * try to use unminimise * remove unused * try present for window * try present for window * fix build * cleanup * cleanup * implement single instance lock on mac os * implement proper show for windows * proper unmimimise * get rid of openFiles mac os. change configuration structure * remove unused channel * remove unused function * add documentation for single instance lock * add PR link * wip mac os deeplinks * put custom url listner on top to catch link on app opening * put custom url listner on top to catch link on app opening * try add custom url windows * adjust custom url * add docs * merge master * update documentation * add comment for darwin * add PR link * change naming * change naming * change naming * change naming * fix formatting * fix naming * Fix typo --------- Co-authored-by: Lea Anthony <[email protected]>
- Loading branch information
1 parent
e960798
commit ae688aa
Showing
12 changed files
with
346 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef CustomProtocol_h | ||
#define CustomProtocol_h | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
extern void HandleCustomProtocol(char*); | ||
|
||
@interface CustomProtocolSchemeHandler : NSObject | ||
+ (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent; | ||
@end | ||
|
||
void StartCustomProtocolHandler(void); | ||
|
||
#endif /* CustomProtocol_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "CustomProtocol.h" | ||
|
||
@implementation CustomProtocolSchemeHandler | ||
+ (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent { | ||
[event paramDescriptorForKeyword:keyDirectObject]; | ||
|
||
NSString *urlStr = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; | ||
|
||
HandleCustomProtocol((char*)[[[event paramDescriptorForKeyword:keyDirectObject] stringValue] UTF8String]); | ||
} | ||
@end | ||
|
||
void StartCustomProtocolHandler(void) { | ||
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; | ||
|
||
[appleEventManager setEventHandler:[CustomProtocolSchemeHandler class] | ||
andSelector:@selector(handleGetURLEvent:withReplyEvent:) | ||
forEventClass:kInternetEventClass | ||
andEventID: kAEGetURL]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.