Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions English.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,6 @@
<object class="NSCustomObject" id="82089617">
<string key="NSClassName">ApplicationController</string>
</object>
<object class="NSCustomObject" id="411804446">
<string key="NSClassName">GlobalHotkeys</string>
</object>
<object class="NSCustomObject" id="269446200">
<string key="NSClassName">RemoteHostsManager</string>
</object>
Expand Down Expand Up @@ -1768,11 +1765,6 @@
<reference key="object" ref="72836876"/>
<reference key="parent" ref="110575045"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">586</int>
<reference key="object" ref="411804446"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">589</int>
<reference key="object" ref="124828754"/>
Expand Down
54 changes: 23 additions & 31 deletions Gas Mask.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Source/ApplicationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,10 @@ - (void)decreaseBusyThreadsCount:(NSNotification *)notification

- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
(void)[GlobalShortcuts shared]; // Register global hotkeys

[NSApp setServicesProvider:self];

[self initStructure];

NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
Expand Down
27 changes: 0 additions & 27 deletions Source/GlobalHotkeys.h

This file was deleted.

145 changes: 0 additions & 145 deletions Source/GlobalHotkeys.m

This file was deleted.

38 changes: 0 additions & 38 deletions Source/Hotkey.h

This file was deleted.

67 changes: 0 additions & 67 deletions Source/Hotkey.m

This file was deleted.

1 change: 0 additions & 1 deletion Source/Swift/GasMask-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#import "Network.h"
#import "HostsMainController.h"
#import "RemoteHostsController.h"
#import "Hotkey.h"
#import "Preferences.h"
#import "Preferences+Remote.h"
#import "LoginItem.h"
30 changes: 30 additions & 0 deletions Source/Swift/GlobalShortcuts.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Foundation
import MASShortcut

/// Registers global keyboard shortcuts using `MASShortcutBinder`.
///
/// Replaces the old `GlobalHotkeys` ObjC class that used the Carbon Event Manager directly.
/// Call `GlobalShortcuts.shared` once at app launch to register all hotkeys.
@objc final class GlobalShortcuts: NSObject {
@objc static let shared = GlobalShortcuts()

private override init() {
super.init()
guard let binder = MASShortcutBinder.shared() else { return }
binder.bindingOptions = [
NSBindingOption.valueTransformerName.rawValue: MASDictionaryTransformerName
]

let nc = NotificationCenter.default
// Notification names from Gas_Mask_Prefix.pch lines 42–44 (not importable in Swift)
binder.bindShortcut(withDefaultsKey: ActivatePreviousFilePrefKey) {
nc.post(name: .init("activatePreviousFileNotification"), object: nil)
}
binder.bindShortcut(withDefaultsKey: ActivateNextFilePrefKey) {
nc.post(name: .init("activateNextFileNotification"), object: nil)
}
binder.bindShortcut(withDefaultsKey: UpdateAndSynchronizePrefKey) {
nc.post(name: .init("updateAndSynchronizeNotification"), object: nil)
}
}
}
Loading