Skip to content

Instantly share code, notes, and snippets.

@Xarkam
Last active June 1, 2022 08:38
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Xarkam/26d40e98dbad314423c11a27e35aab47 to your computer and use it in GitHub Desktop.
Save Xarkam/26d40e98dbad314423c11a27e35aab47 to your computer and use it in GitHub Desktop.
KDE Spectacle copy screenshot to clipboard
  • sudo apt-get install xclip
  • Configure spectacle to use Rectangular Selection, default save to /some/path/Screenshot_%Y%M%D_%H%m%S
  • Configure PrintScreen for rectangular selection via custom shortcuts
  • Try it - once you select the area and hit enter it should show the pop-up notification about saved file.
  • On this notification select the settings button
  • In the notification settings enable "Run command" and set it as /usr/bin/xclip -selection clipboard -target image/png -i $(ls -1tr /some/path/Screenshot_*.png | tail -n 1)
@rbenal
Copy link

rbenal commented Mar 27, 2019

Hello this solution works great, but kde screenshot notification is showed several times each screenshot is captured, do you know a solution ? tis only occurs when "Run command" option is configured with this script

@elchusco
Copy link

You should get an eye on this workaround :
https://www.reddit.com/r/kde/comments/5i4awm/how_to_make_spectacle_copy_to_clipboard_by_default/
It works pretty fine and if you'd like to prevent the notification to popup, you just need to append a -n option to spectacle command.
Try a spectacle --help for others that might interest you.

Personally I just create a Custom Shortcut on that command and it's suitable !

@Xarkam
Copy link
Author

Xarkam commented Jul 16, 2019

@rbenal, I do not have a solution to your problem. Since then I use flameshot for my screenshots.

@elchusco, thank you for your information on this option.

@igoro00
Copy link

igoro00 commented May 9, 2020

@elchusco @Xarkam i just found out that you can just tell spectacle to copy to clipboard using -c option
spectacle -brc

@Xarkam
Copy link
Author

Xarkam commented May 10, 2020

Thanks @igoro00 I test asap this option :)

@igoro00
Copy link

igoro00 commented May 10, 2020

did it work? maybe they introduced this option recently. It works for sure on manjaro KDE with spectacle 20.04.0

@elchusco
Copy link

elchusco commented May 11, 2020

@igoro00 I am running spectacle 17.12.3, I guess that's why the -c option is still missing :

$ spectacle -c 
Unknown option 'c'.

I don't know which package should I upgrade so it upgrade spectacle, I guess plasma or kde itself...

I think I came across this option at the time I posted this workaround, but wasn't able to try it. That's a good new.

@Xarkam thanks for the flameshot alternative which looks super great ! I think I will switch to this solution, although it's not native to KDE, but it seems to offer some interesting features like quick edit etc.

@Steffo99
Copy link

@igoro00 It works!

@Xarkam
Copy link
Author

Xarkam commented Jul 22, 2020

I consider flameshot to be unmaintained. It has been 10 months since there were any more commits in the code and 51 pull requests are still pending.

Spectacle goes ahead, but it lacks that awesome option of being able to annotate an image before copying or saving it.

@RealFakeAccount
Copy link

If you are using Wayland, you can't use xclip. You can choose to install wl-copy instead and set the command as
/usr/bin/wl-copy < $(ls -1tr /home/rfaccount/Pictures/Screenshot_*.png | tail -n 1)

@Xarkam
Copy link
Author

Xarkam commented Jul 21, 2021

I don't use wayland.
Flameshot is very active again but in the meantime I have found ksnip which I find very good for the KDE environment.
ksnip supports partially wayland.

@lukehmcc
Copy link

lukehmcc commented Mar 9, 2022

If you are using Wayland, you can't use xclip. You can choose to install wl-copy instead and set the command as /usr/bin/wl-copy < $(ls -1tr /home/rfaccount/Pictures/Screenshot_*.png | tail -n 1)

This is super helpful! KDE doesn't seem to have a way to copy to clipboard under wayland that I've found in any screenshot apps. So this is a great workaround in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment