Skip to content
Closed
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
4 changes: 2 additions & 2 deletions hidden/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</toolbarItem>
<toolbarItem implicitItemIdentifier="NSToolbarPrintItem" id="ujw-Ab-7oS"/>
<toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="SEF-Az-T9w"/>
<toolbarItem implicitItemIdentifier="F7DA19CF-BC58-47E1-8140-D04939EE4CA7" label="Custom View" paletteLabel="Custom View" sizingBehavior="auto" id="NIO-JJ-pjq">
<toolbarItem implicitItemIdentifier="F7DA19CF-BC58-47E1-8140-D04939EE4CA7" sizingBehavior="auto" id="NIO-JJ-pjq">
<nil key="toolTip"/>
<segmentedControl key="view" verticalHuggingPriority="750" id="wAJ-zO-0Lg">
<rect key="frame" x="0.0" y="14" width="145" height="23"/>
Expand Down Expand Up @@ -602,7 +602,7 @@ between sections to configure Hidden Bar.</string>
<constraint firstAttribute="bottom" secondItem="RGE-Xv-zm5" secondAttribute="bottom" constant="8" id="BvJ-gy-2qG"/>
<constraint firstItem="EVs-2B-Bqx" firstAttribute="top" secondItem="pJz-eb-ydI" secondAttribute="bottom" constant="16" id="Hpj-p4-UQa"/>
<constraint firstItem="U3K-oK-4ET" firstAttribute="centerY" secondItem="EVs-2B-Bqx" secondAttribute="centerY" id="Mmr-8O-VNL"/>
<constraint firstItem="pJz-eb-ydI" firstAttribute="top" secondItem="TZd-5p-NFL" secondAttribute="top" constant="38" id="Rdj-2r-VTd"/>
<constraint firstItem="pJz-eb-ydI" firstAttribute="top" secondItem="TZd-5p-NFL" secondAttribute="top" constant="38" priority="250" id="Rdj-2r-VTd"/>
<constraint firstItem="uBw-I6-e5a" firstAttribute="leading" secondItem="eBG-Wk-IXv" secondAttribute="trailing" constant="4" id="W2B-29-wzv"/>
<constraint firstItem="eBG-Wk-IXv" firstAttribute="centerY" secondItem="uBw-I6-e5a" secondAttribute="centerY" id="a1h-Oc-pu4"/>
<constraint firstItem="uBw-I6-e5a" firstAttribute="top" secondItem="pJz-eb-ydI" secondAttribute="bottom" constant="16" id="ap3-hF-i14"/>
Expand Down
1 change: 1 addition & 0 deletions hidden/Common/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ enum Preferences {

set {
UserDefaults.standard.set(newValue, forKey: UserDefaults.Key.useFullStatusBarOnExpandEnabled)
NotificationCenter.default.post(Notification(name: .useFullStatusBarToggle))
}
}

