Author: @[email protected]

Flameshot is arguably the best Linux screenshot utility out there. Unfortunately, it has a really annoying issue: copy-to-clipboard doesn’t work in Wayland. Everything else works just great, but only being able to save screenshots to files totally breaks my workflow.

Fortunately, there’s a way around this: Flameshot also has a --raw command line argument that makes it send whatever it captures to stdout. That means it’s really easy to pipe it to wl-copy to send the content to the Wayland clipboard.

Here are a couple of key bindings that exploit this and make Flameshot work great in Sway:

bindsym $mod+Alt+F11 exec bash -c 'flameshot gui --raw 2> >(grep aborted || notify-send "Screenshot copied to the clipboard") | wl-copy'
bindsym $mod+Alt+F12 exec flameshot screen --raw | wl-copy && notify-send 'Screeshot copied to the clipboard'

Those command do require notify-send to be installed, which is supplied by different packages depending on your particular Linux distro. Debian has it in the libnotify-bin package.

If you don’t want to install it, you can strip the fancy scripting and just define those two key bindings instead:

bindsym $mod+Alt+F11 exec flameshot gui --raw | wl-copy
bindsym $mod+Alt+F12 exec flameshot screen --raw | wl-copy

They work just as well, but they don’t notify you when the screenshot is copied to the clipboard or aborted, which can be disconcerting.