Merge branch 'feat-macos-open-with' of https://github.com/page-down/kitty
This commit is contained in:
commit
aa8b23395f
@ -520,6 +520,19 @@ cocoa_send_notification(PyObject *self UNUSED, PyObject *args) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)openFileURLs:(NSPasteboard*)pasteboard
|
||||
userData:(NSString *) UNUSED userData error:(NSError **) UNUSED error {
|
||||
NSDictionary *options = @{ NSPasteboardURLReadingFileURLsOnlyKey: @YES };
|
||||
NSArray *urlArray = [pasteboard readObjectsForClasses:[NSArray arrayWithObject:[NSURL class]] options:options];
|
||||
for (NSURL *url in urlArray) {
|
||||
NSString *path = [url path];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
|
||||
set_cocoa_pending_action(LAUNCH_URL, [[[NSURL fileURLWithPath:path] absoluteString] UTF8String]);
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// global menu {{{
|
||||
|
||||
10
setup.py
10
setup.py
@ -1006,21 +1006,19 @@ def macos_info_plist() -> bytes:
|
||||
{
|
||||
'CFBundleTypeName': 'Text files',
|
||||
'LSItemContentTypes': ['public.text'],
|
||||
'LSTypeIsPackage': False,
|
||||
'CFBundleTypeRole': 'Editor',
|
||||
'LSHandlerRank': 'Alternate',
|
||||
},
|
||||
{
|
||||
'CFBundleTypeName': 'Image files',
|
||||
'LSItemContentTypes': ['public.image'],
|
||||
'LSTypeIsPackage': False,
|
||||
'CFBundleTypeRole': 'Viewer',
|
||||
'LSHandlerRank': 'Alternate',
|
||||
},
|
||||
# Allows dragging arbitrary files to kitty Dock icon, and list kitty in the Open With context menu.
|
||||
{
|
||||
'CFBundleTypeName': 'All files',
|
||||
'LSItemContentTypes': ['public.content', 'public.data'],
|
||||
'LSItemContentTypes': ['public.archive', 'public.content', 'public.data'],
|
||||
'CFBundleTypeRole': 'Editor',
|
||||
'LSHandlerRank': 'Alternate',
|
||||
},
|
||||
@ -1092,6 +1090,12 @@ def macos_info_plist() -> bytes:
|
||||
'NSRequiredContext': {'NSTextContent': 'FilePath'},
|
||||
'NSSendTypes': ['NSFilenamesPboardType', 'public.plain-text'],
|
||||
},
|
||||
{
|
||||
'NSMenuItem': {'default': f'Open with {appname}'},
|
||||
'NSMessage': 'openFileURLs',
|
||||
'NSRequiredContext': {'NSTextContent': 'FilePath'},
|
||||
'NSSendTypes': ['NSFilenamesPboardType', 'public.plain-text'],
|
||||
},
|
||||
]
|
||||
|
||||
pl = dict(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user