Hi all,
I'm writing a scenario with nitpicker where I want to support pop-ups e.g. for asking the user's password.
I made a simple GUI app with a textbox that pops up and disappears when required. However, whenever this popup appears I want nitpicker to immediately change focus to this popup and put it in front of all other nitpicker clients and windows. Now the behaviour is either "click", "transient" or "none", meaning the focus is only given when the user clicks on the window, or never.
This is a problem since if some other untrusted app is running in the background, the user could type in his password immediately when the pop-up appears, and the input is then directed to the app instead of the popup itself, allowing the untrusted app to read the password. The only way the user could enter the password correctly at the moment is by clicking on the pop-up before typing.
One solution would be handling the focus via a focus report-rom, however when the pop-up is not there I want nitpicker to use its default behaviour (together with the window manager) so that it focuses windows when they are clicked. Reimplementing this default behaviour so it produces the report in this case seems quite ugly.
Do you have any ideas what I could try to do to achieve the desired behaviour?
From nitpicker's readme:
The focus ROM is expected to have a 'label' attribute with the value
set to the label of the to-be focused client. When using an external focus policy, domains configured as "click" are internally handled like "transient" focusable domains. It is up to the external focus policy component to make a new focus permanent by providing an updated "focus" ROM."
What if I want to switch between an external and internal focus policy based on which apps are running? Do you think it is easiest to extend nitpicker to have a focus="always" attribute that always focuses a certain client whenever it is up? Or to write a separate complicated focus policy component responsible for all focusing?