Bug 408352

Summary: Application automatically saves image and exits with notification with rectangular screenshot
Product: [Applications] Spectacle Reporter: Yan <yanp.bugz>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR    
Version: 19.04.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Yan 2019-06-05 17:38:03 UTC
I've binded taking region screenshor on print screen key. In previous version spectacle after taking screenshot opened it's window where I ususally pressed copy to clipboard. Now it saves to Picrure folders and exits.
Comment 1 Yan 2019-06-05 17:46:16 UTC
Manually creating .local/share/applications/org.kde.spectacle.desktop , editing Exec, and then editing kb shortcuts settings helps
Comment 2 Nate Graham 2019-06-10 22:23:13 UTC
If you open the Spectacle app via the application launcher or KRunner, do you see that the  "Quit after save or copy" checkbox is checked?

Also, how did you bind rectangular region mode to the print screen key? Can you provide a screenshot showing the configuration UI where you did this?
Comment 3 Yan 2019-06-11 12:23:32 UTC
The difference between spectacle desktop files:
/usr/share/applications/org.kde.spectacle.desktop has exec like this:
Exec=qdbus org.kde.Spectacle / RectangularRegion true

~/.local/share/applications/org.kde.spectacle.desktop (my file):
Exec=spectacle -r

I edited shortcuts in "kcmshell5 keys" module. Both in spectacle section and KDE daemon sections

I use arch linux
Comment 4 Nate Graham 2019-06-11 18:05:42 UTC
So for me `qdbus org.kde.Spectacle / RectangularRegion true` makes Spectacle exit after taking a rectangular region screenshot, and shows a notification instead of the main window.

`spectacle -r` makes Spectacle show its main window after taking a rectangular region screenshot.

Both of these different modes work fine for me. If you want Spectacle to show its main window after taking the rectangular resion screenshot, you can do exactly as you have done. In other words, it sounds like this is behaving as expected. :)
Comment 5 Yan 2019-06-11 22:48:40 UTC
The problem that the expected way leads to problem of copy paste. I need to copy screenshot to clipboard and DO NOT need to save it anywhere. In case of qdbus the screenshot is saved and copy option has no effect since X server clears buffer after process holding it's content terminates. So I can't copy it and it is saved To Pictures folder :(
Comment 6 Boudhayan Gupta 2019-06-11 23:07:53 UTC
Running `spectacle -r` does what you want (open the window after doing the rectangular crop), even with the quit after save or copy option enabled. Please make sure you've edited your `kcmshell keys` settings correctly. Also, making a change to the .desktop file is unnecessary, and the only thing it does is launch rectagular mode even if you start it from the kickoff menu.
Comment 7 Nate Graham 2019-06-11 23:17:00 UTC
That's Bug 393708, which will be fixed eventually. In the meantime there's a trivial workaround: change Klipper's settings to stop ignoring images. Right-click on Clipboard plasmoid > Configure Clipboard > uncheck "Ignore images".
Comment 8 Boudhayan Gupta 2019-06-11 23:18:11 UTC
Git commit b526b333bed6c9e32600ccd73a844fe30d5665d0 by Boudhayan Gupta.
Committed on 11/06/2019 at 23:17.
Pushed by bgupta into branch 'master'.

Add comment to desktop file

M  +41   -0    desktop/org.kde.spectacle.desktop

https://commits.kde.org/spectacle/b526b333bed6c9e32600ccd73a844fe30d5665d0
Comment 9 Yan 2019-06-11 23:28:00 UTC
Thanks, klipper plasmoid should fix the issue.

@Boudhayan the problem is that I find `spectacle -r` more handy than qdbus notification. kcmshell-keys doesn't provide a way to set ANY command to ANY keyboard action, instead you can only commands from Exec sections in .desktop files.

So I've spent around thirty minutes to get behaviour which I'm used to after upgrade to newer plasma on my laptop instead. Now I'm happy and know better the internals of KDE.