Skip to content

Commit

Permalink
Work around macOS bug with persisting menu bar item position
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 16, 2022
1 parent 470d8f4 commit 990b381
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Color Picker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
E32CF5572793FACD002DDBC0 /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = E32CF5562793FACD002DDBC0 /* Defaults */; };
E38D432F263AAE8500701B82 /* SettingsScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38D432E263AAE8500701B82 /* SettingsScreen.swift */; };
E38D4331263AAEA900701B82 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38D4330263AAEA900701B82 /* Constants.swift */; };
E38D4333263AB24E00701B82 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38D4332263AB24E00701B82 /* Utilities.swift */; };
Expand Down Expand Up @@ -97,6 +98,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E32CF5572793FACD002DDBC0 /* Defaults in Frameworks */,
E3E7D7AE27218C8A009D71F4 /* Regex in Frameworks */,
E3E7D79B27218903009D71F4 /* Intents.framework in Frameworks */,
);
Expand Down Expand Up @@ -218,6 +220,7 @@
name = IntentsExtension;
packageProductDependencies = (
E3E7D7AD27218C8A009D71F4 /* Regex */,
E32CF5562793FACD002DDBC0 /* Defaults */,
);
productName = IntentsExtension;
productReference = E3E7D79927218903009D71F4 /* IntentsExtension.appex */;
Expand Down Expand Up @@ -664,6 +667,11 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
E32CF5562793FACD002DDBC0 /* Defaults */ = {
isa = XCSwiftPackageProductDependency;
package = E3E14060259A0D97004FC89F /* XCRemoteSwiftPackageReference "Defaults" */;
productName = Defaults;
};
E394DAAA263D73AD00F5B042 /* Regex */ = {
isa = XCSwiftPackageProductDependency;
package = E394DAA9263D73AD00F5B042 /* XCRemoteSwiftPackageReference "Regex" */;
Expand Down
3 changes: 3 additions & 0 deletions Color Picker/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ final class AppState: ObservableObject {
$0.button!.image = NSImage(systemSymbolName: "drop.fill", accessibilityDescription: nil)
$0.button!.sendAction(on: [.leftMouseUp, .rightMouseUp])

// Work around macOS bug where the position is not preserved. (macOS 12.1)
$0.autosaveName = "Color Picker"

let item = $0

$0.button!.onAction { [self] event in
Expand Down

0 comments on commit 990b381

Please sign in to comment.