Skip to content

Commit 64ad214

Browse files
committed
feat: add double-click support for always-hidden section in Show on click mode
Double-clicking on the menu bar now reveals the always-hidden section (if enabled), matching the behavior of double-clicking the Ice icon.
1 parent 0f90c92 commit 64ad214

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

Thaw/Events/HIDEventManager.swift

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ final class HIDEventManager: ObservableObject {
7171
}
7272
switch event.type {
7373
case .leftMouseDown:
74-
handleShowOnClick(appState: appState, screen: screen)
74+
handleShowOnClick(appState: appState, screen: screen, isDoubleClick: event.clickCount > 1)
7575
handleSmartRehide(with: event, appState: appState, screen: screen)
7676
case .rightMouseDown:
7777
handleSecondaryContextMenu(appState: appState, screen: screen)
@@ -265,7 +265,7 @@ final class HIDEventManager: ObservableObject {
265265
extension HIDEventManager {
266266
// MARK: Handle Show On Click
267267

268-
private func handleShowOnClick(appState: AppState, screen: NSScreen) {
268+
private func handleShowOnClick(appState: AppState, screen: NSScreen, isDoubleClick: Bool = false) {
269269
guard
270270
appState.settings.general.showOnClick,
271271
isMouseInsideEmptyMenuBarSpace(appState: appState, screen: screen)
@@ -274,30 +274,34 @@ extension HIDEventManager {
274274
}
275275

276276
Task {
277+
if isDoubleClick {
278+
if let alwaysHiddenSection = appState.menuBarManager.section(withName: .alwaysHidden),
279+
alwaysHiddenSection.isEnabled
280+
{
281+
alwaysHiddenSection.show()
282+
return
283+
}
284+
}
285+
277286
if NSEvent.modifierFlags == .control {
278287
handleSecondaryContextMenu(appState: appState, screen: screen)
279288
return
280289
}
281290

282-
let targetSection: MenuBarSection
291+
if NSEvent.modifierFlags == .option {
292+
if let alwaysHiddenSection = appState.menuBarManager.section(withName: .alwaysHidden),
293+
alwaysHiddenSection.isEnabled
294+
{
295+
alwaysHiddenSection.show()
296+
return
297+
}
298+
}
283299

284-
if NSEvent.modifierFlags == .option, let alwaysHiddenSection = appState.menuBarManager.section(
285-
withName: .alwaysHidden
286-
),
287-
alwaysHiddenSection.isEnabled
288-
{
289-
targetSection = alwaysHiddenSection
290-
} else if let hiddenSection = appState.menuBarManager.section(
291-
withName: .hidden
292-
),
293-
hiddenSection.isEnabled
300+
if let hiddenSection = appState.menuBarManager.section(withName: .hidden),
301+
hiddenSection.isEnabled
294302
{
295-
targetSection = hiddenSection
296-
} else {
297-
return
303+
hiddenSection.toggle()
298304
}
299-
300-
targetSection.toggle()
301305
}
302306
}
303307

0 commit comments

Comments
 (0)