Fix custom menu bar icon packaging
This commit is contained in:
parent
24efe36d8e
commit
a078e8a4ec
@ -7,8 +7,7 @@ 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",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
@ -14,13 +14,24 @@ struct FchatiApp: App {
|
|||||||
RootView()
|
RootView()
|
||||||
.background(WindowConfigurator())
|
.background(WindowConfigurator())
|
||||||
} label: {
|
} label: {
|
||||||
Image("MenuBarIcon", bundle: .module)
|
MenuBarIcon()
|
||||||
.renderingMode(.original)
|
|
||||||
}
|
}
|
||||||
.menuBarExtraStyle(.window)
|
.menuBarExtraStyle(.window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private struct MenuBarIcon: View {
|
||||||
|
var body: some View {
|
||||||
|
if let url = Bundle.main.url(forResource: "MenuBarIcon", withExtension: "png"),
|
||||||
|
let image = NSImage(contentsOf: url) {
|
||||||
|
Image(nsImage: image)
|
||||||
|
.renderingMode(.original)
|
||||||
|
} else {
|
||||||
|
Image(systemName: "message")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Prevents the popover from closing when clicking outside.
|
// Prevents the popover from closing when clicking outside.
|
||||||
private struct WindowConfigurator: NSViewRepresentable {
|
private struct WindowConfigurator: NSViewRepresentable {
|
||||||
func makeNSView(context: Context) -> NSView {
|
func makeNSView(context: Context) -> NSView {
|
||||||
|
|||||||
@ -200,7 +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.
|
- The supplied Teamwork Chat icon now replaces the app icon and provides the custom menu-bar icon from the signed application resources directory.
|
||||||
|
|
||||||
## Bug Fixes — Post-Review ✅
|
## Bug Fixes — Post-Review ✅
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ INSTALL_PATH="/Applications/Fchati.app"
|
|||||||
STAGING_DIR="$(mktemp -d "${TMPDIR:-/tmp}/fchati-install.XXXXXX")"
|
STAGING_DIR="$(mktemp -d "${TMPDIR:-/tmp}/fchati-install.XXXXXX")"
|
||||||
STAGING_APP="$STAGING_DIR/Fchati.app"
|
STAGING_APP="$STAGING_DIR/Fchati.app"
|
||||||
ICON_PATH="$PROJECT_DIR/Resources/Fchati.icns"
|
ICON_PATH="$PROJECT_DIR/Resources/Fchati.icns"
|
||||||
|
MENU_BAR_ICON_PATH="$PROJECT_DIR/Resources/MenuBarIcon.png"
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm -rf "$STAGING_DIR"
|
rm -rf "$STAGING_DIR"
|
||||||
@ -41,14 +42,13 @@ 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
|
if [[ ! -f "$MENU_BAR_ICON_PATH" ]]; then
|
||||||
echo "Application resource bundle not found: $RESOURCE_BUNDLE" >&2
|
echo "Menu bar icon not found: $MENU_BAR_ICON_PATH" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ 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/"
|
cp "$MENU_BAR_ICON_PATH" "$STAGING_APP/Contents/Resources/MenuBarIcon.png"
|
||||||
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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user