diff --git a/CMakeLists.txt b/CMakeLists.txt index 384b3dc..df8b777 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,10 +47,18 @@ elseif(APPLE) list(APPEND HEADERS window_helper_macos.h) 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 qt6_add_executable(Clouck WIN32 MACOSX_BUNDLE ${SOURCES} ${HEADERS} + ${APP_ICON_MACOSX} ) # Platform-specific sources and libraries diff --git a/clock_widget.h b/clock_widget.h index 8c2f289..8e12649 100644 --- a/clock_widget.h +++ b/clock_widget.h @@ -42,6 +42,9 @@ public: QMenu *menu() const { return m_contextMenu; } + QString primaryTimeZoneId() const { return m_primaryTimeZoneId; } + QString secondaryTimeZoneId() const { return m_secondaryTimeZoneId; } + protected: void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; diff --git a/main.cpp b/main.cpp index 049d642..848177a 100644 --- a/main.cpp +++ b/main.cpp @@ -49,6 +49,12 @@ int main(int argc, char *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.setOrganizationName("Clouck"); app.setApplicationDisplayName("Clouck"); diff --git a/resources/clouck.icns b/resources/clouck.icns new file mode 100644 index 0000000..6a5e161 Binary files /dev/null and b/resources/clouck.icns differ diff --git a/window_helper_macos.mm b/window_helper_macos.mm index ee7f957..d5ed8bd 100644 --- a/window_helper_macos.mm +++ b/window_helper_macos.mm @@ -36,4 +36,9 @@ void MacOSWindowHelper::setupAlwaysOnTopForFullscreen(QWidget *widget) } } + +void clouck_setActivationPolicyAccessory() +{ + [NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory]; +} #endif // Q_OS_MAC