Bug 393708 - Copy to clipboard doesn't seem to work with default Klipper settings
Summary: Copy to clipboard doesn't seem to work with default Klipper settings
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 18.04.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
: 393932 394479 394859 397390 400478 402118 405189 405927 407106 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-05-01 01:52 UTC by Matthew Trescott
Modified: 2019-06-22 18:10 UTC (History)
15 users (show)

See Also:
Latest Commit:
Version Fixed In: Applications 19.04.0 on Plasma 5.16.2 or later


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Trescott 2018-05-01 01:52:53 UTC
Taking a screenshot with Spectacle and choosing "copy to clipboard" doesn't seem to work. Nothing appears in the clipboard system tray widget and nothing is pasted when I hit Ctrl-V in LibreOffice Writer.
Comment 1 Nate Graham 2018-05-01 04:15:25 UTC
To see them in Klipper you have to turn on image support first: right-click on the clipboard icon in your system tray and choose "Configure Clipboard". Then uncheck "Ignore Images". Still, that doesn't explain why it isn't automatically put in the X11 clipboard. Are you quitting Spectacle after the copy operation?
Comment 2 null 2018-05-01 06:56:32 UTC
> turn on image support first
That should only be needed if you don't keep Spectacle open when pasting the image.

> Are you quitting Spectacle after the copy operation?
That's the question I'm also interested in.
Comment 3 Matthew Trescott 2018-05-01 11:17:17 UTC
Yes, I have been closing Spectacle. Should I file a bug against Klipper about changing the defaults?
Comment 4 null 2018-05-01 11:33:23 UTC
Thanks, glad we could figure that out.

> Should I file a bug against Klipper about changing the defaults?
Nate brought this up before, but due to memory usage that's a no-go (see https://phabricator.kde.org/D9117#202712).
Comment 5 null 2018-05-07 08:44:24 UTC
*** Bug 393932 has been marked as a duplicate of this bug. ***
Comment 6 null 2018-05-20 20:06:40 UTC
*** Bug 394479 has been marked as a duplicate of this bug. ***
Comment 7 null 2018-05-31 18:57:19 UTC
*** Bug 394859 has been marked as a duplicate of this bug. ***
Comment 8 null 2018-05-31 18:58:07 UTC
Reopening, because this is an issue many users are struggling with. At least we need to add a warning message for 18.08.
Comment 9 Nate Graham 2018-05-31 19:02:34 UTC
IIRC, David suggested adding a special thingy to the MIME type in spectacle's clipboard data (Or something like that, I can't recall the technical details) that would make Klipper add it to the clipboard even with the "Ignore Images" checkbox checked. Did that seem like a reasonable plan to you?
Comment 10 Nate Graham 2018-05-31 19:04:39 UTC
I also wonder whether it really is a bad idea after all to change the default setting in Klipper. It would certainly make it use more memory, but, well, isn't that what memory is for? Being used? Unless Klipper fails to let go under severe memory pressure, there might not be an issue here (and if so, we should probably make Klipper smarter about letting go of old images when the system is under memory pressure).
Comment 11 null 2018-05-31 19:21:35 UTC
Please (re-)read the whole discussion on Phab before commenting and repeating the same arguments again.

I have not yet found a way to avoid the memory penalty (which is quite big compared to the overall memory usage of Plasma, and happens on startup (!) if you used Spectacle in the previous session).

I doubt to have time to work on this for 18.08, so I'd suggest we go with a warning message for now.
Comment 12 Nate Graham 2018-05-31 19:46:34 UTC
There's no need for rudeness. Not everyone has your elephant-like memory, and we're all friends here.

I think that the proposed "x-kde-force-image-copy" tag would work just fine. I'm not sure that this would represent "plainly ignor[ing] their choice for Ignore images" as you put it. Since "Ignore images" is the default setting in Klipper, i'm guessing that 99% of KDE users have not in fact made a conscious choice to use it and so no explicit preference is being overridden. Even those people who do know about the setting and have it checked on purpose are signaling their desire to temporarily override it by using spectacle's "Quit after save or copy" feature. Either way, the user's immediate and specific intent is clearly to copy the image to clipboard, which overrides any previous general intent.

Consider this a +1 for David's idea. I think that would be a lot more user-friendly than adding a warning. The potential memory implications of the x-kde-force-image-copy approach seem minor, and easily undoable for people who are obsessed with manually optimizing their memory by clearing klipper's history or removing the image entries (or they could just avoid the feature in the first place). For regular users, I think it would be just what they want and expect.
Comment 13 null 2018-05-31 19:53:05 UTC
> memory implications of the x-kde-force-image-copy approach seem minor
I even measured it, I don't see how they are "minor" in any way. With the naive approach, this will affect _everyone_, even if they don't use the feature. I won't submit a patch which results blowing up startup memory usage of Plasma, when at the same time David and others are trying to get the memory usage down.

