Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I remove all of the images from CopyQ, yet keep all of the text? #1687

Closed
Raytle opened this issue Jun 22, 2021 · 15 comments
Closed
Labels
feature New feature request

Comments

@Raytle
Copy link

Raytle commented Jun 22, 2021

How can I remove all of the images from CopyQ, yet keep all of the text?

I fruitlessly perused the CopyQ issues here on github, the CopyQ documentation, as well as Stack Overflow.

In case it matters, here's my use case...

Sometimes I'll spend a couple of hours copying and pasting many images. During that time I want those images kept in CopyQ. However, when I am done with my session—that is, a couple of hours copying and pasting—I want to remove all of the images from CopyQ, yet keep all of the text.

@Raytle Raytle added the feature New feature request label Jun 22, 2021
@hluk
Copy link
Owner

hluk commented Jul 2, 2021

To remove all images from current tab:

  1. Search (Ctrl+F) for image/.*.
  2. Press Ctrl+A.
  3. Press Delete to delete all selected items.

I think much better way is to automatically store images in a separate tab:

[Command]
Automatic=true
Command="
    copyq:
    var imageTab = '&Images';

    function startsWith(text, what) {
        return what === text.substring(0, what.length)
    }

    function hasImageFormat(formats) {
        for (var format of formats.values()) {
            if (startsWith(format, 'image/'))
                return true;
        }
        return false;
    }

    var formats = dataFormats();
    if (hasImageFormat(formats)) {
        setData(mimeOutputTab, imageTab);
    }"
Icon=\xf302
Name=Image Tab

@Raytle
Copy link
Author

Raytle commented Jul 2, 2021

Search (Ctrl+F) for image/.*.
Press Ctrl+A.
Press Delete to delete all selected items.

That worked. Thank you!

I think much better way is to automatically store images in a separate tab:

I agree with you.

Therefore, I appended GlobalShortcut=ctrl+shift+1 to the end of your code so that I ended up with this... https://i.imgur.com/uV3ZRrY.png. However, when I pressed ctrl+shift+1 the image shown here... https://i.imgur.com/rloyjlV.png did not move from my clipboard tab to my Images tab.

What do you think I did wrong?

@Raytle
Copy link
Author

Raytle commented Jul 2, 2021

By the way, I am using CopyQ v3.10.0 on Lubuntu 20.04 LTS.

@Raytle
Copy link
Author

Raytle commented Jul 2, 2021

Also, here are some error messages I received immediately after I pressed ctrl+shift+1 https://i.imgur.com/TZVnvmS.png

@hluk
Copy link
Owner

hluk commented Jul 2, 2021

Also, here are some error messages I received immediately after I pressed ctrl+shift+1 https://i.imgur.com/TZVnvmS.png

That won't work. It is an "automatic" command which means that is triggered on new clipboard content, not on a shortcut.

@Raytle
Copy link
Author

Raytle commented Jul 2, 2021

That won't work. It is an "automatic" command which means that is triggered on new clipboard content, not on a shortcut.

It does not work "automatically" for me. In other words, images show up on my clipboard tab not on my Images tab.

@hluk
Copy link
Owner

hluk commented Jul 4, 2021

That won't work. It is an "automatic" command which means that is triggered on new clipboard content, not on a shortcut.

It does not work "automatically" for me. In other words, images show up on my clipboard tab not on my Images tab.

Are there any errors in logs (F12 shortcut from main window)?

Maybe some other automatic command is interfering?

@Raytle
Copy link
Author

Raytle commented Jul 4, 2021

Are there any errors in logs (F12 shortcut from main window)?

Please see... https://controlc.com/3c791fb5

When I use the code you provided to me in #1687 (comment) the following pops up on my screen immediately after I copy a screenshot... https://i.imgur.com/M4cPjCb.png

Maybe some other automatic command is interfering?

How would I go about determining if another automatic command were interfering?

@Raytle
Copy link
Author

Raytle commented Jul 4, 2021

Have you tested the code in #1687 (comment)?

Does it work properly for you?

@hluk
Copy link
Owner

hluk commented Jul 8, 2021

Have you tested the code in #1687 (comment)?

Does it work properly for you?

Yes.

Did you copy the command code (starting with [command]) to the Command dialog using the "Paste Commands" button (or Ctrl+C to the command list)? Described also here: https://copyq.readthedocs.io/en/latest/faq.html#how-to-load-shared-commands-and-share-them

Are you using a recent CopyQ version?

@Raytle
Copy link
Author

Raytle commented Jul 9, 2021

Have you tested the code in #1687 (comment)?

Does it work properly for you?

Yes.

Thanks for letting me know. I appreciate that.

Did you copy the command code (starting with [command]) to the Command dialog using the "Paste Commands" button (or Ctrl+C to the command list)? Described also here: https://copyq.readthedocs.io/en/latest/faq.html#how-to-load-shared-commands-and-share-them

  1. I copied the command code (starting with [command]) to the Command dialog using the "Paste Commands" button.
  2. I followed the directions at: https://copyq.readthedocs.io/en/latest/faq.html#how-to-load-shared-commands-and-share-them
  3. Seven days ago, in How can I remove all of the images from CopyQ, yet keep all of the text? #1687 (comment) I sent you the following screenshot... https://i.imgur.com/uV3ZRrY.png.

Are you using a recent CopyQ version?

I am using...

y@y-peppy:~$ copyq -v
CopyQ Clipboard Manager v3.10.0
Qt: 5.12.5
Compiler: GCC
Arch: x86_64-little_endian-lp64
OS: Ubuntu 20.04.2 LTS

@hluk
Copy link
Owner

hluk commented Jul 9, 2021

I sent you the following screenshot... https://i.imgur.com/uV3ZRrY.png.

Sorry I missed the screenshot. BTW, I think you can paste screenshots directly on github comment which would show a small preview.

Can you update to new version of CopyQ? You can install the latest version from PPA.

Otherwise you would need to change the for loop - I haven't tested this but it would be something like:

        for (var i in formats) {
            if (startsWith(formats[i], 'image/'))
                return true;
        }

@Raytle
Copy link
Author

Raytle commented Jul 9, 2021

Otherwise you would need to change the for loop - I haven't tested this but it would be something like:

    for (var i in formats) {
        if (startsWith(formats[i], 'image/'))
            return true;
    }

That worked! Thank you!

I was able to rename the tab from images to Images Clipboard. However, when I renamed clipboard to Text Clipboard after copying text, a new tab named clipboard was created. In other words, I currently have three tabs that look like this..

However, I want two tabs that look like this..

Finally—ideally, but not necessarily—I'd like to be able to change the font color and background color of the tabs.

@hluk
Copy link
Owner

hluk commented Jul 10, 2021

I was able to rename the tab from images to Images Clipboard.

Make sure you change the var imageTab = '&Images'; line in the command.

However, when I renamed clipboard to Text Clipboard after copying text, a new tab named clipboard was created. In other words, I currently have three tabs that look like this..

This also needs to be changed in configuration "Tab for storing clipboard", under History tab. I'll try to improve this.

Finally—ideally, but not necessarily—I'd like to be able to change the font color and background color of the tabs.

You need to change the colors in Appearance config tab (enable "Set colors for tabs, tool bar and menus" option and you can click Edit Theme button to modify separate GUI elements or edit style sheet files directly).

For more info, see: https://copyq.readthedocs.io/en/latest/theme.html


Please open separate issue on github if you have another question.

@hluk hluk closed this as completed Jul 10, 2021
@Raytle
Copy link
Author

Raytle commented Jul 11, 2021

First and foremost, thanks for spending your time to work with me on this issue. I appreciate that very much.

I was able to rename the tab from images to Images Clipboard.

Make sure you change the var imageTab = '&Images'; line in the command.

Thanks. Yes. Of course, I had already done that in order to rename the tab from "images" to "Images Clipboard".

However, when I renamed clipboard to Text Clipboard after copying text, a new tab named clipboard was created. In other words, I currently have three tabs that look like this..

This also needs to be changed in configuration "Tab for storing clipboard", under History tab.

Clearly you meant "Preferences" not configuration. I hunted around for "configuration" initially but, well, of course, I didn't find "configuration" because it does not exist.

I'll try to improve this.

I want to ensure we understand one another.

To me at least, it seems that the user should be able to right mouse click on the tab and rename it. Does that make sense to you? In other words, perhaps it makes sense to you, but to me it seems utterly bizarre to go to Preferences –> History to need to accomplish this. I am not complaining, rather I am explaining.

Finally—ideally, but not necessarily—I'd like to be able to change the font color and background color of the tabs.

You need to change the colors in Appearance config tab (enable "Set colors for tabs, tool bar and menus" option and you can click Edit Theme button to modify separate GUI elements or edit style sheet files directly).

For more info, see: https://copyq.readthedocs.io/en/latest/theme.html

I just glanced at it. I'll try actually implementing it a custom theme when I have a chance.

I urge you to include a link to a site such as... https://htmlcolorcodes.com/color-picker/ which a little explanation indicating something like..

  1. The term hexadecimal is typically abbreviated "hex" or "HEX".
  2. "Go to https://htmlcolorcodes.com/color-picker/ (or search on Google for something like "online hexadecimal color chooser"), then
  3. Click on the color you want, then
  4. Copy the hexadecimal value (also known as the "hex value" or "HEX value") of that color, then
  5. Find the file named foo.xml which is probably located in path ~/ABC or path ~/XYZ.
  6. As a precaution, we suggest that you make a copy of the file named foo.xml named something like foo- backup in case I make a mistake.xml. (If you aren't sure how to copy a file, in your file browser, try right clicking on the file with your mouse or look through the pull down menus).
  7. In case were you make a mistake with foo.xml which you were unable to find, then you should delete foo.xml, make a copy of foo- backup in case I make a mistake.xml, and finally rename that to foo.xml.
  8. Open file foo.xml with your text editor (not with your web browser).
  9. Then paste the hexadecimal value (which might be abbreviated "hex" or "HEX") next to any place where you find #RGB" in the file foo.xml.
  10. Obviously, you can use different hexadecimal values for different colors so that, for example, you might use one hexadecimal value for the foreground color of a particular font and another hexadecimal value for the background color of that same font.
  11. After you are done editing foo.xml—that is, after you have copied and pasted one or more hexadecimal values to the file foo.xml—then save foo.xml, then
  12. If were to you open CopyQ and notice that something had gone wrong, it is likely that you made a mistake when you edited foo.xml, then
  13. Do not panic... yet. (That's a little joke). If you don't find a mistake in foo.xml don't worry instead simply,
  14. Quit out of CopyQ, then
  15. Delete foo.xml, then
  16. Make a copy of foo- backup in case I make a mistake.xml which you name foo.xml (so that you now have essentially restored foo.xml to its original pristine status, free of any errors you probably inadvertently introduced into the copy of foo.xml which you just deleted), then
  17. Open CopyQ again.

Why did I bother mentioning the steps above? I remember about ten years or ago, when I finally figured out this "hexadecimal color thing" and "Don't double-click on .XML files because they will open in Firefox or Google Chrome (whichever was my default browser at the time)", I was annoyed. I was thinking to myself, "Uh. Yeah. Right. Look. Mr. Developer. Ok? To us 'non-engineers' we have no idea whatsoever how to find the hexadecimal value of a color. We don't think about base 2, base 16 or any of that stuff either. And look. We ordinary users normally simply double-click to open files in order to edit them. And yeah. We sometimes 'mess up' when we edit files. Therefore, having us make a backup in advance can be helpful. Therefore, please spend a few minutes and explain this to us."

Please don't be offended. I know this is a FOSS project for which you volunteering your time. I think CopyQ is great. But this last feature remind me of...

This Is What Happens When You Let Developers Create UI

"Deep down inside every software developer, there's a budding graphic designer waiting to get out. And if you let that happen, you're in trouble. Or at least your users will be, anyway..."

It seems to me that to change the color of a tab a user should right click on the tab. Specifically, when a user right mouse clicks on the tab labeled "Sheet1", the user sees an option to change the tab color.

Image 1

That method works in LibreOffice Cal, Google Sheets, and Microsoft Excel. Put simply: at least in the "world of spreadsheets" that method for changing the tab color appears to be a standard. In my mind, it's also a "solved problem"; meaning, it's a problem that has been solved elegantly. Therefore—it seems to me—that it should be added to CopyQ. However, in case it would be too much work for you to add it to CopyQ, then I suggest adding an option named, "Change Tab Color" to the menu that appears when a user right clicks on a tab, by which I mean this menu...

Image 2

with a link to the appropriate section of https://copyq.readthedocs.io/ which explains how to change the color of a tab.

Of course please feel free to add the following to discussions if you like it.

Finally, I think that it would be nice—but of course not necessary—if CopyQ were to have a Setup Wizard. I imagine one of the options in that set up wizard would be "Would you like two separate clipboards: one for text and one for images? (Having these two separate clipboards tends to be very helpful if you frequently copy text and frequently copy images but probably isn't necessary if you, for example, frequently copy text but rarely copy images)." Another question, I imagine, would be, "Would like the fonts of your clipboard tab(s) to have a custom foreground and/or background color? Here is an example of default clipboard tab [an image of the default clipboard tab would be inserted here]. Here is an example of a clipboard tab with a gold font on a dark blue background: [an image of a clipboard tab with a gold font on a dark blue background would be inserted here]. If so, you may choose them by doing the following..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

2 participants