Skip to content
Open
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
53 changes: 29 additions & 24 deletions boringNotch/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2449,16 +2449,6 @@
}
}
},
"Changing the app language requires restarting Boring Notch." : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Changing the app language requires restarting Boring Notch."
}
}
}
},
"Change media with horizontal gestures" : {
"localizations" : {
"de" : {
Expand Down Expand Up @@ -2505,6 +2495,16 @@
}
}
},
"Changing the app language requires restarting Boring Notch." : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Changing the app language requires restarting Boring Notch."
}
}
}
},
"Charging" : {
"localizations" : {
"cs" : {
Expand Down Expand Up @@ -6893,6 +6893,16 @@
}
}
},
"Later" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Later"
}
}
}
},
"Launch at login" : {
"localizations" : {
"fr" : {
Expand All @@ -6915,16 +6925,6 @@
}
}
},
"Later" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Later"
}
}
}
},
"Layout Preview" : {
"localizations" : {
"de" : {
Expand Down Expand Up @@ -9559,6 +9559,7 @@
}
},
"OSD" : {
"extractionState" : "stale",
"localizations" : {
"fr" : {
"stringUnit" : {
Expand Down Expand Up @@ -10055,9 +10056,6 @@
},
"Real-time audio waveform" : {

},
"Requires macOS 14.2 or later. Update macOS to enable real-time audio waveform." : {

},
"Release name" : {
"localizations" : {
Expand Down Expand Up @@ -10441,6 +10439,9 @@
}
}
}
},
"Requires macOS 14.2 or later. Update macOS to enable real-time audio waveform." : {

},
"Reset to Defaults" : {
"localizations" : {
Expand Down Expand Up @@ -12721,6 +12722,10 @@
}
}
},
"Switch Tab:" : {
"comment" : "Label for a keyboard shortcut to switch between tabs.",
"isCommentAutoGenerated" : true
},
"System" : {
"localizations" : {
"en" : {
Expand Down Expand Up @@ -14153,4 +14158,4 @@
}
},
"version" : "1.1"
}
}
1 change: 1 addition & 0 deletions boringNotch/Shortcuts/ShortcutConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ extension KeyboardShortcuts.Name {
static let increaseBacklight = Self("increaseBacklight", default: .init(.f2, modifiers: [.command]))
static let toggleSneakPeek = Self("toggleSneakPeek", default: .init(.h, modifiers: [.command, .shift]))
static let toggleNotchOpen = Self("toggleNotchOpen", default: .init(.i, modifiers: [.command, .shift]))
static let switchTab = Self("switchTab", default: .init(.y, modifiers: [.command, .shift]))
}
48 changes: 48 additions & 0 deletions boringNotch/boringNotchApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,54 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}

KeyboardShortcuts.onKeyDown(for: .switchTab) { [weak self] in
Task { [weak self] in
guard let self = self else { return }

let mouseLocation = NSEvent.mouseLocation
var viewModel = self.vm

if Defaults[.showOnAllDisplays] {
for screen in NSScreen.screens {
if screen.frame.contains(mouseLocation) {
if let uuid = screen.displayUUID, let screenViewModel = self.viewModels[uuid] {
viewModel = screenViewModel
break
}
}
}
}

await MainActor.run {
withAnimation(.smooth) {
if self.coordinator.currentView == .home {
self.coordinator.currentView = .shelf
} else {
self.coordinator.currentView = .home
}
}
}

if viewModel.notchState == .closed {
var didOpen = false
await MainActor.run {
didOpen = viewModel.open()
}
guard didOpen else { return }

self.closeNotchTask?.cancel()
self.closeNotchTask = Task { [weak viewModel] in
do {
try await Task.sleep(for: .seconds(3))
await MainActor.run {
viewModel?.close()
}
} catch { }
}
}
}
}

KeyboardShortcuts.onKeyDown(for: .toggleNotchOpen) { [weak self] in
Task { [weak self] in
guard let self = self else { return }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ struct Shortcuts: View {
Section {
KeyboardShortcuts.Recorder("Toggle Notch Open:", name: .toggleNotchOpen)
}
Section {
KeyboardShortcuts.Recorder("Switch Tab:", name: .switchTab)
}
}
.accentColor(.effectiveAccent)
.navigationTitle("Shortcuts")
Expand Down