Also, I never said the approach of x-kde-force-image-copy wouldn't work, I simply said that I did not yet work on making it more efficient. For example, Klipper could only store a single image with that tag, and don't save it for the next session at all.

However, that's more complicated to implement, so it might need more time (unless you send a patch yourself).
Comment 14 Nate Graham 2018-05-31 19:55:12 UTC
The x-kde-force-image-copy approach affects even people who don't use the feature?
Comment 15 null 2018-05-31 20:02:18 UTC
Yes, everyone using the global shortcut or "Copy to Clipboard", regardless of the state of "Quit after Copy" (since you can quit manually). And since this overrides "Ignore images", there is not even a way to turn it off.

As I said, this needs more thought to make it work right, the naive approach won't cut it.
Comment 16 Nate Graham 2018-05-31 20:20:01 UTC
Couldn't we add x-kde-force-image-copy to the MIME data only if "Quit after save or copy" was checked (or when activated via a global shortcut, should https://phabricator.kde.org/D9117 be merged)? That would at least fix this bug.

Perhaps we should check with David whether the potential memory expenditure is worthwhile rather than assuming that it isn't. He was the one who originally proposed this approach, after all. It's not like this is a totally useless expenditure of RAM either: what's being proposed is the addition of a desirable feature. Sometimes features (especially image-related features) use memory, the the whole point of having a desktop environment is to enable features that users want. I don't think that making Plasma as memory-lean as possible (An important goal!) means that we need to sacrifice user-requested features because they use additional memory.

I have to say I'm really not a fan of the "I'm smarter than you" attitude you're giving off here. All of this may seem obvious to you because you've puzzled it all out, but I would ask you to please stop the condescension. We're just having a discussion here picking up from the points you brought up in https://phabricator.kde.org/D9117#208517.
Comment 17 Christoph Feck 2018-05-31 20:34:12 UTC
I still think the warning is needed, even if the user does not have "Quit after copy" selected, because the user might just click "Copy" and close the window, without knowing that the screen shot will not survive.
Comment 18 null 2018-05-31 20:35:37 UTC
@cfeck: Exactly.

> Couldn't we add x-kde-force-image-copy to the MIME data only if "Quit after
> save or copy" was checked
As I said, users can manually quit Spectacle. Why would manually quitting remove the image from the clipboard, while automatically quitting keep it? That's highly confusing. Also, this won't solve the memory problem in any way.

We don't have a conceptual problem here, only one of implementing it properly in Klipper.

As can be read on Phab, David does not like increasing memory usage (and I don't either, but that doesn't seem to matter to you).

The only other short-term alternative to the warning message I have is disabling the quite-after-copy feature, but surely you won't like that either.
Comment 19 elman 2018-05-31 23:30:35 UTC
Hi. Maybe you could make and option for Klipper to run in the background? I believe Shutter does that.

Also I tried to work with Spectacle without closing it and found different bug. If I have Spectacle opened in the background, pressing PrtSc does nothing. It should bring Spectacle to the front and make new screenshot.
Comment 20 Nate Graham 2018-06-01 03:39:12 UTC
Here's an idea: maybe we could have Klipper only retain a maximum of one image at a time that's tagged with x-kde-force-image-copy?
Comment 21 null 2018-06-01 20:37:37 UTC
@elman:

> option for Klipper to run in the background
Klipper is already running in the background (on Plasma, at least), the problem is how to handle images.

> If I have Spectacle opened in the background, pressing PrtSc does nothing.
We know about that problem, but as you said, it's a different bug, and thus it should not be discussed here. Please try to find an existing bug, and if there is none, file a new bug. Thanks!

---
@Nate:

> retain a maximum of one image at a time that's tagged
I'm not sure how that's different from what I already wrote in Comment 13:

> For example, Klipper could only store a single image with that tag,
> and don't save it for the next session at all.
I'll now go back to other things, maybe that'll be more productive…
Comment 22 null 2018-08-12 06:08:33 UTC
*** Bug 397390 has been marked as a duplicate of this bug. ***
Comment 23 FiNeX 2018-08-21 12:22:51 UTC
(In reply to Christoph Feck from comment #17)
> I still think the warning is needed, even if the user does not have "Quit
> after copy" selected, because the user might just click "Copy" and close the
> window, without knowing that the screen shot will not survive.

I was filling a bug about the image missing from clipboard (with "Quit after Save or Copy" is selected) when I've found this one :-)

Now I've enabled klipper to keep images so the problem has been solved.

The warning message looks like a good workaround until a different solution will be found.


(In reply to elman from comment #19)
> Also I tried to work with Spectacle without closing it and found different
> bug. If I have Spectacle opened in the background, pressing PrtSc does
> nothing. It should bring Spectacle to the front and make new screenshot.

I've often had this problem too. Is this a Spectacle bug or is this related to how KDE/Plasma manage global shortcuts?
Comment 24 Nate Graham 2018-11-01 19:29:36 UTC
*** Bug 400478 has been marked as a duplicate of this bug. ***
Comment 25 Burkhard Lück 2018-12-15 10:48:18 UTC
https://bugs.kde.org/show_bug.cgi?id=393708 looks like a duplicate?
Comment 26 Nate Graham 2018-12-15 16:34:58 UTC
That's this bug. :)
Comment 27 Burkhard Lück 2018-12-15 16:53:59 UTC
(In reply to Nate Graham from comment #26)
> That's this bug. :)

Sorry wrong number, should have been https://bugs.kde.org/show_bug.cgi?id=402118
Comment 28 Nate Graham 2018-12-15 20:57:00 UTC
*** Bug 402118 has been marked as a duplicate of this bug. ***
Comment 29 Nate Graham 2019-03-26 18:10:26 UTC
Git commit 6a178a5b4e65fc0b8cc8ade20e923c25f027c6c1 by Nate Graham, on behalf of Karlo Dautović.
Committed on 26/03/2019 at 18:08.
Pushed by ngraham into branch 'Plasma/5.15'.

Change default Klipper behavior to accept images

Summary:
Change the default Klipper behavior in order for https://phabricator.kde.org/D19715 to work.

Klipper will save images to clipboard, but unless Ignore Images is unchecked in the options, it won't save them to clipboard history.

Reviewers: #plasma_workspaces, davidedmundson

Reviewed By: #plasma_workspaces, davidedmundson

Subscribers: ngraham, davidedmundson, plasma-devel, #plasma_workspaces

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D19852

M  +11   -2    klipper/klipper.cpp

https://commits.kde.org/plasma-workspace/6a178a5b4e65fc0b8cc8ade20e923c25f027c6c1
Comment 30 Nate Graham 2019-03-26 18:14:50 UTC
*** Bug 405189 has been marked as a duplicate of this bug. ***
Comment 31 Nate Graham 2019-03-26 18:37:11 UTC
Git commit ec5e918743e7a260cb5288699e611bd47ed70b28 by Nate Graham, on behalf of Karlo Dautović.
Committed on 26/03/2019 at 18:33.
Pushed by ngraham into branch 'Applications/19.04'.

Add option to copy screenshot to clipboard in background mode

Summary:
Related: bug 385559
FIXED-IN: 19.04.0

Reviewers: #spectacle, ngraham

Reviewed By: #spectacle, ngraham

Subscribers: ngraham, davidre, #spectacle

Tags: #spectacle

Differential Revision: https://phabricator.kde.org/D19715

M  +11   -2    src/ExportManager.cpp
M  +1    -1    src/ExportManager.h
M  +2    -1    src/Gui/KSMainWindow.cpp
M  +7    -1    src/Main.cpp
M  +17   -8    src/SpectacleCore.cpp
M  +2    -1    src/SpectacleCore.h

https://commits.kde.org/spectacle/ec5e918743e7a260cb5288699e611bd47ed70b28
Comment 32 Nate Graham 2019-03-26 22:09:11 UTC
Git commit 2661e44ed6493a08b87b4dddacda678bed2bcbf3 by Nate Graham.
Committed on 26/03/2019 at 22:07.
Pushed by ngraham into branch 'Applications/19.04'.

Make "Quit after copy" feature work
This was included in a new feature that wasn't appriate for the stable
branch, but this part of it is a bugfix that should be in the 19.04
release

M  +4    -1    src/ExportManager.cpp

https://commits.kde.org/spectacle/2661e44ed6493a08b87b4dddacda678bed2bcbf3
Comment 33 Nate Graham 2019-03-27 19:24:30 UTC
*** Bug 405927 has been marked as a duplicate of this bug. ***
Comment 34 Patrick Silva 2019-04-22 13:38:35 UTC
My bug 405189 is still reproducible with Spectacle 19.04 + Plasma 5.15.4 on Arch Linux. Can we reopen this bug? Or should I reopen my bug?
Comment 35 Nate Graham 2019-04-24 17:10:26 UTC
:(
Comment 36 Nate Graham 2019-04-30 19:08:43 UTC
*** Bug 407106 has been marked as a duplicate of this bug. ***