rofimoji icon indicating copy to clipboard operation
rofimoji copied to clipboard

Alt+(some number) paste does not work

Open NikolaB131 opened this issue 1 year ago • 24 comments

Hello! I am using Arch with Hyprland. The picker works great when I use rofimoji -a clipboard and press enter. However, when I use Alt+(some number) to select from the recent items, it simply does not paste anything (tested in chrome, vscode).

When I run rofimoji -a clipboard from the alacritty terminal, I get 4~ as output.

NikolaB131 avatar Feb 13 '25 10:02 NikolaB131

Could you please test it with a simple text editor (something not Electron- or Chrome-based), please?

And which clipboarder do you use?

fdw avatar Feb 13 '25 15:02 fdw

In Vim (launched through rofi), nothing is printed, and the same situation in the Gnome text editor clipboarder: wl-clipboard 1:2.2.1-2 and i dont have xsel or xclip installed

NikolaB131 avatar Feb 13 '25 17:02 NikolaB131

Is the character added to the clipboard?

fdw avatar Feb 13 '25 20:02 fdw

No, only a newline is added to the clipboard. For example, if I try to use the recent emoji five times, the first line will be my copied text, and then five empty lines.

I also noticed an interesting behavior: if I copy anything and then try to use a recent emoji, it will work only once (until I copy something else).

NikolaB131 avatar Feb 13 '25 20:02 NikolaB131

Nevermind, it sometimes works, but it's completely random and I can't see any logic behind it.

NikolaB131 avatar Feb 13 '25 20:02 NikolaB131

And also when it works, 1 newline anyways adding to my buffer

NikolaB131 avatar Feb 13 '25 20:02 NikolaB131

if I try to use the recent emoji five times, the first line will be my copied text, and then five empty lines.

Can you please explain this in more detail? What exactly do you do, what do you press?

if I copy anything and then try to use a recent emoji, it will work only once

So, you have something in the clipboard, then you use rofimoji to insert a recent emoji via the clipboard, it works. You open rofimoji again and hit Alt+<number> and now it doesn't insert anything?

fdw avatar Feb 14 '25 18:02 fdw

Hey, have you made any progress here?

fdw avatar Mar 08 '25 08:03 fdw

I'm sorry for taking so long to respond. I have figured out the issue. If I press "Alt" and a number and then quickly release the "Alt" key, it will always paste. However, if I am slow and don't release the "Alt" button after pressing "Alt" + the number, nothing will paste.

And newline is anyways adds to my buffer

NikolaB131 avatar Mar 28 '25 09:03 NikolaB131

I think I found a bug in the code to restore the previous clipboard contents. Could you please try the branch fix/restore-clipboard-content to see if it still works and if you still get the newlines?

fdw avatar Mar 29 '25 12:03 fdw

Checked out on your branch and installed it with pipx install . But bug is still here

Nikolai141 avatar Mar 29 '25 14:03 Nikolai141

Do you have anything in the clipboard before you invoke rofimoji?

fdw avatar Mar 29 '25 16:03 fdw

Yes

NikolaB131 avatar Mar 30 '25 17:03 NikolaB131

So, to recap, you start rofimoji with rofimoji -a clipboard. You type Alt+1 (for example) to paste your most recent character into some app. Does the character appear? And after that, a newline character is added?

fdw avatar Apr 05 '25 19:04 fdw

Does it work for you now, @NikolaB131?

fdw avatar May 10 '25 11:05 fdw

Since I got no more feedback, I'll close this issue. If something comes up again, feel free to re-open this.

fdw avatar Jun 01 '25 07:06 fdw

So, to recap, you start rofimoji with rofimoji -a clipboard. You type Alt+1 (for example) to paste your most recent character into some app. Does the character appear? And after that, a newline character is added?

Sorry for long respond again :( Yes i start rofinoji with rofimoji -a clipboard --selector rofi. Then select recent emoji with Alt+1, character is not appears, and if i try to paste something from my buffer with Ctrl+v, then it pastes what i copied earlier with newline symbol. And if i try to select recent emoji for example 5 times, then in my buffer will be 5 newlines

NikolaB131 avatar Jun 04 '25 08:06 NikolaB131

Can you please try wl-copy 🤞 and see if it's now in the clipboard? What happens with wl-copy --primary 🤞?

Secondly, some more questions:

  • Can you please confirm that you use Wayland?
  • Do you use a clipboard manager?
  • Is it only broken for recent characters, or for all?

fdw avatar Jun 04 '25 17:06 fdw

wl-copy 🤞 - yes, its in clipboard and pastes correctly wl-copy --primary 🤞 - nothing, clipboard stays same as it was before command

  • Can you please confirm that you use Wayland? - yes, i am (hyprland)
  • Do you use a clipboard manager? - no
  • Is it only broken for recent characters, or for all? - only for recent, pasting with direct search + pressing enter works correctly every time

NikolaB131 avatar Jun 05 '25 16:06 NikolaB131

Could you please look into .local/share/rofimoji/recent and look at the files there? Is there something weird in them? Could you maybe even post them, if you feel comfortable sharing?

fdw avatar Jun 05 '25 19:06 fdw

I have 1 file in this directory, containing this:

🐺
😮
😄
😀
🔥
🫥
🤑
🤯
👆
🥳

Seems like totally normal history

NikolaB131 avatar Jun 06 '25 11:06 NikolaB131

Yep, that does look good. My best guess is that the alt key interferes somehow. Unfortunately, there's no way to change it yet (see #218).

You could try if pressing alt+p works for the non-recent selection. That should use the same insertion method.

fdw avatar Jun 06 '25 19:06 fdw

Yes, that's 100% something with interferes of alt key, because if i quickly enough unpress alt key after alt+1, then the correct emoji is printed. And even more, if i choose emoji not from recent with regular enter and then press alt, emoji will not be pasted

NikolaB131 avatar Jun 10 '25 11:06 NikolaB131

Hm, that makes it difficult to fix: --action clipboard works by simulating pressing shift + insert. If you "keep" alt pressed, though inadvertently, it's alt + shift + insert, which does nothing.

The only option for rofimoji would be to introduce a small delay before simulating the key presses, but that's a thin line between "it works" and "it's taking too long".

fdw avatar Jun 10 '25 17:06 fdw

Yeah, I don't think idea with delay solve problem. Anyway, thanks for the tool!

NikolaB131 avatar Jun 13 '25 13:06 NikolaB131

I had one more idea how we could work around this. Could you please try the branch test/depress-alt and see if that works and/or behaves weirdly? Thank you 🙂

fdw avatar Jun 19 '25 16:06 fdw

Just tested that branch, unfortunately, behavior does not change at all

NikolaB131 avatar Jul 21 '25 22:07 NikolaB131

Pity, but thanks for testing. Then I'm out of ideas. If you have any, please re-open the ticket.

fdw avatar Jul 22 '25 15:07 fdw