cdown / clipmenu

Clipboard management using dmenu
MIT License
1.11k stars 90 forks source link

CM_IGNORE_WINDOW support for inactive windows #168

Closed duarm closed 5 months ago

duarm commented 3 years ago

The current method to detect if a program clipboard should be ignored or not is to look for the active window with xdotool, this is a straightfoward solution, but too indirect, it relies too much on the window system, and it also assumes the window you're copying from is the active one, which is not always the case. e.g. background processes, dmenu.

I wanted to use pinentry-dmenu as my pinentry client, but opening dmenu doesn't update the active window, which results in it not being ignored by clipmenu, and all my passwords are logged until I restart my session. I made a temporary script which waits for 45 seconds before deleting the password entry from the history as a workaround, but this is hacky, and I would need to find a different solution for every different program not detected by clipmenu.

Is there a better solution to detect if a program should be ignored or not, if there is, could you guys implement it? Thanks.

cdown commented 2 years ago

Feel free to submit a PR. CM_IGNORE_WINDOW is not used by any maintainer, so it's on community support. Maybe @Sohalt has some ideas. :-)

cdown commented 5 months ago

I think this now works in clipmenu 7? As we just look at _NET_WM_NAME for whatever window sends the request now I believe it should work now (https://github.com/cdown/clipmenu/blob/70cc5d2b6a2027ba186f1555c0e114c53dc7c578/src/x.c#L10), but feel free to comment and I'll reopen if that's not the case.