Giter Club home page Giter Club logo

Comments (19)

hluk avatar hluk commented on July 20, 2024

You can also copy the next or previous item in list without removing it -- not sure that it would be better -- it would be possible to copy items to a different tab and retrieve them any time.

Now you can paste item and select previous (no removal) with copyq eval 'paste();previous();'. But you need to activate the item you want to paste first in the main window or using "Copy next item" global shortcut -- but that's annoying :/.

So let's say I copy Bob, Smith and bobsmith@.... It would be stored in history in reverse order with the latest item selected. If I press the custom shortcut (e.g. ctrl+alt+v) I want Bob (the third item in the history) to be pasted first so it needs to be somehow found in the history.

Selecting the first item to paste could be simply done by checking the time when the item was copied -- i.e. the latest copied item is bobsmith@... and following is Smith which was copied few seconds before the latest item. Next item is Bob which is again only few seconds before Smith. Now, next item (if any) was copied a longer time ago so we've found Bob as the first candidate to paste. I guess the maximum interval between items can be up to 20 seconds (this would also allow user to reorder the items in list a bit).

Any ideas?

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

I like your idea about using the time between copies. I had never thought about that. I've been thinking about this feature for a long time but you've already thought through it better than I have.

I agree with what you say that you don't have to remove the item. In this issue I will use "pop paste" as the term because I can't think of a name for the other implementation/mode ("moving paste" ?).

I see two cases where the time-based system would not be ideal:
(1) Continually using a different shortcut might be annoying to some (ctrl+alt+v does not seem inconvenient to me but maybe it is for others).
(2) A user wants "pop paste" but with lots of time in-between copies.
For example, suppose you are reading a long article and want to copy some quotes while you read and then paste them all at once at the end. Or, suppose you need to read through a lot of resumes and copy only the name and phone number of a few special candidates. But I think copyQ might have other ways of dealing with these situations.

Another possibility is to have a shortcut turn "pop paste" mode on. When activated by this shortcut, copyQ would switch to a new tab that has two special properties set: FILO and "pop".

Then, there are three possibilities for how the user transitions back from "pop paste" mode to normal mode:
(1) Normal mode is restored by using the same shortcut that is used to turn "pop pate" on.
(2) This mode is turned off automatically when the special copyQ tab is empty (when the last item was popped off).
(3) This mode is turned off automatically if there is a copy after there has been a paste. For example, suppose you turn the mode on, copy 5 elements, (pop) paste 3, and then copy something else.

Any combination of the above three also makes sense.

from copyq.

hluk avatar hluk commented on July 20, 2024

In v1.8.2 I've implemented shortcuts "Paste and copy next/previous" to paste current clipboard and copy next/previous item in history. This seems to be the simplest solution for now. It's very close to what you describe but every time you need to start popping items you have to open copyq (tray menu or main window) or use "Copy previous item" shortcut and select the item you want to start with.

Having a new special tab when in "pop mode" could be quiet difficult to implement -- right now tabs don't have any properties or flags.

Well, the "pop" tab could be just a normal tab with some fixed name and items could be added with a custom shortcut (ctrl+alt+c) and paste+removed from the end of the tab with other shortcut (ctrl+alt+v). So there would be no special tab and no "pop mode".

Unfortunately you'll have to remember to use the shortcut to copy instead of ctrl+c and you'll have to remove the tab yourself if it's not needed anymore because otherwise the tab would be saved as normal tabs or paste+remove shortcut pastes something unexpected.

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

Thanks for implementing this. I can't seem to get it to work though. For me, "Paste and copy next" seems to be equivalent to "Copy next item" and same for "previous". Any ideas why the paste isn't getting executed/received? I've had this problem on Ubuntu 12.04 and 13.04.

from copyq.

hluk avatar hluk commented on July 20, 2024

These new command actually only send Shift+Insert key press to current window. So this won't work if application don't paste using Shift+Insert or target window and input widget are not focused yet.

What application is it? Does it work in any app?

Other thing is that the "copy next/previous" can happen before the clipboard is pasted to target app. I've solved it with additional small wait interval after sending Shift+Insert.

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

