Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

### Added
- Settings › General › "App language": follow macOS, or pick any language the build ships. The list uses each language's own name, so 简体中文 is findable while the app is in another language. The choice is stored where macOS keeps an app's own language, so it takes effect after Hidden Bar restarts; macOS's per-app language panel writes the same value. The new row is translated in all 13 languages.
- Settings › Advanced › "Restore settings from the App Store version" (direct build): copies the settings the App Store version saved back into this version, any time, after a confirmation. Hidden Bar also keeps a private copy of those settings in `~/Library/Application Support/Hidden Bar/` the first time it can read them, so they stay reachable if macOS later blocks the App Store container or the App Store copy is removed.

### Fixed
Expand All @@ -12,6 +13,7 @@

### Added
- Direct build on macOS 27: when a click on the arrow or the hotkey hides nothing, a short note under the arrow says why and what to do (running outside Applications, an icon macOS cannot keep visible while the pause switch is on, Accessibility missing, or every icon sitting right of the arrow). It shows once per reason per launch, never for auto-hide.

### Fixed
- macOS 26: auto-hide no longer waits on a notification banner. A banner puts up the same screen-tall Notification Center window as the panel, and the 26 check took any such window for the open panel, so a run of notifications held auto-hide for as long as they lasted (up to 10 minutes after the last one). Without Accessibility, which macOS 26 does not need for hiding, the window alone is no longer taken for the panel; with it, only the panel's Edit Widgets control counts ([#579](https://github.com/dwarvesf/hidden/issues/579)).
- macOS 27 (direct build): when macOS refuses the updated hide list after an app starts, the icons that were hidden stay hidden. The bar used to show every hidden icon with a collapsed arrow and no auto-hide until you clicked the arrow; now it either stays collapsed or shows the expanded arrow and auto-hide retries.
Expand Down
10 changes: 10 additions & 0 deletions Hidden Bar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
A1D0E1D0000000000000F011 /* MenuBarAppIdentity.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1D0E1D0000000000000F001 /* MenuBarAppIdentity.swift */; };
A1D0E1D0000000000000F012 /* MenuBarAppIdentity.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1D0E1D0000000000000F001 /* MenuBarAppIdentity.swift */; };
A1D0E1D0000000000000F013 /* MenuBarAppIdentityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1D0E1D0000000000000F002 /* MenuBarAppIdentityTests.swift */; };
A1B2C3D4E5F60718293A4B02 /* LanguagePreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B01 /* LanguagePreferences.swift */; };
A1B2C3D4E5F60718293A4B03 /* LanguagePreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B01 /* LanguagePreferences.swift */; };
A1B2C3D4E5F60718293A4B05 /* LanguagePreferencesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F60718293A4B04 /* LanguagePreferencesTests.swift */; };
837108CD16BDBEB2B6A4B064 /* MenuBarAppsSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFC448CD0476AF4799FA5DA /* MenuBarAppsSettingsViewController.swift */; };
142B73DAE4B1D30D0775D310 /* MenuBarAppsSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFC448CD0476AF4799FA5DA /* MenuBarAppsSettingsViewController.swift */; };
D62C67552025B67BCCE48642 /* SettingsModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60AFBE8D4C25548192E7D135 /* SettingsModelTests.swift */; };
Expand Down Expand Up @@ -296,6 +299,8 @@
A1D0E1D0000000000000F002 /* MenuBarAppIdentityTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MenuBarAppIdentityTests.swift; sourceTree = "<group>"; };
9FFC448CD0476AF4799FA5DA /* MenuBarAppsSettingsViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MenuBarAppsSettingsViewController.swift; sourceTree = "<group>"; };
13F6B1FCE2F0F29887382BF5 /* AdvancedSettingsViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AdvancedSettingsViewController.swift; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B01 /* LanguagePreferences.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = LanguagePreferences.swift; sourceTree = "<group>"; };
A1B2C3D4E5F60718293A4B04 /* LanguagePreferencesTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = LanguagePreferencesTests.swift; sourceTree = "<group>"; };
15C9D233ED7802C9AB5C7240 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = "<group>"; };
1AE90FC41D6BE7A8B6C61303 /* SettingsViews.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SettingsViews.swift; sourceTree = "<group>"; };
1FBC806D51AA2E70183A5308 /* AppearanceSettingsViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = AppearanceSettingsViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -619,6 +624,7 @@
34333589A6CF719498CC15C8 /* PaletteSettingsTests.swift */,
0CE1FB4D0D15FD197F34845F /* PalettePanelTests.swift */,
7769322508212ABCDA3E0A72 /* PresentationViewsTests.swift */,
A1B2C3D4E5F60718293A4B04 /* LanguagePreferencesTests.swift */,
);
name = HiddenTests;
path = HiddenTests;
Expand Down Expand Up @@ -675,6 +681,7 @@
08A5F86023AA085B00981CA5 /* Preferences.swift */,
9A329E615845473D946DA3C2 /* AutoStart.swift */,
A9D0DE00000000000000D001 /* AppDefaults.swift */,
A1B2C3D4E5F60718293A4B01 /* LanguagePreferences.swift */,
);
path = Common;
sourceTree = "<group>";
Expand Down Expand Up @@ -1061,6 +1068,7 @@
CD55D62C6EB16728FDE6E311 /* SettingsViews.swift in Sources */,
0BDB4054A4822D299F534B34 /* AppearanceSettingsViewController.swift in Sources */,
FEDF14D1A5762D05124A8462 /* AdvancedSettingsViewController.swift in Sources */,
A1B2C3D4E5F60718293A4B02 /* LanguagePreferences.swift in Sources */,
837108CD16BDBEB2B6A4B064 /* MenuBarAppsSettingsViewController.swift in Sources */,
A1D0E1D0000000000000F011 /* MenuBarAppIdentity.swift in Sources */,
E200010F880C7CE35022B50A /* SettingsSnapshot.swift in Sources */,
Expand Down Expand Up @@ -1114,6 +1122,7 @@
A9D0DE00000000000000D011 /* PrefsIsolationTests.swift in Sources */,
A57E0DE0000000000000C003 /* AppStoreMigrationTests.swift in Sources */,
F1B66A86232AE9B22A7B54FF /* SettingsWindowTests.swift in Sources */,
A1B2C3D4E5F60718293A4B05 /* LanguagePreferencesTests.swift in Sources */,
A1D0E1D0000000000000F013 /* MenuBarAppIdentityTests.swift in Sources */,
FFDA98BB7A1B238575886EE9 /* SystemOverflowTests.swift in Sources */,
E6D398FD9277C7ACB911BBB3 /* RevealSettingsTests.swift in Sources */,
Expand Down Expand Up @@ -1175,6 +1184,7 @@
1E55107E50681D0C905D60F6 /* SettingsViews.swift in Sources */,
7C149D7BC182147B87C08982 /* AppearanceSettingsViewController.swift in Sources */,
D61D23037A1EB8F7DD848EA4 /* AdvancedSettingsViewController.swift in Sources */,
A1B2C3D4E5F60718293A4B03 /* LanguagePreferences.swift in Sources */,
142B73DAE4B1D30D0775D310 /* MenuBarAppsSettingsViewController.swift in Sources */,
A1D0E1D0000000000000F012 /* MenuBarAppIdentity.swift in Sources */,
A3B15C1FDF934AFBADF438B6 /* SettingsSnapshot.swift in Sources */,
Expand Down
159 changes: 159 additions & 0 deletions HiddenTests/LanguagePreferencesTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
//
// LanguagePreferencesTests.swift
// HiddenTests
//
// Copyright © 2026 Console Labs. All rights reserved.
//

