feat: menu-bar-only app (no Dock icon) + macOS app icon
- NSApplicationActivationPolicyAccessory: app hidden from Dock and app switcher; lives only in the menu bar tray - resources/clouck.icns: programmatic icon (green gradient rounded square, white dial, 10:10 hands), all sizes 16-1024 incl @2x - CMake: MACOSX_BUNDLE_ICON_FILE wired, icns shipped in Resources/
This commit is contained in:
@@ -47,10 +47,18 @@ elseif(APPLE)
|
|||||||
list(APPEND HEADERS window_helper_macos.h)
|
list(APPEND HEADERS window_helper_macos.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# macOS app icon
|
||||||
|
if(APPLE)
|
||||||
|
set(MACOSX_BUNDLE_ICON_FILE clouck.icns)
|
||||||
|
set(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/resources/clouck.icns)
|
||||||
|
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Create executable
|
# Create executable
|
||||||
qt6_add_executable(Clouck WIN32 MACOSX_BUNDLE
|
qt6_add_executable(Clouck WIN32 MACOSX_BUNDLE
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
${HEADERS}
|
${HEADERS}
|
||||||
|
${APP_ICON_MACOSX}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Platform-specific sources and libraries
|
# Platform-specific sources and libraries
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ public:
|
|||||||
|
|
||||||
QMenu *menu() const { return m_contextMenu; }
|
QMenu *menu() const { return m_contextMenu; }
|
||||||
|
|
||||||
|
QString primaryTimeZoneId() const { return m_primaryTimeZoneId; }
|
||||||
|
QString secondaryTimeZoneId() const { return m_secondaryTimeZoneId; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
|||||||
@@ -49,6 +49,12 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
// Menu-bar-only app: no Dock icon, no app switcher entry.
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
extern void clouck_setActivationPolicyAccessory(); // defined in window_helper_macos.mm
|
||||||
|
clouck_setActivationPolicyAccessory();
|
||||||
|
#endif
|
||||||
|
|
||||||
app.setApplicationName("Clouck");
|
app.setApplicationName("Clouck");
|
||||||
app.setOrganizationName("Clouck");
|
app.setOrganizationName("Clouck");
|
||||||
app.setApplicationDisplayName("Clouck");
|
app.setApplicationDisplayName("Clouck");
|
||||||
|
|||||||
Binary file not shown.
@@ -36,4 +36,9 @@ void MacOSWindowHelper::setupAlwaysOnTopForFullscreen(QWidget *widget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void clouck_setActivationPolicyAccessory()
|
||||||
|
{
|
||||||
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
|
||||||
|
}
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
|
|||||||
Reference in New Issue
Block a user