cdown / clipmenu

Clipboard management using dmenu
MIT License
1.14k stars 91 forks source link

enhannce documentation to help configure CM_IGNORE_WINDOW #149

Closed savaged closed 3 years ago

savaged commented 3 years ago

Firstly, thanks for creating this neat utility.

I'm trying to have clipmenud ignore my password manager window. I've tried to follow the README but must be missing something. Here's my systemctl override:

[Service]
Environment=CM_IGNORE_WINDOW="/keep.+/gi"

Doesn't work.

maniac-en commented 3 years ago

Hey @savaged I was able to ignore Keepass using following steps:

  1. xdotool search --name keep getwindowname image

  2. export CM_IGNORE_WINDOW="KeePass"

  3. restart clipmenud

I guess the same process works for you in other apps as well!

savaged commented 3 years ago

Hi Shivam,

Thank you for taking the time to look into this. You taught me something new with how to get a window name; thanks for that. However, I'm afraid that hasn't worked for me yet. Here's what I did, in case you have time to help me again...

  1. I started Keepass and from within bash, I ran: xdotool search --name keep getwindowname which returned: Qt Selection Owner for keepassxc
  2. I ran: export CM_IGNORE_WINDOW="keepassxc"
  3. Then: systemctl --user restart clipmenud.service
  4. Just to check, I ran: env | grep CM_IGNORE_WINDOW which returned: CM_IGNORE_WINDOW=keepassxc
  5. Finally, I copied a password from within Keepass, checked my clipmenu and found the password was first in the list

I also did a similar set of steps but instead of just exporting the variable I added it to my .config/systemd/user/clipmenud.service.d/override.conf file, but got the same result.

It's not a big deal for me, so don't worry too much if you haven't the time just now.

Thanks again, David

maniac-en commented 3 years ago

Hey @savaged Can you please try passing the same value for cm_ignore_window which I did (written below again) as it worked for me! (with case-sensitivity)

export CM_EXPORT_WINDOW="KeePass"

Also, I'm not very well versed with systemd service environment, but if I'm not wrong you need to restart both clipmenud & clipnotify.

savaged commented 3 years ago

Hi Shivam, Thanks again for your help. I assumed you actually meant export CM_IGNORE_WINDOW not CM_EXPORT_WINDOW and tried again, this time with a full system restart. No change, sadly. I just wonder if it is because I'm using a tiling window manager and therefore there's no window title to pick up. But, like I said I'm not too worried. Kind regards David

AckslD commented 3 years ago

@savaged I'm not completely sure but wondering if the variable also need to be passed to PassEnvironment? In the systemd config file.

savaged commented 3 years ago

Firstly, thanks again for help offered. Here are the updated contents of my systemd 'unit file' at ~/.config/systemd/user/clipmenud.service.d/override.conf ...

[Service]
Environment=CM_IGNORE_WINDOW="keepass"
PassEnvironment=CM_IGNORE_WINDOW

I should point out I'm the opposite of expert with systemd. I tried the above after running systemctl --user daemon-reload and still find copying from Keepass (keepassxc) appears in my Clipmenu.

AckslD commented 3 years ago

No problem, I was just now figure out how to set it up myself (also far from expert with systemd :) ). This did work for me and the only difference I can see to your config is that I have KeePass instead of keepass and don't have any double-ticks ", i.e. instead

[Service]
Environment=CM_IGNORE_WINDOW=KeePass
PassEnvironment=CM_IGNORE_WINDOW

maybe as a last thing, also try to systemctl --user restart clipmenud.service

savaged commented 3 years ago

YES!! The removal of the quotes and change the case (keepass to KeePass) worked. Many thanks

AckslD commented 2 years ago

@maniac-en @savaged I was recently trying to also ignore seahorse without success and was wondering if you might have successfully done this?

I tried with CM_IGNORE_WINDOW=KeePass|seahorse, but didn't seem to work.

savaged commented 2 years ago

@maniac-en @savaged I was recently trying to also ignore seahorse without success and was wondering if you might have successfully done this?

I tried with CM_IGNORE_WINDOW=KeePass|seahorse, but didn't seem to work.

Sorry. I only got it to ignore KeyPass

cdown commented 2 years ago

@AckslD Works for me -- double check what xdotool getactivewindow getwindowname says about the window name.

AckslD commented 2 years ago

Thanks for the reply @cdown, what's your config?

If I do xdotool search --name seahorse getwindowname I get seahorse (didn't understand how to do xdotool getactivewindo getwindowname since it gives me the terminal).

cdown commented 2 years ago

@AckslD Now I think about it, this is probably #168, which needs a PR :-)

AckslD commented 2 years ago

I see, thanks for the information @cdown!