nCryptAgent icon indicating copy to clipboard operation
nCryptAgent copied to clipboard

nCryptAgent popup appears, current maximized window resizes and message appears

Open soywiz opened this issue 1 year ago • 6 comments

https://github.com/unreality/nCryptAgent/assets/570848/dfbe6670-803c-4e1c-a598-9064746932c8

Would it be possible to prevent that behaviour from happening? I believe this is program is super useful as I come from mac with Secretive. I have tried to clone the repo and I was able to remove the message, but since I don't have GO experience coudln't figure out how to prevent the current window change its size or nCryptAgent dialog appearing.

soywiz avatar Jan 28 '24 08:01 soywiz

I'll try do some investigation, i imagine by stealing focus ncrypt forces the other app out of maximised mode. Perhaps some improvements to the focus-stealing logic can be done as well (eg if the pin cache is still in effect, dont steal focus)

unreality avatar Jan 28 '24 12:01 unreality

What's the reason nCryptAgent requires stealing the focus when a key operation is requested?

soywiz avatar Jan 30 '24 11:01 soywiz

If nCryptAgent doesnt take focus, the PIN prompt for smartcards, or FIDO2 authentication prompt etc, pops under the current window, and its not clear the operation requires user interaction to proceed. Taking focus forces those UI prompts to be visible to the user.

If you have no PIN etc then stealing focus is not required. Im unsure whether this can be determined without requesting an operation though.

unreality avatar Jan 30 '24 12:01 unreality

Thanks for the clarification, it makes sense. Could it be possible to add a checkbox in the settings to disable the focus? I don't have pin there and if I had, it would be okay to switch the focus manually once per session.

soywiz avatar Jan 30 '24 12:01 soywiz

@soywiz try pre-release v0.0.7, and let me know if it fixes the issue for you. If your key has no PIN/Password you can set noPin to true for your key in %AppData%\nCryptAgent\config.json and it will no longer take focus, but it should return focus correctly, leaving windows maximised if they were already even without doing this.

unreality avatar Feb 04 '24 02:02 unreality

Nice! verified that the current fullscreen app doesn't restore Thanks!

I have noticed a few things:

  • The ncrypt window still appears briefly when using the key
  • When unchecking Show Notifications saving, and closing the app and reopening, the Show Notifications still appears marked.
  • When saving the settings, the noPin setting I manually wrote is not preserved

Here's a small video showing this:

https://github.com/unreality/nCryptAgent/assets/570848/848123dc-2cc7-4e8a-b785-fd929e51a907

In any case, just by not restoring the window size it has improved a lot. Thanks you very much for looking into this 👏🙏!

soywiz avatar Feb 04 '24 18:02 soywiz