CristianHenzel / ClipIt

ClipIt clipboard manager for GTK+
https://github.com/CristianHenzel/ClipIt
GNU General Public License v3.0
650 stars 84 forks source link

Feature request: Work in gnome-terminal or programs where paste shorcut isn't ctrl + v #201

Open danielgiljara opened 2 years ago

danielgiljara commented 2 years ago

Clipit doesn't work on terminal, where the paste shorcut is Ctrl + Shift + V.

danielgiljara commented 2 years ago

I made the following patch for me and it works ok: `diff --git a/src/main.c b/src/main.c index 148753b..7e22c7d 100644 --- a/src/main.c +++ b/src/main.c @@ -338,7 +338,7 @@ static void item_selected(GtkMenuItem menu_item, gpointer user_data) { save_history(); / Paste the clipboard contents automatically if enabled */ if (prefs.automatic_paste) {

I close the ticket.

danielgiljara commented 2 years ago

I used finally this patch to detect if the currently active window is gnome-terminal: ` diff --git a/src/main.c b/src/main.c index 148753b..ad7050a 100644 --- a/src/main.c +++ b/src/main.c @@ -338,7 +338,7 @@ static void item_selected(GtkMenuItem menu_item, gpointer user_data) { save_history(); / Paste the clipboard contents automatically if enabled */ if (prefs.automatic_paste) {

Moini commented 1 year ago

Why did you close it? Please reopen. It would be useful to be able to select the paste command per application within clipit.

Moini commented 1 year ago

(and not only for people who know how to program, but for everyone!)

danielgiljara commented 1 year ago

Yes, I don't had to close it. I reopen.

danielgiljara commented 1 year ago

One question, did you found a manner to paste without xdotool?

Moini commented 1 year ago

Thank you! No, I've currently deactivated the option to paste when clicking on an entry in the list, so I can choose the way how I paste.

danielgiljara commented 1 year ago

What list? >.<

danielgiljara commented 1 year ago

Do you want that I put a PR with the bash solution?

Moini commented 1 year ago

I haven't tested it - how does it detect whether the target program is a terminal? I'm using Konsole, or sometimes Xfce-Terminal and others.

Optimally, I think it would offer a way to select programs that require a different pasting mechanism. If those can be autodetected, that would be cool, but I'm not sure that is possible?

danielgiljara commented 1 year ago

The solution I proposed only detects when is gnome-terminal via bash, which is my case. Ideally it should use the X mechanism to paste, in this way it doesn't matter if is Ctrl + V or Ctrl + Shift + V or any other.

Moini commented 1 year ago

I didn't know there was another way, that already provides the 'auto-detection'! Can this 'X mechanism' (probably provided by the xserver) be included somehow?

danielgiljara commented 1 year ago

I've a patch, that checks via BASH scriptting (inside the command) if the process of the current window is the gnome-terminal and uses Control + Shift + V in that case. If you want I open a PR to give you that changes. It is not too elegant... but it works.

danielgiljara commented 6 months ago

Hello Moini. Let me accces to publish a PR and I've you the code patched. With this gnome-terminal is supported.

Moini commented 6 months ago

I'm using konsole :-(

danielgiljara commented 6 months ago

Hello Moini. Please, think about it. If you accept my patch you can do work ClipIt in gnome also in kde, doing it more universal and more unified. It not hurts!!! :)

Moini commented 6 months ago

I'm just a user, just like you @danielgiljara .

danielgiljara commented 6 months ago

Ah, ok, in this case we can add the konsole command also if is different to ctrl-c like in gnome terminal. In this way we have ClipIt for all programs, and advice the author of Clipit to include these changes through a Pull Request.