cdown / clipmenu

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

Cannot get `$CM_IGNORE_WINDOW` to work #204

Closed xfzv closed 1 year ago

xfzv commented 1 year ago

I'm using AwesomeWM / X11. I cannot get $CM_IGNORE_WINDOW environment variable to work.

run() { ! pgrep -f "$1" && { "$@" & } }

run clipmenud
export CM_IGNORE_WINDOW="KeePassXC"
export CM_LAUNCHER="rofi"

The environment variables are printed in the terminal:

❯ echo $CM_IGNORE_WINDOW
KeePassXC

❯ echo $CM_LAUNCHER
rofi

$CM_LAUNCHER=rofi works as expected.

However, when I copy some text from KeePassXC window and run clipmenu, the text I copied appears, whereas it shouldn't.

The KeePassXC window name seems correct:

sleep 2s ; xdotool getactivewindow getwindowname
redacted.kdbx [Locked] - KeePassXC

I also tried with the systemd user unit with Environment=CM_IGNORE_WINDOW=KeePassXC, to no avail.

If I disable clipmenud from my autorun.sh and manually run the following from the terminal:

CM_IGNORE_WINDOW="KeePassXC" CM_LAUNCHER="rofi" clipmenud

the two environment variables aren't passed at all but clipmenu works normally via dmenu.

Thanks in advance.

xfzv commented 1 year ago

Nevermind, I figured it out.

I had to use the environment variables directly in autorun.sh:

export CM_IGNORE_WINDOW="KeePassXC"
export CM_LAUNCHER="rofi"
run clipmenud

I guess the environment variables were read after clipmenud was run from autorun.sh.