blizzard4591 / openMittsu

An open source implementation and desktop client of the Threema Messenger App.
Other
175 stars 22 forks source link

Focus #7

Open dbrgn opened 8 years ago

dbrgn commented 8 years ago

I use the dwm window manager. Every time I receive a message, the openMittsu window "forcefully" receives focus (and comes to top), even if I'm typing on the other screen in another window on another "virtual desktop" (called "tag" on dwm).

Would it be possible to simply set a notification flag on the window (e.g. setting the Xorg URGENT flag) instead of getting the focus immediately? Most window managers should then show some kind of notification that something happened.

blizzard4591 commented 8 years ago

Yes. This is definitely on my ToDo list. Since I only use headless linux machines, I do not have the best environment to play with this and find the best setup. Currently, the code looks like this:

this->activateWindow(); The docs say:

Sets the top-level widget containing this widget to be the active window.

An active window is a visible top-level window that has the keyboard input focus.

This function performs the same operation as clicking the mouse on the title bar of a top-level window. On X11, the result depends on the Window Manager. If you want to ensure that the window is stacked on top as well you should also call raise(). Note that the window must be visible, otherwise activateWindow() has no effect.

On Windows, if you are calling this when the application is not currently the active one then it will not make it the active window. It will change the color of the taskbar entry to indicate that the window has changed in some way. This is because Microsoft does not allow an application to interrupt what the user is currently doing in another application.

As for Windows, while it says "does not allow an application to interrupt what the user is currently doing in another application", it sure looks like something else, because if you have a window in fullscreen, openMittsu will steal the focus.

My current plan is to use SnoreNotify. It seems to be a crossplatform solution and can easily be adapted for custom needs. Only problem: I can not get it to work on Windows. So, for now: Stalled :/

blizzard4591 commented 6 years ago

Ok, revisiting the issue. Is this still an issue with the options for enabling/disabling the focusing?

ddobrev commented 4 years ago

@blizzard4591 in relation to this issue, do you actually have desktop notifications? If you do, are they native – such as integrated with Notification Center on macOS?

blizzard4591 commented 4 years ago

See 930f5ea for recent changes :)

ddobrev commented 4 years ago

@blizzard4591 outstanding!

ddobrev commented 4 years ago

@blizzard4591 could you please let me know what kind of notifications you have: simply jumping, real notifications at the top right corner (Notification Center), badges (a small circle in the dock with the number of unread messages)?