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
4 changes: 4 additions & 0 deletions Hidden Bar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
3CF14C82221FA49D0083D42B /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF14C81221FA49D0083D42B /* PreferencesWindowController.swift */; };
55F3F1192608923B0054B881 /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55F3F1182608923B0054B881 /* Date+Extension.swift */; };
55F3F11D2608925A0054B881 /* StackView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55F3F11C2608925A0054B881 /* StackView+Extension.swift */; };
6C0A10012DEBF00100A5E001 /* HiddenItemsBarPanelController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C0A10002DEBF00100A5E001 /* HiddenItemsBarPanelController.swift */; };
9220587E2212A7C0008A8B03 /* LauncherApplication.app in Copy Files */ = {isa = PBXBuildFile; fileRef = 92C5054E21FEC03B0084719A /* LauncherApplication.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
929113F521F9D04100173149 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929113F421F9D04100173149 /* AppDelegate.swift */; };
929113F921F9D04200173149 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 929113F821F9D04200173149 /* Assets.xcassets */; };
Expand Down Expand Up @@ -83,6 +84,7 @@
55D9B6BD2661DEE8007AF073 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
55F3F1182608923B0054B881 /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = "<group>"; };
55F3F11C2608925A0054B881 /* StackView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StackView+Extension.swift"; sourceTree = "<group>"; };
6C0A10002DEBF00100A5E001 /* HiddenItemsBarPanelController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HiddenItemsBarPanelController.swift; sourceTree = "<group>"; };
9220587D22127050008A8B03 /* Hidden.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Hidden.entitlements; path = Hidden/Hidden.entitlements; sourceTree = "<group>"; };
929113F121F9D04100173149 /* Hidden Bar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Hidden Bar.app"; sourceTree = BUILT_PRODUCTS_DIR; };
929113F421F9D04100173149 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -162,6 +164,7 @@
isa = PBXGroup;
children = (
92C97B9022018C1F0007559C /* StatusBarController.swift */,
6C0A10002DEBF00100A5E001 /* HiddenItemsBarPanelController.swift */,
);
path = StatusBar;
sourceTree = "<group>";
Expand Down Expand Up @@ -405,6 +408,7 @@
08A5F85C23AA013100981CA5 /* SelectedSecond.swift in Sources */,
08A5F86123AA085B00981CA5 /* Preferences.swift in Sources */,
92C97B9122018C1F0007559C /* StatusBarController.swift in Sources */,
6C0A10012DEBF00100A5E001 /* HiddenItemsBarPanelController.swift in Sources */,
55F3F1192608923B0054B881 /* Date+Extension.swift in Sources */,
92D2122221FEE06600C92FF4 /* LauncherApplication.app in Sources */,
08B9F32C2411883300AA0551 /* NSWindow+Extension.swift in Sources */,
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ brew install --cask hiddenbar

* `⌘` + drag to move the Hidden icons around in the menu bar.
* Click the Arrow icon to hide menu bar items.
* Enable "Show hidden items in separate bar" in Preferences to show
hidden menu bar items in a separate bar below the menu bar on the current
display. This mode captures the hidden menu bar item windows and forwards
clicks back to the original items, so macOS may ask for Screen Recording and
Accessibility permission.

<p align="center">
<img src="img/tutorial.gif">
Expand Down
4 changes: 3 additions & 1 deletion hidden/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class AppDelegate: NSObject, NSApplicationDelegate{
UserDefaults.Key.isAutoHide: true,
UserDefaults.Key.numberOfSecondForAutoHide: 10.0,
UserDefaults.Key.areSeparatorsHidden: false,
UserDefaults.Key.alwaysHiddenSectionEnabled: false
UserDefaults.Key.alwaysHiddenSectionEnabled: false,
UserDefaults.Key.useFullStatusBarOnExpandEnabled: false,
UserDefaults.Key.showHiddenItemsInSeparateBar: false
])
}

