IJHack / QtPass

QtPass is a multi-platform GUI for pass, the standard unix password manager.
https://qtpass.org/
GNU General Public License v3.0
1.03k stars 162 forks source link

Set correct WM_CLASS for the qr-code popup #506

Closed Spheerys closed 4 years ago

Spheerys commented 4 years ago

Hi :)

With the last QtPass version, we get the very usefull feature "QRCode" to show a popup with a flashing code. However, the windows popup as no WM_CLASS set as you can see with the xprop command :

_NET_WM_DESKTOP(CARDINAL) = 0
_NET_WM_STATE(ATOM) = 
WM_STATE(WM_STATE):
        window state: Normal
        icon window: 0x0
_NET_WM_USER_TIME(CARDINAL) = 77541995
_NET_WM_ICON_NAME(UTF8_STRING) = 
_NET_WM_ICON(CARDINAL) = 
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) =
_NET_WM_NAME(UTF8_STRING) = "QtPass"
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x5c00008
WM_HINTS(WM_HINTS):
        Client accepts input or input focus: True
        window id # of group leader: 0x5c00008
WM_CLIENT_MACHINE(STRING) = "narayan"
_NET_WM_PID(CARDINAL) = 3844489
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 96469023
WM_CLASS(STRING) = "qtpass", "QtPass"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        user specified size: 111 by 111
        window gravity: Static

I'm using i3-wm as window manager and I whould set specific action for this popup (be in floating mode to be precise, but it's another topic). But to do this, I have to target this kind of window, and the WM_CLASS whould be very convenient for this stuff :) A string like "qtpass-qrcode", "QtPass-qrcode" whould be nice :)

annejan commented 4 years ago

The popup is a QLabel without explicit parent.

I'm looking to see how to set a WM_CLASS on that . .

annejan commented 4 years ago

I have wrapped the QLabel in a QDialog which is auto-positioned on the icon and behaves like a tool-tip of sorts . . Screenshot 2020-01-24 at 14 16 07 Hope this helps 😄

Spheerys commented 4 years ago

Thanks :) I will test this when the new release will be available :)

annejan commented 4 years ago

Should be somewhere next week :)

Spheerys commented 4 years ago

Humm sorry but it's still not working :(

You're QLabel inside QDialog improvement don't permit to filter the popup with the WM_CLASS name.

I have made a small search and for a long time, it was not possible to set it with QT : https://github.com/lxqt/qterminal/issues/334 https://github.com/akiyosi/goneovim/issues/78

... but it was several years ago.... What about today ?

kenji21 commented 3 years ago

is it part of version 1.3.2 ? I don't have the qrcode button next to the copy one