import XCTest
import AppKit
@testable import Hidden_Bar

/// Contract: the App language row offers every localization the build ships,
/// stores the choice as CFBundle's AppleLanguages key, and Simplified Chinese
/// stays a complete translation of the English strings.
final class LanguagePreferencesTests: XCTestCase {

private var suiteName = ""
private var store: UserDefaults!

override func setUp() {
super.setUp()
// The suite AppDefaults.domain(of:) maps a test store to.
suiteName = AppDefaults.testSuiteName
store = UserDefaults(suiteName: suiteName)
store.removePersistentDomain(forName: suiteName)
}

override func tearDown() {
store.removePersistentDomain(forName: suiteName)
super.tearDown()
}

// Given the localizations this build ships
// When the Language popup lists them
// Then Simplified Chinese is there under its own name and Base is not
func test_shippedLanguagesUseNativeNames() {
let languages = LanguagePreferences.languages()
XCTAssertTrue(languages.contains { $0.code == "zh-Hans" })
XCTAssertFalse(languages.contains { $0.code == "Base" })
XCTAssertEqual(languages.first { $0.code == "zh-Hans" }?.name, "简体中文")
}

// Given no choice yet
// When a language is picked, then System is picked
// Then the app's own domain holds the code, then not even an empty list
func test_overrideIsTheAppleLanguagesKey() {
XCTAssertNil(LanguagePreferences.override(in: store))
LanguagePreferences.setOverride("zh-Hans", in: store)
let written = store.persistentDomain(forName: suiteName)?[LanguagePreferences.appleLanguagesKey] as? [String]
XCTAssertEqual(written, ["zh-Hans"])
XCTAssertEqual(LanguagePreferences.override(in: store), "zh-Hans")
LanguagePreferences.setOverride(nil, in: store)
XCTAssertNil(store.persistentDomain(forName: suiteName)?[LanguagePreferences.appleLanguagesKey])
XCTAssertNil(LanguagePreferences.override(in: store))
}

// Given one domain holding a language and another holding none
// When the row reads the second one
// Then it reads that domain only, so a key in another domain is not taken
// for a choice (macOS keeps the system language in the global one)
func test_overrideReadsOnlyTheNamedDomain() {
let otherName = "LanguagePreferencesTests.other.\(UUID().uuidString)"
let other = UserDefaults(suiteName: otherName)!
other.removePersistentDomain(forName: otherName)
other.set(["zh-Hant"], forKey: LanguagePreferences.appleLanguagesKey)
defer { other.removePersistentDomain(forName: otherName) }

XCTAssertEqual(LanguagePreferences.override(in: other, domain: otherName), "zh-Hant")
XCTAssertNil(LanguagePreferences.override(in: store, domain: suiteName))
}

// Given a stored language
// When the same one is picked again, or another one is picked
// Then only the second needs a relaunch
func test_needsRestartOnlyWhenTheChoiceChanges() {
XCTAssertFalse(LanguagePreferences.needsRestart(from: "ja", to: "ja"))
XCTAssertFalse(LanguagePreferences.needsRestart(from: nil, to: nil))
XCTAssertTrue(LanguagePreferences.needsRestart(from: "ja", to: nil))
XCTAssertTrue(LanguagePreferences.needsRestart(from: nil, to: "ja"))
XCTAssertTrue(LanguagePreferences.needsRestart(from: "ja", to: "zh-Hans"))
}

// Given every English string
// When looking at Simplified Chinese
// Then each one is translated with the same format placeholders
func test_simplifiedChineseCoversEverything() throws {
let english = try strings(for: "en")
let chinese = try strings(for: "zh-Hans")
let missing = Set(english.keys).subtracting(chinese.keys)
XCTAssertTrue(missing.isEmpty, "zh-Hans is missing \(missing.sorted())")
for (key, value) in english {
XCTAssertEqual(chinese[key]?.components(separatedBy: "%@").count,
value.components(separatedBy: "%@").count, key)
XCTAssertEqual(chinese[key]?.components(separatedBy: "%d").count,
value.components(separatedBy: "%d").count, key)
}
XCTAssertEqual(chinese["Language"], "语言")
}

// Given the built app
// When Restart Now builds its helper
// Then the helper waits for this process to exit before opening the bundle,
// rather than opening on a fixed delay and racing the old instance
func test_relaunchHelperWaitsForThisProcess() {
let url = URL(fileURLWithPath: "/Applications/Hidden Bar.app")
let arguments = AppRelaunch.arguments(for: url, pid: 4321)
XCTAssertEqual(arguments.first, "-c")
let script = arguments[1]
XCTAssertTrue(script.contains("kill -0"))
XCTAssertTrue(script.contains("/bin/sleep 0.2"))
XCTAssertFalse(script.contains("sleep 1;"))
XCTAssertTrue(script.contains("/usr/bin/open"))
XCTAssertEqual(arguments[2], "sh")
XCTAssertEqual(arguments[3], "4321")
XCTAssertEqual(arguments[4], url.path)
}

// Given the build this test runs in
// When Restart Now reports whether it can work
// Then it is offered in the direct build only, as the App Store build is
// sandboxed and cannot run the wait
func test_relaunchFollowsTheBuild() {
XCTAssertEqual(AppRelaunch.isAvailable, SettingsBuild.current == .direct)
}

// Given the General pane
// When it lays out
// Then the language popup lists System first and writes the picked language
func test_generalPaneWritesThePickedLanguage() throws {
LanguagePreferences.setOverride(nil)
let controller = PreferencesWindowController(context: .live)
defer { controller.window?.close() }
let general = try XCTUnwrap(controller.pane(.general) as? PreferencesViewController)
_ = general.view
let popup = try XCTUnwrap(Self.view(with: PreferencesViewController.languagePopupIdentifier, in: general.view) as? NSPopUpButton)
XCTAssertEqual(popup.item(at: 0)?.title, "System (follow macOS)".localized)
XCTAssertTrue(popup.itemTitles.contains("简体中文"))

let index = try XCTUnwrap(popup.itemTitles.firstIndex(of: "简体中文"))
popup.selectItem(at: index)
_ = NSApp.sendAction(try XCTUnwrap(popup.action), to: popup.target, from: popup)
XCTAssertEqual(LanguagePreferences.override(), "zh-Hans")
LanguagePreferences.setOverride(nil)
}

private func strings(for localization: String) throws -> [String: String] {
let path = try XCTUnwrap(Bundle.main.path(forResource: "Localizable", ofType: "strings",
inDirectory: nil, forLocalization: localization))
return try XCTUnwrap(NSDictionary(contentsOfFile: path) as? [String: String])
}

private static func view(with identifier: NSUserInterfaceItemIdentifier, in root: NSView) -> NSView? {
if root.identifier == identifier { return root }
for child in root.subviews {
if let match = view(with: identifier, in: child) { return match }
}
return nil
}
}
5 changes: 4 additions & 1 deletion HiddenTests/SettingsWindowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,10 @@ final class SettingsWindowTests: XCTestCase {
let keys = ["Hidden Bar is working", "Hide icons again", "Never", "After %d seconds", "Your menu bar",
"This App Store version can't hide icons on macOS 27", "Check for Updates…", "What's new",
"Right-click on the arrow", "Show menu", "Show always-hidden icons",
"Option-click the arrow to see always-hidden icons.", "Option-right-click the arrow to open the menu."]
"Option-click the arrow to see always-hidden icons.", "Option-right-click the arrow to open the menu.",
"Language", "App language", "System (follow macOS)",
"Takes effect after Hidden Bar restarts.", "Restart Hidden Bar to apply the new language.",
"Restart Now", "Later"]
let localizations = Bundle.main.localizations.filter { $0 != "Base" }
XCTAssertGreaterThan(localizations.count, 5)
for locale in localizations {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions hidden/Common/AppDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,11 @@ enum AppDefaults {
suite.removePersistentDomain(forName: testSuiteName)
return suite
}

/// The domain this process keeps its own preferences in: the bundle domain
/// on a shipping launch, the test suite under XCTest. Readers that must not
/// see the global domain (where macOS keeps the system language) name this.
static var storeDomain: String? {
isRunningUnderXCTest ? testSuiteName : Bundle.main.bundleIdentifier
}
}
Loading