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
23 changes: 23 additions & 0 deletions CodexLinxDisplay.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
A1C0A55E0000000000000001 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A1C0A55E0000000000000002 /* Assets.xcassets */; };
19603256ADE889638AF0F1A3 /* UsageCardRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57966CEDE2F0E2EBF43CDCA1 /* UsageCardRenderer.swift */; };
1C12E0F24452CBE735D2C41D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27519CC2F435B5DB276ACC36 /* main.swift */; };
20785F3A780E830C7CB33CCB /* ImageAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8F06F104E1BF95F00951024 /* ImageAPIClient.swift */; };
Expand Down Expand Up @@ -42,6 +43,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
A1C0A55E0000000000000002 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
0C0A9F7078CF4808E985B531 /* MenuBarContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarContentView.swift; sourceTree = "<group>"; };
1AAE642680E0C1C25BC8F331 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
27519CC2F435B5DB276ACC36 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -105,12 +107,21 @@
children = (
1139D66A6A163C213807C508 /* App */,
822552AA42889C6D179D08FA /* Preview */,
A1C0A55E0000000000000003 /* Resources */,
95B6FE6A0AF26F19F07D3B1C /* Shared */,
04330F53A8AEB47BB6776726 /* Tests */,
4ACF797FA7096EE9FC07B331 /* Products */,
);
sourceTree = "<group>";
};
A1C0A55E0000000000000003 /* Resources */ = {
isa = PBXGroup;
children = (
A1C0A55E0000000000000002 /* Assets.xcassets */,
);
path = Resources;
sourceTree = "<group>";
};
4ACF797FA7096EE9FC07B331 /* Products */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -152,6 +163,7 @@
buildPhases = (
5F5AF8DA6E270CFC1298D6C5 /* Sources */,
B3ED7D4125E0B120B9908BE4 /* Frameworks */,
A1C0A55E0000000000000004 /* Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -235,6 +247,17 @@
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
A1C0A55E0000000000000004 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A1C0A55E0000000000000001 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
5F5AF8DA6E270CFC1298D6C5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
68 changes: 68 additions & 0 deletions Resources/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"images" : [
{
"filename" : "icon_16x16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "icon_32x32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "icon_128x128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "icon_256x256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "icon_512x512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Resources/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
25 changes: 25 additions & 0 deletions Resources/Assets.xcassets/MenuBarIcon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"images" : [
{
"filename" : "menu-bar-template.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
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.
12 changes: 7 additions & 5 deletions Sources/App/AppLifecycleController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ final class StatusItemController: NSObject {
private func updateStatusItem() {
guard let button = statusItem.button else { return }

let symbolName = model.displayMode == .customImage ? "photo" : "rectangle.portrait"
let image = NSImage(
systemSymbolName: symbolName,
accessibilityDescription: "Codex 屏显"
)
let image = NSImage(named: "MenuBarIcon")
?? NSImage(
systemSymbolName: "rectangle.portrait",
accessibilityDescription: "Codex 屏显"
)
image?.isTemplate = true
image?.size = NSSize(width: 18, height: 18)
image?.accessibilityDescription = "Codex 屏显"
button.image = image
button.toolTip = statusDescription
}
Expand Down
4 changes: 4 additions & 0 deletions Tests/AppLifecycleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ final class AppLifecycleTests: XCTestCase {

@MainActor
func testStatusItemUsesAVisibleFixedWidthButton() {
XCTAssertNotNil(NSImage(named: "MenuBarIcon"))

let model = AppModel()
let controller = StatusItemController(
model: model,
Expand All @@ -36,6 +38,8 @@ final class AppLifecycleTests: XCTestCase {
XCTAssertNotNil(controller.statusItem.button)
XCTAssertNotNil(controller.statusItem.button?.image)
XCTAssertEqual(controller.statusItem.button?.imagePosition, .imageOnly)
XCTAssertEqual(controller.statusItem.button?.image?.size, NSSize(width: 18, height: 18))
XCTAssertTrue(controller.statusItem.button?.image?.isTemplate ?? false)
}
}

Expand Down
1 change: 1 addition & 0 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ targets:
sources:
- path: Sources/Shared
- path: Sources/App
- path: Resources/Assets.xcassets
info:
path: Resources/Info.plist
properties:
Expand Down