Expand Down
1 change: 1 addition & 0 deletions hidden/Extensions/Notification.Name+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ extension Notification.Name {

static let prefsChanged = Notification.Name("prefsChanged")
static let alwayHideToggle = Notification.Name("alwayHideToggle")
static let useFullStatusBarToggle = Notification.Name("useFullStatusBarToggle")
}
10 changes: 10 additions & 0 deletions hidden/Features/Preferences/PreferencesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ class PreferencesViewController: NSViewController {
NotificationCenter.default.addObserver(self, selector: #selector(updateData), name: .prefsChanged, object: nil)
}

private var statusBarBelowToolbar: NSLayoutConstraint?

// The storyboard's fixed top offset predates taller toolbars; keep the mock menu bar below it.
func pinStatusBarBelowToolbar(of window: NSWindow) {
guard let guide = window.contentLayoutGuide as? NSLayoutGuide else { return }
statusBarBelowToolbar?.isActive = false
statusBarBelowToolbar = statusBarStackView.topAnchor.constraint(greaterThanOrEqualTo: guide.topAnchor, constant: 8)
statusBarBelowToolbar?.isActive = true
}

deinit {
// Balance the viewDidLoad observer (PRs #335/#346).
NotificationCenter.default.removeObserver(self, name: .prefsChanged, object: nil)
Expand Down
5 changes: 5 additions & 0 deletions hidden/Features/Preferences/PreferencesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class PreferencesWindowController: NSWindowController {

private var menuSegment: MenuSegment = .general {
didSet {
let size = window?.contentView?.frame.size
updateVC()
if let size { window?.setContentSize(size) }
}
}

Expand All @@ -32,6 +34,7 @@ class PreferencesWindowController: NSWindowController {

override func windowDidLoad() {
super.windowDidLoad()
window?.toolbar?.centeredItemIdentifier = NSToolbarItem.Identifier("F7DA19CF-BC58-47E1-8140-D04939EE4CA7")
updateVC()
}

Expand Down Expand Up @@ -75,6 +78,8 @@ class PreferencesWindowController: NSWindowController {
switch menuSegment {
case .general:
self.window?.contentViewController = preferencesVC
// Pin before the first draw; doing it in viewDidAppear flickers.
if let window { preferencesVC.pinStatusBarBelowToolbar(of: window) }
case .about:
self.window?.contentViewController = aboutVC
}
Expand Down
16 changes: 16 additions & 0 deletions hidden/Features/StatusBar/StatusBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class StatusBarController: MenuBarItemProvider {
setupHoverToExpandIfEnabled()
NotificationCenter.default.addObserver(self, selector: #selector(handleScreenParametersChanged), name: NSApplication.didChangeScreenParametersNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(updateAutoHide), name: .prefsChanged, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(syncActivationPolicyWithFullStatusBar), name: .useFullStatusBarToggle, object: nil)
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
self?.collapseMenuBar()
}
Expand Down Expand Up @@ -299,6 +300,21 @@ class StatusBarController: MenuBarItemProvider {
}
}

// Expand/collapse skips the policy change when the option is off, so sync it on toggle.
@objc private func syncActivationPolicyWithFullStatusBar() {
let wantsRegular = Preferences.useFullStatusBarOnExpandEnabled && !isCollapsed
let policy: NSApplication.ActivationPolicy = wantsRegular ? .regular : .accessory
guard NSApp.activationPolicy() != policy else { return }
let keyWindow = NSApp.isActive ? NSApp.keyWindow : nil
NSApp.setActivationPolicy(policy)
if wantsRegular {
NSApp.activate(ignoringOtherApps: true)
} else if let keyWindow {
// Dropping to .accessory deactivates the app, so bring back the window in use.
DispatchQueue.main.async { keyWindow.bringToFront() }
}
}

private func autoCollapseIfNeeded() {
guard Preferences.isAutoHide else {return}
guard !isCollapsed else { return }
Expand Down
6 changes: 0 additions & 6 deletions hidden/ar.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@
/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "ML6-W4-U8X"; */
"ML6-W4-U8X.paletteLabel" = "عرض مخصص";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "عرض مخصص";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "عرض مخصص";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "خدمات";

Expand Down
6 changes: 0 additions & 6 deletions hidden/de.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@
/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "ML6-W4-U8X"; */
"ML6-W4-U8X.paletteLabel" = "Benutzerdefinierte Ansicht";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "Benutzerdefinierte Ansicht";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "Benutzerdefinierte Ansicht";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "Dienste";

Expand Down
6 changes: 0 additions & 6 deletions hidden/fr.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@
/* Class = "NSMenuItem"; title = "Copy Ruler"; ObjectID = "MkV-Pr-PK5"; */
"MkV-Pr-PK5.title" = "Coller la règle";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "Vue personalisée";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "Vue personalisée";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "Services";

Expand Down
6 changes: 0 additions & 6 deletions hidden/hr.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@
/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "ML6-W4-U8X"; */
"ML6-W4-U8X.paletteLabel" = "Prilagođen prikaz";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "Prilagođen prikaz";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "Prilagođen prikaz";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "Usluge";

Expand Down
9 changes: 0 additions & 9 deletions hidden/ja.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@
/* Class = "NSMenuItem"; title = "Copy Ruler"; ObjectID = "MkV-Pr-PK5"; */
"MkV-Pr-PK5.title" = "Copy Ruler";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "Custom View";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "Custom View";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "サービス";

Expand Down Expand Up @@ -341,9 +335,6 @@
/* Class = "NSMenuItem"; title = "Use None"; ObjectID = "cDB-IK-hbR"; */
"cDB-IK-hbR.title" = "Use None";

/* Class = "NSButtonCell"; title = "Keep icon in dock"; ObjectID = "cUd-D7-0WY"; */
"cUd-D7-0WY.title" = "ドックにアイコンを隠さない";

/* Class = "NSTextFieldCell"; title = "Hidden"; ObjectID = "cXt-8R-PHo"; */
"cXt-8R-PHo.title" = "非表示";

Expand Down
6 changes: 0 additions & 6 deletions hidden/pl.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@
/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "ML6-W4-U8X"; */
"ML6-W4-U8X.paletteLabel" = "Widok niestandardowy";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "Widok niestandardowy";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "Widok niestandardowy";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "Usługi";

Expand Down
6 changes: 0 additions & 6 deletions hidden/vi.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@
/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "ML6-W4-U8X"; */
"ML6-W4-U8X.paletteLabel" = "Custom View";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "Custom View";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "Custom View";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "Services";

Expand Down
9 changes: 0 additions & 9 deletions hidden/zh-Hans.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@
/* Class = "NSMenuItem"; title = "Copy Ruler"; ObjectID = "MkV-Pr-PK5"; */
"MkV-Pr-PK5.title" = "Copy Ruler";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "Custom View";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "Custom View";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "Services";

Expand Down Expand Up @@ -341,9 +335,6 @@
/* Class = "NSMenuItem"; title = "Use None"; ObjectID = "cDB-IK-hbR"; */
"cDB-IK-hbR.title" = "Use None";

/* Class = "NSButtonCell"; title = "Keep icon in dock"; ObjectID = "cUd-D7-0WY"; */
"cUd-D7-0WY.title" = "在程序坞中保留图标";

/* Class = "NSTextFieldCell"; title = "Hidden"; ObjectID = "cXt-8R-PHo"; */
"cXt-8R-PHo.title" = "隐藏";

Expand Down
6 changes: 0 additions & 6 deletions hidden/zh-Hant.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@
/* Class = "NSMenuItem"; title = "Copy Ruler"; ObjectID = "MkV-Pr-PK5"; */
"MkV-Pr-PK5.title" = "拷貝尺標";

/* Class = "NSToolbarItem"; label = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.label" = "自訂顯示方式";

/* Class = "NSToolbarItem"; paletteLabel = "Custom View"; ObjectID = "NIO-JJ-pjq"; */
"NIO-JJ-pjq.paletteLabel" = "自訂顯示方式";

/* Class = "NSMenuItem"; title = "Services"; ObjectID = "NMo-om-nkz"; */
"NMo-om-nkz.title" = "服務";

Expand Down