Use custom icon for app and menu bar

This commit is contained in:
diyaa 2026-07-27 02:45:51 +02:00
parent cce1b350e0
commit 24efe36d8e
7 changed files with 14 additions and 2 deletions

View File

@ -7,7 +7,8 @@ let package = Package(
targets: [ targets: [
.executableTarget( .executableTarget(
name: "FchatiApp", name: "FchatiApp",
path: "Sources/FchatiApp" path: "Sources/FchatiApp",
resources: [.process("Resources")]
), ),
.testTarget( .testTarget(
name: "FchatiAppTests", name: "FchatiAppTests",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

View File

@ -10,9 +10,12 @@ struct FchatiApp: App {
} }
.defaultSize(width: 420, height: 560) .defaultSize(width: 420, height: 560)
MenuBarExtra("Fchati", systemImage: "message") { MenuBarExtra {
RootView() RootView()
.background(WindowConfigurator()) .background(WindowConfigurator())
} label: {
Image("MenuBarIcon", bundle: .module)
.renderingMode(.original)
} }
.menuBarExtraStyle(.window) .menuBarExtraStyle(.window)
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -200,6 +200,7 @@
- The macOS app now has an always-visible quit control beside the top-level tabs, in addition to the existing Settings action. - The macOS app now has an always-visible quit control beside the top-level tabs, in addition to the existing Settings action.
- The macOS app now includes a normal main window and Dock presence while retaining the menu-bar shortcut. - The macOS app now includes a normal main window and Dock presence while retaining the menu-bar shortcut.
- `FchatiApp/Resources/AppIcon.png` and `FchatiApp/Resources/Fchati.icns` provide the bundled Dock and application icon, and the installer copies the icon into the application bundle. - `FchatiApp/Resources/AppIcon.png` and `FchatiApp/Resources/Fchati.icns` provide the bundled Dock and application icon, and the installer copies the icon into the application bundle.
- The supplied Teamwork Chat icon now replaces the app icon and provides the custom menu-bar icon through the Swift package resources; the installer copies that resource bundle into the application bundle.
## Bug Fixes — Post-Review ✅ ## Bug Fixes — Post-Review ✅

View File

@ -41,16 +41,23 @@ echo "Building the release executable..."
swift build --configuration release --package-path "$PROJECT_DIR" swift build --configuration release --package-path "$PROJECT_DIR"
EXECUTABLE_PATH="$PROJECT_DIR/.build/release/$PRODUCT_NAME" EXECUTABLE_PATH="$PROJECT_DIR/.build/release/$PRODUCT_NAME"
RESOURCE_BUNDLE="$PROJECT_DIR/.build/release/FchatiApp_FchatiApp.bundle"
if [[ ! -x "$EXECUTABLE_PATH" ]]; then if [[ ! -x "$EXECUTABLE_PATH" ]]; then
echo "Release executable not found: $EXECUTABLE_PATH" >&2 echo "Release executable not found: $EXECUTABLE_PATH" >&2
exit 1 exit 1
fi fi
if [[ ! -d "$RESOURCE_BUNDLE" ]]; then
echo "Application resource bundle not found: $RESOURCE_BUNDLE" >&2
exit 1
fi
echo "Creating the application bundle..." echo "Creating the application bundle..."
mkdir -p "$STAGING_APP/Contents/MacOS" "$STAGING_APP/Contents/Resources" mkdir -p "$STAGING_APP/Contents/MacOS" "$STAGING_APP/Contents/Resources"
cp "$PROJECT_DIR/Info.plist" "$STAGING_APP/Contents/Info.plist" cp "$PROJECT_DIR/Info.plist" "$STAGING_APP/Contents/Info.plist"
cp "$EXECUTABLE_PATH" "$STAGING_APP/Contents/MacOS/$PRODUCT_NAME" cp "$EXECUTABLE_PATH" "$STAGING_APP/Contents/MacOS/$PRODUCT_NAME"
cp "$ICON_PATH" "$STAGING_APP/Contents/Resources/Fchati.icns" cp "$ICON_PATH" "$STAGING_APP/Contents/Resources/Fchati.icns"
cp -R "$RESOURCE_BUNDLE" "$STAGING_APP/Contents/Resources/"
codesign --force --sign - --timestamp=none --entitlements "$PROJECT_DIR/FchatiApp.entitlements" "$STAGING_APP" codesign --force --sign - --timestamp=none --entitlements "$PROJECT_DIR/FchatiApp.entitlements" "$STAGING_APP"
if [[ -d "$INSTALL_PATH" ]]; then if [[ -d "$INSTALL_PATH" ]]; then