Skip to content

Commit

Permalink
improve reset logic so inactive status items don't show old image
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanSK committed Sep 27, 2024
1 parent f87f6f4 commit 48c67a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Menu Bar Dock.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 24;
CURRENT_PROJECT_VERSION = 25;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = T34G959ZG8;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -789,7 +789,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 4.4;
MARKETING_VERSION = 4.5;
PRODUCT_BUNDLE_IDENTIFIER = com.ethansk.MenuBarDock;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -807,7 +807,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 24;
CURRENT_PROJECT_VERSION = 25;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = T34G959ZG8;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -817,7 +817,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 4.4;
MARKETING_VERSION = 4.5;
PRODUCT_BUNDLE_IDENTIFIER = com.ethansk.MenuBarDock;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
5 changes: 5 additions & 0 deletions MenuBarDock/MenuBarItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class MenuBarItem {

func reset() {
self.app = nil
if let button = statusItem.button {
for subview in button.subviews {
subview.removeFromSuperview()
}
}
}

private func initButton() {
Expand Down
2 changes: 1 addition & 1 deletion MenuBarDock/MenuBarItems.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MenuBarItems {

if #available(OSX 10.12, *) {
if userPrefsDataSource.preserveAppOrder == false {
item.statusItem.isVisible = false // this prevents the item from remembering its position. Thanks Apple.
item.statusItem.isVisible = false // this prevents the item from remembering its position Thanks Apple.
}
}
}
Expand Down

0 comments on commit 48c67a5

Please sign in to comment.