Files
DualFloatingClock/window_helper_macos.mm
sebastian db02df7ca2 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/
2026-08-27 22:31:06 +03:00

45 lines
1.5 KiB
Plaintext

#import "window_helper_macos.h"
#import <QWidget>
#ifdef Q_OS_MAC
#import <AppKit/AppKit.h>
#import <CoreGraphics/CGWindowLevel.h>
void MacOSWindowHelper::setupAlwaysOnTopForFullscreen(QWidget *widget)
{
if (!widget) return;
// Get the native NSView and NSWindow
NSView *nativeView = (NSView *)widget->winId();
NSWindow *nativeWindow = [nativeView window];
if (nativeWindow) {
// Set window level to be above everything, including fullscreen apps
[nativeWindow setLevel:NSScreenSaverWindowLevel - 1];
// Allow window to appear on all spaces (including fullscreen spaces)
[nativeWindow setCollectionBehavior:NSWindowCollectionBehaviorCanJoinAllSpaces |
NSWindowCollectionBehaviorFullScreenAuxiliary |
NSWindowCollectionBehaviorStationary];
// Make it a floating panel that won't steal focus
[nativeWindow setHidesOnDeactivate:NO];
// Note: setFloatingPanel is deprecated, but we keep it for compatibility
// The key is setting the proper window level and collection behavior
// Ensure it stays above dock and menu bar
[nativeWindow setLevel:CGWindowLevelForKey(kCGFloatingWindowLevelKey)];
// Kill the system window shadow — text must float with no halo.
[nativeWindow setHasShadow:NO];
}
}
void clouck_setActivationPolicyAccessory()
{
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
}
#endif // Q_OS_MAC