Skip to content

Commit 2d23c6f

Browse files
authored
Merge pull request #528 from benwoo1110/context-menu-setting
Add config option for right click on menubar
2 parents 39845b5 + eb41f1a commit 2d23c6f

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

Ice/Events/EventManager.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ extension EventManager {
256256
private func handleShowRightClickMenu() {
257257
guard
258258
let appState,
259+
appState.settingsManager.advancedSettingsManager.showContextMenuOnRightClick,
259260
isMouseInsideEmptyMenuBarSpace,
260261
let mouseLocation = MouseCursor.locationAppKit
261262
else {

Ice/Settings/SettingsManagers/AdvancedSettingsManager.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ final class AdvancedSettingsManager: ObservableObject {
3434
/// the user is dragging items in the menu bar.
3535
@Published var showAllSectionsOnUserDrag = true
3636

37+
@Published var showContextMenuOnRightClick = true
38+
3739
/// Storage for internal observers.
3840
private var cancellables = Set<AnyCancellable>()
3941

@@ -57,6 +59,7 @@ final class AdvancedSettingsManager: ObservableObject {
5759
Defaults.ifPresent(key: .showOnHoverDelay, assign: &showOnHoverDelay)
5860
Defaults.ifPresent(key: .tempShowInterval, assign: &tempShowInterval)
5961
Defaults.ifPresent(key: .showAllSectionsOnUserDrag, assign: &showAllSectionsOnUserDrag)
62+
Defaults.ifPresent(key: .showContextMenuOnRightClick, assign: &showContextMenuOnRightClick)
6063
}
6164

6265
private func configureCancellables() {
@@ -111,6 +114,13 @@ final class AdvancedSettingsManager: ObservableObject {
111114
}
112115
.store(in: &c)
113116

117+
$showContextMenuOnRightClick
118+
.receive(on: DispatchQueue.main)
119+
.sink { showAll in
120+
Defaults.set(showAll, forKey: .showContextMenuOnRightClick)
121+
}
122+
.store(in: &c)
123+
114124
cancellables = c
115125
}
116126
}

Ice/Settings/SettingsPanes/AdvancedSettingsPane.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct AdvancedSettingsPane: View {
3232
hideApplicationMenus
3333
showSectionDividers
3434
showAllSectionsOnUserDrag
35+
showContextMenuOnRightClick
3536
}
3637
IceSection {
3738
enableAlwaysHiddenSection
@@ -138,6 +139,11 @@ struct AdvancedSettingsPane: View {
138139
Toggle("Show all sections when Command + dragging menu bar items", isOn: manager.bindings.showAllSectionsOnUserDrag)
139140
}
140141

142+
@ViewBuilder
143+
private var showContextMenuOnRightClick: some View {
144+
Toggle("Show context menu on right click", isOn: manager.bindings.showContextMenuOnRightClick)
145+
}
146+
141147
@ViewBuilder
142148
private var allPermissions: some View {
143149
ForEach(appState.permissionsManager.allPermissions) { permission in

Ice/Utilities/Defaults.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ extension Defaults {
165165
case showOnHoverDelay = "ShowOnHoverDelay"
166166
case tempShowInterval = "TempShowInterval"
167167
case showAllSectionsOnUserDrag = "ShowAllSectionsOnUserDrag"
168+
case showContextMenuOnRightClick = "ShowContextMenuOnRightClick"
168169

169170
// MARK: Menu Bar Appearance Settings
170171

0 commit comments

Comments
 (0)