hluk / CopyQ

Clipboard manager with advanced features
GNU General Public License v3.0
8.68k stars 441 forks source link

Play Sound on Copy doesn't work as expected #2494

Open TigBuh99 opened 1 year ago

TigBuh99 commented 1 year ago

Play Sound on Copy plays the sound simply on any time text is selected, that is even if the text is not actually copied.

  1. Select text to be copied
  2. Sound plays
  3. The clipboard is not updated until you press Ctrl+C
  4. When you do press Ctrl+C the sound plays again and the clipboard is updated.

The expected behavior is that the sound should play only when you press Ctrl+C

Version, OS and Environment

CopyQ v.7.0.0
  Kernel: 6.1.0-12-amd64 [6.1.52-1] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1.0-12-amd64 root=UUID=<filter> ro quiet splash
  Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 info: xfce4-panel wm: xfwm v: 4.18.0 vt: 7
    dm: LightDM v: 1.26.0 Distro: MX-23_x64 Libretto September 18  2023 base: Debian GNU/Linux 12
    (bookworm)
hluk commented 1 year ago

I assume the sound plays when X11 selection changes. You may need to disable the "Run automatic commands on selection" option in Preferences.

hluk commented 1 year ago

Actually, the command already handles that case if you use this command: https://github.com/hluk/copyq-commands/blob/master/Automatic/play-sound-when-copying-to-clipboard-linux.ini

TigBuh99 commented 1 year ago

Thank you for the possible solutions. Ιf I disable the "Run automatic commands on selection" option in Preferences it works. The other solution has the problem that VLC, which I use on my system, doesn't play the sound in the background. Instead of that it plays the sound, opens the program window (VLC) and VLC remains open on screen.

TigBuh99 commented 1 year ago

I changed the command of Play Sound on Copy to bash: cvlc --vout=none --play-and-exit ~/Wav/boing.wav and now VLC does not come up on screen when the sound is played.

However, this still requires the "Run automatic commands on selection" option in Preferences to be not enabled. If it's enabled, the sound plays if I only select anything to be copied.