Expand Down
17 changes: 15 additions & 2 deletions hidden/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,10 @@ between sections to configure Hidden Bar.</string>
</textFieldCell>
</textField>
<stackView distribution="fill" orientation="horizontal" alignment="top" spacing="35" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="I1C-Eb-1or">
<rect key="frame" x="16" y="20" width="636" height="133"/>
<rect key="frame" x="16" y="20" width="636" height="159"/>
<subviews>
<stackView distribution="fill" orientation="vertical" alignment="leading" spacing="10" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="do4-pv-o3U">
<rect key="frame" x="0.0" y="0.0" width="328" height="133"/>
<rect key="frame" x="0.0" y="0.0" width="328" height="159"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cbR-Jv-adm">
<rect key="frame" x="-2" y="116" width="207" height="18"/>
Expand Down Expand Up @@ -657,6 +657,16 @@ between sections to configure Hidden Bar.</string>
<action selector="useFullStatusBarOnExpandChanged:" target="XfG-lQ-9wD" id="kh2-cl-DOH"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QZ2-tc-LbE" userLabel="Check Box Show Hidden Items In Separate Bar">
<rect key="frame" x="-2" y="38" width="328" height="18"/>
<buttonCell key="cell" type="check" title="Show hidden items in separate bar" bezelStyle="regularSquare" imagePosition="left" inset="2" id="tRb-eP-1yY">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="showHiddenItemsInSeparateBarChanged:" target="XfG-lQ-9wD" id="Aqq-FN-X0K"/>
</connections>
</button>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nE7-aX-FH9">
<rect key="frame" x="0.0" y="35" width="230" height="20"/>
<subviews>
Expand Down Expand Up @@ -762,13 +772,15 @@ between sections to configure Hidden Bar.</string>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="vertical" alignment="centerX" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NOW-ql-i4U">
Expand Down Expand Up @@ -863,6 +875,7 @@ between sections to configure Hidden Bar.</string>
<outlet property="checkBoxAutoHide" destination="gj1-Ms-4No" id="Ibl-5H-2vh"/>
<outlet property="checkBoxLogin" destination="cbR-Jv-adm" id="DFO-De-0KU"/>
<outlet property="checkBoxShowAlwaysHiddenSection" destination="yaS-iD-h7g" id="T5N-bN-yl2"/>
<outlet property="checkBoxShowHiddenItemsInSeparateBar" destination="QZ2-tc-LbE" id="2qk-TZ-Qgs"/>
<outlet property="checkBoxShowPreferences" destination="gWT-L1-Xdf" id="sC8-cw-Fmh"/>
<outlet property="checkBoxUseFullStatusbar" destination="EQP-7r-FSu" id="Vll-3t-F9V"/>
<outlet property="lblAlwayHidden" destination="eBG-Wk-IXv" id="JaJ-0i-o6U"/>
Expand Down
58 changes: 34 additions & 24 deletions hidden/Common/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,101 +9,111 @@
import Foundation

enum Preferences {

static var globalKey: GlobalKeybindPreferences? {
get {
guard let data = UserDefaults.standard.value(forKey: UserDefaults.Key.globalKey) as? Data else { return nil }
return try? JSONDecoder().decode(GlobalKeybindPreferences.self, from: data)
}

set {
guard let data = try? JSONEncoder().encode(newValue) else { return }
UserDefaults.standard.set(data, forKey: UserDefaults.Key.globalKey)

NotificationCenter.default.post(Notification(name: .prefsChanged))
}
}

static var isAutoStart: Bool {
get {
return UserDefaults.standard.bool(forKey: UserDefaults.Key.isAutoStart)
}

set {
UserDefaults.standard.set(newValue, forKey: UserDefaults.Key.isAutoStart)

Util.setUpAutoStart(isAutoStart: newValue)

NotificationCenter.default.post(Notification(name: .prefsChanged))
}
}

static var numberOfSecondForAutoHide: Double {
get {
UserDefaults.standard.double(forKey: UserDefaults.Key.numberOfSecondForAutoHide)
}

set {
UserDefaults.standard.set(newValue, forKey: UserDefaults.Key.numberOfSecondForAutoHide)

NotificationCenter.default.post(Notification(name: .prefsChanged))
}
}

static var isAutoHide: Bool {
get {
UserDefaults.standard.bool(forKey: UserDefaults.Key.isAutoHide)
}

set {
UserDefaults.standard.set(newValue, forKey: UserDefaults.Key.isAutoHide)

NotificationCenter.default.post(Notification(name: .prefsChanged))
}
}

static var isShowPreference: Bool {
get {
UserDefaults.standard.bool(forKey: UserDefaults.Key.isShowPreference)
}

set {
UserDefaults.standard.set(newValue, forKey: UserDefaults.Key.isShowPreference)

NotificationCenter.default.post(Notification(name: .prefsChanged))
}
}

static var areSeparatorsHidden: Bool {
get {
UserDefaults.standard.bool(forKey: UserDefaults.Key.areSeparatorsHidden)
}

set {
UserDefaults.standard.set(newValue, forKey: UserDefaults.Key.areSeparatorsHidden)
}
}

static var alwaysHiddenSectionEnabled: Bool {
get {
UserDefaults.standard.bool(forKey: UserDefaults.Key.alwaysHiddenSectionEnabled)
}

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

static var useFullStatusBarOnExpandEnabled: Bool {
get {
UserDefaults.standard.bool(forKey: UserDefaults.Key.useFullStatusBarOnExpandEnabled)
}

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

static var showHiddenItemsInSeparateBar: Bool {
get {
UserDefaults.standard.bool(forKey: UserDefaults.Key.showHiddenItemsInSeparateBar)
}

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


}
1 change: 1 addition & 0 deletions hidden/Extensions/UserDefault+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extension UserDefaults {
static let areSeparatorsHidden = "areSeparatorsHidden"
static let alwaysHiddenSectionEnabled = "alwaysHiddenSectionEnabled"
static let useFullStatusBarOnExpandEnabled = "useFullStatusBarOnExpandEnabled"
static let showHiddenItemsInSeparateBar = "showHiddenItemsInSeparateBar"
}

open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
Expand Down
Loading