-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clipboard clearing not working when using Gnome on Wayland unless the window is focussed #4498
Comments
We are requesting the clipboard to be cleared. I know that there are sometimes problems with Gnome, but those are beyond our control, unfortunately. |
Fair enough. It may be good to document this so users who use Gnome with Wayland know not to expect the clipboard to be cleared if the window isn't focussed. Would it still be possible to get some functionality that clears the password when the window is focussed, or when a button is pressed? Or is manually putting something else on your clipboard (using Ctrl+c) just as effective? |
This was supposed to be fixed in #4165 This smells a lot like a Wayland bug or xwayland bug to be more exact. |
Since it works on X11 I think it's indeed something in Wayland. I have looked at where I can report that, but I haven't found the proper place yet. Do you maybe have a better idea of what the proper place would be? I also tested the older version that is in the repositories of Fedora (KeepassXC version 2.4.3), and it also fails to clear the clipboard after the timeout. Maybe it has something to do with this comment: #3704 (comment) ? Is there any way I can test that? I also tried running it with Edit: I have made a full dump, using Edit2:
In the dump from my first edit, there are only 2 data_source.sends (both To me this sounds like it's indeed something that has to be fixed in Qt or xWayland. I'm still not sure where I'd have to report that, so I'm open for suggestions. |
It's definitely not a Qt bug since it only happens when the window does not have focus. Also the fact that you copy data to the clipboard in the first place. This leads be to be 100% sure it is on the [x] Wayland side. |
The CLI uses xclip, so it's not surprising that it works. Wayland has a lot of bugs like this due to its new confinement model. It's also the reason why we cannot implement Auto-Type for it unless somebody builds a stable and standardised API for assistive technologies. I know there are some onscreen keyboards for Wayland, but none of that is even remotely ready for productive use. Same goes for trivial things such as checking whether capslock is enabled or not. |
I've found the same issue and thought it's a mutter bug as it works fine in Sway and reported it there: https://gitlab.gnome.org/GNOME/mutter/-/issues/1241 As it turns out, this does seem to be an issue on KPXC's side as it destroys the data source and creates a new one which is prohibited for unfocussed clients as it seems. The proper way, according to the comments in GitLab, would be to call |
Thanks for your message, I hadn't looked into it anymore. Since I did have some extra time today, I decided to test what you said, and changed the code as follows:
When running with WAYLAND_DEBUG=1 shows setting the clipboard as follows:
And clearing the clipboard as:
However, after this, the password can still be copied to other windows. So setting the data device selection to nil doesn't fix this issue when using Gnome (I also tried it without the Edit: In the meantime I have upgraded to Fedora 32, and the data in this post was when running Mutter 3.36.1 and Qt 5.13.2. |
Setting the selection to nil does work. Trying to do this while unfocused is what doesn't. |
Yes, you're right, I've changed it to "doesn't fix this issue" instead of "doesn't work". |
This is most definitely not our bug to fix. This is either a problem in Wayland, a problem in Qt, or both. |
I have the same problem with Keepassxc 2.4.3 in Ubuntu 19.04. I dont run Wayland echo $XDG_SESSION_TYPE = x11 |
Different bug, fixed in more recent versions of KeePassXC. |
The bug still exists in Fedora 33: After copying a password, the clipboard is never cleaned. The mono port of Keepass works... |
Is Mono even using Wayland at all? |
I don't know, but it runs on my system... |
Using keepassXc on fedora 36 i am still esperimenting this issue. Any tips? |
To anybody running into the same issue, because it's still not fixed in mutter, I solved it by adding a call to Here, in the void Clipboard::clearCopiedText()
{
…
if (m_lastCopied == clipboard->text(QClipboard::Clipboard)
|| m_lastCopied == clipboard->text(QClipboard::Selection)) {
setText("", false);
/* force a clipboard clean on Wayland */
QProcess::startDetached("/usr/bin/wl-copy", {"--clear"});
}
…
} And add |
I still have this issue with Wayland and KeePassXC 2.7.9. The
If I am correct, probably the solution for Wayland would be to not compare the current clipboard contents and just delete the clipboard. Obviously, this might be annoying if user already copied something else and it gets cleared, but I think it is still better solution than just exposing passwords in copyq. I mean something like the below:
|
What is copyq? Seems to need a bug report about not respecting the password hint flag in some situations. |
copyq is clipboard manager. It is respecting the password hint. It ignores the password when copied from KeePass. When password is copied, there are 3 formats in the clipboard:
The problem is, when KeePass clears the password after 10 seconds, copyq then stores the clipboard contents, because it only sees the If I have time I will try to compile KeePass with some timeouts in between the clearing calls and test when exactly is the password stored. |
Seems like odd behavior for copyq and still indicates a bug. The current value shouldn't be stored even though the passwordhint flag might be temporarily vacated. It's not like the current value all of a sudden doesn't become a password. That only happens when a new value is applied without the flag. |
Also seeing this behavior with KeePassXC 2.7.9 on Fedora 40 / GNOME 46 / Wayland. |
Still facing this issue in KeePassXC 2.7.9 on Ubuntu 24.04 LTS (GNOME 46 & Wayland). Clipboard is cleared if window is focused, but password is not cleared if window is not focused, which is mostly the case. |
@shivamkj install |
@droidmonkey Many Thanks. I had installed from Ubuntu PPA. Installing wl-clipboard from apt fixes the issue. Clipboard clearing is working fine now, even if KeepassXC window is not focused. |
Expected Behavior
After the timeout for the clipboard clearing has expired, I expect the clipboard to be cleared - regardless of whether or not the KeepassXC window is focussed.
Current Behavior
If you don't have the KeepassXC window focussed when it attempts to clear the clipboard, it fails to do so. It does so without giving a warning, and focussing the window later doesn't clear the clipboard either. Having the window focussed when the timeout ends does clear the clipboard (as expected).
Possible Solution
I don't know if there's a fix available, as I don't know anything about Wayland really.
If there is no fix available, maybe it's possible to give the user a warning message (or notification) that he has to focus the window to clear the clipboard, and then do so when focus is given to the KeepassXC window?
Steps to Reproduce
dnf
(this will give you version 2.5.3)Context
Because clearing the clipboard fails silently, and there is no indicator to show if the timeout has passed yet, there is always a bit of uncertainty if the clipboard is cleared or not. This is not a feeling I like to have around a password manager.
When starting GNOME on X11, the clipboard is cleared properly, hence I think it's a problem with the clearing on Wayland.
keepassxc-cli clip
does work as expected under Wayland, also without the terminal focussed.Debug Info
KeePassXC - Version 2.5.3
Revision: f8c962b
Qt 5.13.2
Debugging mode is disabled.
Operating system: Fedora 31 (Workstation Edition)
CPU architecture: x86_64
Kernel: linux 5.5.10-200.fc31.x86_64
Enabled extensions:
Cryptographic libraries:
libgcrypt 1.8.5
The text was updated successfully, but these errors were encountered: