SUPERCILEX / clipboard-history

Ringboard—the clipboard manager for Linux
Apache License 2.0
164 stars 5 forks source link

ENTER or CTRL+N doesn't paste, but puts the element as the last copied. #27

Closed ivan-toriya closed 2 months ago

ivan-toriya commented 2 months ago

OS: Debian 12 DE: GNOME 43.9, wayland

How to reproduce?

  1. Place the cursor where you want to paste.
  2. Open the Ringboard egui.
  3. Select the entry that you want to paste and press ENTER (or just select with CTRL+N)
  4. Nothing happens.
  5. Press CTRL+V, the selected entry at step 3 get pasted.

I don't understand if it's intended behavior or a bug. I would like the entry to be pasted at step 3 directly. If it's intended behavior, the docs should be edited.

jacobcheatley commented 2 months ago

Can confirm I have the same behaviour.

OS: Ubuntu 24.04 DE: Gnome 46.0, X11

Installation Method/Setup Is as recommended by the automatic installation in the main README.

  1. Install cargo
  2. rustup install nightly # If not already installed
  3. curl -s https://raw.githubusercontent.com/SUPERCILEX/clipboard-history/master/install-with-cargo-systemd.sh | bash
  4. bash -c 'echo sh -c \"ps -p \`cat /tmp/.ringboard/$USERNAME.egui-sleep 2\> /dev/null\` \> /dev/null 2\>\&1 \&\& exec rm -f /tmp/.ringboard/$USERNAME.egui-sleep \|\| exec $(which ringboard-egui)\"'
    • This produced sh -c "ps -p `cat /tmp/.ringboard/jacob.egui-sleep 2> /dev/null` > /dev/null 2>&1 && exec rm -f /tmp/.ringboard/jacob.egui-sleep || exec /home/jacob/.cargo/bin/ringboard-egui"
  5. Created a custom shortcut with the produced command image

And reproduction notes the same as above, though I want to specify that instead of nothing happening after step 3 for me, the ringboard GUI closes and then the active window becomes whatever the active window was before the GUI was opened (with nothing directly pasted in - that's the unexpected part!).

SUPERCILEX commented 2 months ago

The current behavior works as the code is written, but it would be nice to eventually auto-paste for you. The problem is that there's no such thing as "please paste." A window has to actively seek to read the clipboard and AFAIK there's no standard to trigger a paste. So the hacky way around it is to send keyboard events simulating a user typing a paste. I had tried this and couldn't get it to work 100%, but I think I'll throw it up under a config.

SUPERCILEX commented 2 months ago

Ok, this is implemented but might still be a little buggy. You guys can install the dev version by running:

git clone https://github.com/SUPERCILEX/clipboard-history.git
cd clipboard-history
cargo install --path x11 --debug --no-default-features

Let me know if it ever fails to paste.

jacobcheatley commented 2 months ago

Oh wow, thank you, that was very quick! And seems to be working without issues in all the applications I quickly tested (i.e. Chrome, VSCode, gedit, gnome-terminal). Much better than my not-quite-working attempt at a workaround I made yesterday with xdotool

SUPERCILEX commented 2 months ago

Woohoo! That's great to hear. I'm going to let it bake on my machine a bit more, but I'll make an official release in like a week or two.

SUPERCILEX commented 2 months ago

Released! https://github.com/SUPERCILEX/clipboard-history/releases/tag/0.6.0

ivan-toriya commented 2 months ago

It only works with X11, right?

SUPERCILEX commented 2 months ago

I'm not sure. It might work in Wayland, but that hasn't been tested.