miracle-wm-org / miracle-wm

Miracle is a Wayland tiling window manager built on Mir
https://miracle-wm.org
GNU General Public License v3.0
419 stars 14 forks source link

[Q]: Focus stealing prevention feature #109

Open GHNewbiee opened 7 months ago

GHNewbiee commented 7 months ago

Does Miracle-WM provide prevention against stealing of a window focus? Tia

mattkae commented 7 months ago

Hiya @GHNewbiee. What would be the feature here? As far as I understand it, I think it would be:

  1. Window A is focused
  2. Another Window B opens and requests focus
  3. Window A should keep focus if the compositor is set to do so

Is that correct?

GHNewbiee commented 7 months ago

@mattkae Thanks for your response. Just to be more precise:

  1. Window A is chosen and, hence, it gets focused
  2. To add, that any window requiring "attention" eg password, etc, it merely behaves in different manner eg flashing (?)
  3. That's very correct!
GHNewbiee commented 7 months ago

To add in 2) Window requiring "attention" should not lock the focus on itself. That's why it has to behave in a different manner if possible.

mattkae commented 7 months ago

Understood now! Right now, the behavior is that any window that gets brought up gains focus, but we could just as easily provide an option in the config to disable that behavior.

GHNewbiee commented 7 months ago

@mattkae

What about the behavior of a window requiring attention, will it

mattkae commented 7 months ago
GHNewbiee commented 7 months ago
mattkae commented 7 months ago
GHNewbiee commented 7 months ago

Ah and is this requested by the client? Is this an X only thing or is there a Wayland protocol that requests this behavior?

I get this while trying to open Github Desktop. An "Unlock Login Keyring" window appears which locks the operation. I have to unlock by entering the password first before continue working, although I opened it last .

I log in by means of fingerprint.

I still use X. I do not know the process of that .

See photo attached.

IMG-a6ca3d2b86bc35e15113b3d8c63e6f1d-V

GHNewbiee commented 7 months ago

To summerize:

  1. A window may need:

    • "attention", or
    • not (standard/normal window)
  2. The focus state of a normal window may be:

    • usual , each new window gets focused
    • retained , (last) chosen window retains focus
  3. The focus state of a window that requires "attention" may be:

    • usual, as above
    • retained, as above
    • locking , first DE gets locked, next a kind of attention has to be given and last DE gets unlocked
    • informative, eg window frame becomes red and/or icon in task bar/panel flashing or its frame becomes red, too. Note: informative could be used in conjunction with all three states (usual, retained and locking)

Is there other option ?

GHNewbiee commented 7 months ago

Do X and Wayland protocols distinguish normal windows from windows requiring "attention"?

If not, could a kind of existing flag/option to be used instead of?

mattkae commented 7 months ago

That is a very good question. I know that X11 had an "urgent" hint for this use case (see: https://notes.secretsauce.net/notes/2014/03/19_x11-urgency-hint-and-notifications.html). I am tracing the Wayland form of this now. It looks like the following happened:

Mir doesn't support that protocol unfortunately. However, this protocol in theory passes focus from one surface to another (although, it says nothing about the urgency of the newly focused surface, but it is implied that it is "very" urgent)

mattkae commented 1 month ago

FYI: https://github.com/canonical/mir/pull/3639 :smile: