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

Request: Save Text Only (Ignore Images) #134

Closed
clarkewd opened this issue Jul 9, 2020 · 11 comments
Closed

Request: Save Text Only (Ignore Images) #134

clarkewd opened this issue Jul 9, 2020 · 11 comments
Labels
enhancement New feature or request needs triaging Further information is requested

Comments

@clarkewd
Copy link

clarkewd commented Jul 9, 2020

First, thank you for writing such a wonderful tool and also for making it open source ☺️

It would be nice if there was an easy way to prevent things other than text from being added to the history.

For now I've added a few entries to the "Ignored pasteboard types" and this seems to be working:

Window 2020-07-09 at 12 40 37

I saw that Apple recognizes a type public.image but this didn't seem to work so I used the ClipboardViewer.app mentioned here to try and determine the types I should exclude:

Window 2020-07-09 at 12 45 20

It was a little tricky but so far I've come up with:

public.tiff
public.png
public.jpeg
public.gif

I use the clipboard manager for coding so if there is an easy way to create an option to "save only text" ( text, rtf, html, etc - but not images, video, sounds, etc ) that would be ideal.

If that is too complicated maybe even just add info on the current pasteboard type to the bottom of the "Advanced" preferences tab to help in figuring out what types users could add?

Thank you again for creating such a wonderful software.

@p0deje
Copy link
Owner

p0deje commented Jul 10, 2020

Currently, Maccy only maintains the history of the following types https://github.com/p0deje/Maccy/blob/8d3bb5ed2c5789972f8726b8191e261f684b521f/Maccy/Clipboard.swift#L19-L24:

  private let supportedTypes: Set = [
    NSPasteboard.PasteboardType.fileURL.rawValue,
    NSPasteboard.PasteboardType.png.rawValue,
    NSPasteboard.PasteboardType.string.rawValue,
    NSPasteboard.PasteboardType.tiff.rawValue
  ]

I should probably make this list configurable via preferences (with all enabled by default) so you could just disable "Images" or "Files" if you want.

@p0deje p0deje added the enhancement New feature or request label Jul 10, 2020
@p0deje
Copy link
Owner

p0deje commented Aug 4, 2020

I've been working on this configuration and I would like to hear your and others' opinion on this.

It's now possible to configure types of data to store:

Screen Shot 2020-08-04 at 16 29 12

It works great for simple copies, but it's not clear what to do for more complicated ones. Imagine you have "Images" disabled and "Text" enabled. What should happen when we copy something that contains both image and text. What should happen to such copy:

  1. Maccy should ignore the whole copy.
  2. Maccy should store the whole copy
  3. Maccy should alter the copied data and remove images?

An example of such a scenario is copying multiple cells in Number.app. They are copied as rich text, string, and image. Another common scenario is copying a file, which is always represented as a file URL and string with the filename.

@p0deje
Copy link
Owner

p0deje commented Aug 14, 2020

@clarkewd Any thoughts on ☝️?

@FernandoMiguel
Copy link

LGTM

@p0deje
Copy link
Owner

p0deje commented Aug 24, 2020

LGTM

Which option exactly? 😄 I proposed 3 different ones for behavior.

@FernandoMiguel
Copy link

all data, and do its best to paste as was

@p0deje
Copy link
Owner

p0deje commented Sep 2, 2020

But then a user would still see images even though they explicitly unchecked keeping images. That seems like a bad UX.

@p0deje p0deje added the needs triaging Further information is requested label Sep 13, 2020
@fturcheti
Copy link

I'm interested in this feature mostly because I'd like to disable the storage of files in the clipboard, but giving my feedback on the question above:

What should happen when we copy something that contains both image and text. What should happen to such copy:

1. Maccy should ignore the whole copy.
2. Maccy should store the whole copy
3. Maccy should alter the copied data and remove images?

I think the correct would be 3. If I want to store texts and don't want to store images, I'd like to get the textual part of the selection and get rid of the images in between.

@clarkewd
Copy link
Author

Sorry for the delayed reply. Your addition looks great and I think will be very helpful for folks trying to disable images. As for mixed types, I'd be in favor of option 3:

Maccy should alter the copied data and remove images?

This is pretty similar to how Ditto Clipboard Manager can be setup.

It has options for which types you want to store, so I was able to remove non-text formats. See below. On mixed types, it just copies the text but not the image.

Screen Region 2020-12-14 at 21 13 55

I also really liked that Ditto allowed me to easily paste plain text anywhere, and to set that as the default paste option, even if I had copied rich-formatted text, with their "Text Only Paste" option:

Screen Region 2020-12-14 at 21 15 52

So with that software my workflows were this:

Normal Behavior

  1. Copy an image, file, rich text, etc. as normal
  2. Paste it normally using control+v ( good for Photoshop, Word, Emails, moving files, etc. - doesn't require any re-learning and works with all existing programs )

Plain text

  1. Copy rich text as normal
  2. Paste plain text using customizable shortcut ( mine was control+shift+v on Windows - allows quickly and easily removing formatting, which I need quite often )

Search / paste plain

  1. Launch the clipboard manager - I think the default shortcut is control + ~
  2. Another amazing thing is that typing after this shortcut in Ditto immediately searches / narrows the list without any additional clicks or arrow keys, and will automatically highlight the topmost result allowing it to be pasted by pressing return
  3. It's possible to configure this behavior so that selecting the result always pastes it as plain text
  4. If images and other types are allowed to be saved via the previously mentioned "Supported Types" preference they will be shown in the list alongside the other text - but after removing the supported types only the plain text of whatever was copied ( if applicable ) will be saved in the history. For me that was the main purpose of opening this feature request.

Alex, thank you for your work on Maccy. It is by far the BEST, fastest, and most intuitive clipboard manager for OS X that I've found and since I found it I've been using it heavily every day. Before finding it I spent tens of hours searching, researching, testing, and comparing different clipboard managers. So thank you very much.

@p0deje
Copy link
Owner

p0deje commented Feb 8, 2021

Thanks for a detailed explanation, I'll wrap up the work on supported types by altering the copy entry and removing the undesirable types before pasting.

@clarkewd
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triaging Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants