[KDE/Mac] let notifications return focus to previously active window?

René J.V. Bertin rjvbertin at gmail.com
Fri Oct 31 00:19:10 UTC 2014


On Thursday October 30 2014 20:31:37 Thomas Lübking wrote:

> Most important question: do they come w/ a cusomt window/dialog or does it hook into sth. like growl?

No, it goes through KNotify. I haven't looked too closely at how exactly that class works (but it seems to go through DBus, which doesn't make things easier to understand). I don't think there's a Mac-specific backend, though.


> That's only the active window if qApp currently actually has the active window - it's not like a KWindowSystem call (which you'd rather use in this case)

Well, KWindowSystem::activeWindow isn't implemented on OS X. I managed to convert kwindowsystem_mac.cpp to kwindowsystem_mac.mm (= ObjC++) and still build libkdeui, so I could tap into a promising Cocoa api ... and it turns out that that too only gives me useful information if the calling app has the active window.

> Best way would however likely to have KNotify not steal the focus on OSX itfp.
> Eg. make it a tooltip? (Unfortunately, I've no idea on OSX window management facilities)

Thing is that the notification is posted from a background application. That probably doesn't become apparent because the app is configured to run as an "agent", but it seems unavoidable that it becomes active to some extent. I'll check if bringing the previously active *app* back to the foreground restores focus to the window that had focus, seems that's about the only option we have.

René


More information about the kde-mac mailing list