I was testing in Gedit. Shift+Insert works, but the paste from the "Paste and copy next" shortcut does nothing.
In LibreOffice 4.0.2.2 I sometimes get the message "Requested clipboard format is not available." Other than that, it seems to work decently well. It also works well in LyX and Chromium. In any of the applications, it doesn't work well if I execute the shortcut fast -- often the same item is pasted two or three times in a row and skips the others. (Note that I don't have a use case for needing to be able to do it fast; I'm just testing).

In any case, you might have done everything you could. I guess a lot of this depends on the OS and the applications. Thank you for your work on this.

from copyq.

hluk avatar hluk commented on July 20, 2024

OK, fixed.

Some apps like gedit ignore sent X11 events -- fortunately there is other way to do this, used e.g. by xdo utility.

You'll need libxtst-dev package. If you don't have the package installed (or it cannot be found) cmake will pop a warning and the old way will be used.

So if you can, please test it and close this task if it works well. I hope it will, I hate X11 and especially the API :).

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

It works great! It is much better than before. Thank you for sticking with this. This is a nice feature that I will use a lot and having to go to the menu to manually click where I want the starting point to be is not a problem for me at all. No more switching back and forth between applications to do mass copying!

I will note one thing (after which I think this can be closed). It sounds like you expect the compile to work if libxtst-dev is not installed. I tested this and got the following output:

$ cmake .
-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is GNU 4.7.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: /usr/bin/qmake (found version "4.8.4") 
-- Building with Qt 4.
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Building for X11 window system.
CMake Warning at src/platform/x11/x11platform.cmake:10 (message):
  X11 'TEST' extension library is needed to be able to automatically paste to
  some windows!
Call Stack (most recent call first):
  src/platform/platform.cmake:5 (include)
  src/CMakeLists.txt:57 (include)


-- Building with ItemWeb plugin.
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
X11_XTest_LIB (ADVANCED)
    linked by target "copyq" in directory /home/scott/IndependentInstalls/CopyQ/src

-- Configuring incomplete, errors occurred!

from copyq.

hluk avatar hluk commented on July 20, 2024

Oh, I'll fix that. Thanks for letting me know about this.

from copyq.

hluk avatar hluk commented on July 20, 2024

If you have problems with shortcuts (e.g. system shortcuts not behaving correctly) let me know. Closing.

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

You might have told me some other place, but currently cmake fails if libxtst-dev is not installed. A couple of comments up you suggest that this should not be the case. Is the policy now that it is required? I have no problem with this (I actually prefer it) but I just wanted to make sure that it is what you intended.

from copyq.

hluk avatar hluk commented on July 20, 2024

Can you post the cmake output? I assume the culprit is commit 0a12ba7.

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

I get the following output

-- Building for X11 window system.
CMake Warning at src/platform/x11/x11platform.cmake:11 (message):
  X11 'TEST' extension library is needed to be able to automatically paste to
  some windows!
Call Stack (most recent call first):
  src/platform/platform.cmake:5 (include)
  src/CMakeLists.txt:29 (include)


-- Building with ItemWeb plugin.

I tested the commit before the one you suspect and I still get the error.

from copyq.

hluk avatar hluk commented on July 20, 2024

That should be just a warning, i.e. it should continue after printing the message. Do you see any other error? Maybe with clean build?

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

You are right. I suppose I was confused because of the Call Stack output and the only four lines output afterward. But yes, the exit code of cmake is 0. However, when doing a clean build I get:

[ 55%] Building CXX object src/CMakeFiles/copyq.dir/platform/x11/x11platform.cpp.o
/home/scott/IndependentInstalls/CopyQ/src/platform/x11/x11platform.cpp:26:34: fatal error: X11/extensions/XTest.h: No such file or directory
compilation terminated.
make[2]: *** [src/CMakeFiles/copyq.dir/platform/x11/x11platform.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/copyq.dir/all] Error 2
make: *** [all] Error 2
$ 

from copyq.

hluk avatar hluk commented on July 20, 2024

Oh, I see. You can just remove the line for now (#include <X11/extensions/XTest.h> in src/platform/x11/x11platform.cpp). I'll fix it later today. Thanks for the report.

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

Sounds good. Actually I prefer to install the package. Also, note that in INSTALL, libxtst-dev is not listed as optional.

from copyq.

hluk avatar hluk commented on July 20, 2024

OK, I've fixed those (using github's internal editor, yay!).

from copyq.

scottkosty avatar scottkosty commented on July 20, 2024

Looks good. I like that you put descriptions for what the optional packages add.

from copyq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.