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
24 changes: 24 additions & 0 deletions Ice/Events/EventManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ final class EventManager {
guard let self else {
return event
}
if handleOpenSettingsFallback(with: event) {
return event
}
switch event.type {
case .leftMouseDown:
handleShowOnClick()
Expand Down Expand Up @@ -265,6 +268,27 @@ extension EventManager {
appState.menuBarManager.showRightClickMenu(at: mouseLocation)
}

// MARK: Handle Open Settings Fallback

private func handleOpenSettingsFallback(with event: NSEvent) -> Bool {
guard
let appState,
!appState.settingsManager.advancedSettingsManager.showContextMenuOnRightClick,
event.type == .leftMouseDown || event.type == .rightMouseDown,
isMouseInsideMenuBar
else {
return false
}

let modifiers = event.modifierFlags.intersection(.deviceIndependentFlagsMask)
guard modifiers.contains([.option, .command]) else {
return false
}

appState.appDelegate?.openSettingsWindow()
return true
}

// MARK: Handle Prevent Show On Hover

private func handlePreventShowOnHover(with event: NSEvent) {
Expand Down
12 changes: 10 additions & 2 deletions Ice/MenuBar/ControlItem/ControlItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,17 @@ final class ControlItem {
else {
return
}
let modifiers = event.modifierFlags.intersection(.deviceIndependentFlagsMask)
let showContextMenus = appState.settingsManager.advancedSettingsManager.showContextMenuOnRightClick
switch event.type {
case .leftMouseDown, .leftMouseUp:
if NSEvent.modifierFlags == .control {
if
modifiers == .control,
showContextMenus
{
statusItem.showMenu(createMenu(with: appState))
} else if
NSEvent.modifierFlags == .option,
modifiers == .option,
appState.settingsManager.advancedSettingsManager.canToggleAlwaysHiddenSection
{
if let alwaysHiddenSection = appState.menuBarManager.section(withName: .alwaysHidden) {
Expand All @@ -409,6 +414,9 @@ final class ControlItem {
section?.toggle()
}
case .rightMouseUp:
guard showContextMenus else {
return
}
statusItem.showMenu(createMenu(with: appState))
default:
break
Expand Down
3 changes: 2 additions & 1 deletion Ice/Settings/SettingsPanes/AdvancedSettingsPane.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ struct AdvancedSettingsPane: View {

@ViewBuilder
private var showContextMenuOnRightClick: some View {
Toggle("Show context menu on right click", isOn: manager.bindings.showContextMenuOnRightClick)
Toggle("Show Ice context menus on right click", isOn: manager.bindings.showContextMenuOnRightClick)
.annotation("Disable this to ignore Ice right-click menus for better compatibility with apps like DynamicLake. When disabled, Option + Command + click in the menu bar opens Ice settings.")
}

@ViewBuilder
Expand Down