flameshot icon indicating copy to clipboard operation
flameshot copied to clipboard

Copying selection to clipboard is not working (neither Ctrl+C hotkey nor the button)

Open isak102 opened this issue 3 years ago • 33 comments

Flameshot Version

Output of flameshot -v: Flameshot v12.1.0 (-) Compiled with Qt 5.15.5

Also tried cloning from git and manually compiling, had the same issue

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...), User repository (AUR), Flatpak from Flathub, Compiled from source

Operating System type and version

Arch Linux 6.0.8-arch1-1

Description

Selecting a screenshot in flameshot gui and then pressing Ctrl+C to copy the selection to keyboard doesnt work. Pressing Ctrl+C just exits flameshot. The same thing happens when clicking the button in the interface to copy to clipboard.

I tried installing flameshot as a flatpak and there it worked properly if I ran flameshot as a daemon, but running flameshot gui had the same behaviour, copying didn't work.

Steps to reproduce

  1. run flameshot gui
  2. Make selection
  3. Copy the selection to clipboard, either by pressing Ctrl+C or by clicking the button on screen
  4. Nothing happens

Screenshots or screen recordings

No response

System Information

  1. Arch Linux, 6.0.8-arch1-1
  2. Output of xrandr:
eDP-1 connected primary (normal left inverted right x axis y axis)
   1920x1080     60.01 +  60.01    59.97    59.96    59.93
   1680x1050     60.01    59.95    59.88
   1400x1050     59.98
   1600x900      59.99    59.94    59.95    59.82
   1280x1024     60.01    60.02
   1440x900      60.01
   1400x900      59.96    59.88
   1280x960      60.00
   1440x810      60.00    59.97
   1368x768      59.88    59.85
   1280x800      59.99    60.01    59.97    59.81    59.91
   1280x720      60.00    60.01    59.99    59.86    59.74
   1024x768      60.01    60.04    60.00
   960x720       60.00
   928x696       60.05
   896x672       60.01
   1024x576      59.95    59.96    59.90    59.82
   960x600       59.93    60.00
   960x540       59.96    59.99    59.63    59.82
   800x600       60.01    60.00    60.32    56.25
   840x525       60.01    59.88
   864x486       59.92    59.57
   700x525       59.98
   800x450       59.95    59.82
   640x512       60.02
   700x450       59.96    59.88
   640x480       60.01    60.00    59.94
   720x405       59.51    58.99
   684x384       59.88    59.85
   640x400       59.88    59.98
   640x360       59.86    59.83    59.84    59.32
   512x384       60.00
   512x288       60.00    59.92
   480x270       59.63    59.82
   400x300       60.32    56.34
   432x243       59.92    59.57
   320x240       60.05
   360x202       59.51    59.13
   320x180       59.84    59.32
HDMI-1 connected 2496x1404+0+0 (normal left inverted right x axis y axis) 598mm x 336mm
   1920x1080     74.99*+  59.96    72.03    60.02    50.01    48.00    60.00    50.00    59.94    59.93
   1680x1050     59.95    59.88
   1400x1050     74.76    59.98
   1600x900      59.94    59.95    59.82
   1280x1024     75.02    60.02
   1440x900      59.90
   1400x900      59.96    59.88
   1280x960      60.00
   1440x810      59.97
   1368x768      59.88    59.85
   1280x800      59.99    59.97    59.81    59.91
   1152x864      75.00
   1280x720      60.00    59.99    59.86    60.00    50.00    59.94    59.74
   1024x768      75.05    60.04    75.03    70.07    60.00
   960x720       75.00    60.00
   928x696       75.00    60.05
   896x672       75.05    60.01
   1024x576      59.95    59.96    59.90    59.82
   960x600       59.93    60.00
   832x624       74.55
   960x540       59.96    59.99    59.63    59.82
   800x600       75.00    70.00    65.00    60.00    72.19    75.00    60.32    56.25
   840x525       60.01    59.88
   864x486       59.92    59.57
   720x576       50.00
   700x525       74.76    59.98
   800x450       59.95    59.82
   720x480       60.00    59.94
   640x512       75.02    60.02
   700x450       59.96    59.88
   640x480       60.00    72.81    75.00    66.67    60.00    59.94
   720x405       59.51    58.99
   720x400       70.08
   684x384       59.88    59.85
   640x400       59.88    59.98
   576x432       75.00
   640x360       59.86    59.83    59.84    59.32
   512x384       75.03    70.07    60.00
   512x288       60.00    59.92
   416x312       74.66
   480x270       59.63    59.82
   400x300       72.19    75.12    60.32    56.34
   432x243       59.92    59.57
   320x240       72.81    75.00    60.05
   360x202       59.51    59.13
   320x180       59.84    59.32
DP-1 disconnected (normal left inverted right x axis y axis)
  1. I'm using DWM as a window manager, on Xorg

isak102 avatar Nov 14 '22 17:11 isak102

same problem over ubuntu 18 and flameshot >= 12

stefanocudini avatar Nov 24 '22 13:11 stefanocudini

@isak102 can it be related to this?

https://github.com/flameshot-org/flameshot/issues/2496#issuecomment-1144308628

mmahmoudian avatar Nov 25 '22 07:11 mmahmoudian

@isak102 can it be related to this?

#2496 (comment)

Yes it is related to that, it works properly if flameshot is ran as a daemon first. Judging by that comment this is the intended behaviour so I’ll close this issue

isak102 avatar Nov 25 '22 12:11 isak102

No it is not intended behavior. The daemon should keep running as long as it is needed (for pin or for clipboard). If it does not work it is definitely a bug

mmahmoudian avatar Nov 26 '22 07:11 mmahmoudian

@mmahmoudian The daemon keeps running when I start it with flameshot, it doesn’t quit after I use flameshot gui if that was what you meant. I just meant that I need to start the flameshot daemon once before I can start using flameshot gui to copy to clipboard.

isak102 avatar Nov 26 '22 11:11 isak102

The flameshot starts the daemon and if you have started the daemon by running just the flameshot, it should keep running (sitting in the tray area). If you want the daemon to get terminated, you in principal should enable the following option, and then only launch Flameshot with flameshot gui (at the moment it does not work properly all the time, so you might want to kill the process every now and then. We will look into it)

image

mmahmoudian avatar Dec 01 '22 06:12 mmahmoudian

I am facing the same issue, seems to be reported here as well: https://github.com/flameshot-org/flameshot/issues/3107 I am running on ubuntu 22.04

fnobis avatar Mar 01 '23 15:03 fnobis

Is there a way to enable verbose logging or something?

I've also started experiencing this on one machine. I can't find the cause for it, but it happens with both official 12.1.0 and git build v12.1.0 (3ededae5).

matejdro avatar Mar 18 '23 10:03 matejdro

Same issue. Cannot paste image copied to clipboard

mauamolat avatar Mar 18 '23 13:03 mauamolat

@mauamolat

Cannot paste image copied to clipboard

This issue is about not being able to add it to clipboard. In your case what you are saying is that the screenshot is in your clipboard but cannot be pasted elsewhere. That can be many thing, most of which is irrelevant to Flameshot.

@matejdro

Is there a way to enable verbose logging or something?

No, at the momebt the best user can get is what is provided in terminal

mmahmoudian avatar Mar 20 '23 07:03 mmahmoudian

@mauamolat

Cannot paste image copied to clipboard

This issue is about not being able to add it to clipboard. In your case what you are saying is that the screenshot is in your clipboard but cannot be pasted elsewhere. That can be many thing, most of which is irrelevant to Flameshot.

@matejdro

Is there a way to enable verbose logging or something?

No, at the momebt the best user can get is what is provided in terminal

I found the issue. It doesn't work with .jpg as default image file but only with .png

mauamolat avatar Mar 20 '23 07:03 mauamolat

I found the issue in my case: It's the update checking.

I traced the code and I found that daemon freezes upon reaching that line: https://github.com/flameshot-org/flameshot/blob/3ededae5745761d23907d65bbaebb283f6f8e3f2/src/core/flameshotdaemon.cpp#L94. Thus, daemon is never initialized and can never receive screenshots to copy to the clipboard.

Disabling update checking fixes the issue for me.

matejdro avatar Mar 29 '23 08:03 matejdro

When running flameshot from terminal in i3wm or other window managers, you may receive this error after trying to copy to system clipboard: flameshot: info: Capture saved to clipboard. qt.qpa.clipboard: QXcbClipboard::setMimeData: Cannot set X11 selection owner

Version + Kernel info: Flameshot v12.1.0 (-) Compiled with Qt 5.15.5 6.2.10-arch1-1 Ensure dunst or an alternate notification manager/daemon is running if you are using i3wm on your system; recommend cloning the official dunstrc from official dunst repo. A system I was using was not copying flameshot screen captures to the system clipboard, cloned official dunstrc and managed to re-enable clipboard pasting functionality.

v1sages avatar Apr 09 '23 06:04 v1sages

I run into the same problem. My advice t othe dev is, just run the messaging in a separate thread/asynchronous, so that in case, the message daemon will not respond/not available, flameshot will not hang for round about 60s.

arakis avatar Oct 15 '23 20:10 arakis

I ran into a variation on this issue with flameshot v11 and v12 where it'd "save to clipboard" but i could never paste from it, i'd have to open my clipboard manager (clipman on ubuntu 22.04 with xfce4) and click it and then i could control V to paste it, i got tired of having to constantly do so many clicks just to paste a flameshot captured print screen so i wrote a python script and keybound it and it works now to give me flameshot and controlV to paste with no additional clicks or keystroke

note this assumes you also have copyQ installed as a new clipboard manager, should work alongside your current clipboard manager but you could replace it with it no problem too

import subprocess
import os
import tempfile
import time

# Function to get the first image item from CopyQ
def get_first_image_item():
    process = subprocess.run(['copyq', 'read', 'image/png', '0'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    if process.stderr:
        print("Error reading image item from CopyQ:", process.stderr.decode())
    return process.stdout if process.stdout else None

# Function to save the image to a temporary file
def save_image(data):
    try:
        with tempfile.NamedTemporaryFile(delete=False, suffix='.png') as tmpfile:
            tmpfile.write(data)
            print("Saved image to:", tmpfile.name)
            return tmpfile.name
    except Exception as e:
        print("Error saving image:", e)
        return None

# Get the first image item from CopyQ
image_data = get_first_image_item()

if image_data:
    # Save the image to a temporary file
    image_path = save_image(image_data)

    if image_path:
        # Use xclip to load the image into the clipboard
        subprocess.run(['xclip', '-selection', 'clipboard', '-t', 'image/png', '-i', image_path])

        # Wait a little for xclip to process the image
        time.sleep(1)

        # Simulate a paste operation. Make sure the focus is on the target window before this step.
        subprocess.run(['xdotool', 'key', 'ctrl+v'])

        # Clean up the temporary file
        os.unlink(image_path)
else:
    print("No image data received from CopyQ.")

ihaddy avatar Nov 17 '23 19:11 ihaddy

The flameshot starts the daemon and if you have started the daemon by running just the flameshot, it should keep running (sitting in the tray area). If you want the daemon to get terminated, you in principal should enable the following option, and then only launch Flameshot with flameshot gui (at the moment it does not work properly all the time, so you might want to kill the process every now and then. We will look into it)

image

This (running flameshot in the background) worked for me while other workarounds such as toggling jpg on and off did not. Thx

port19x avatar Dec 04 '23 15:12 port19x

@mauamolat

Cannot paste image copied to clipboard

This issue is about not being able to add it to clipboard. In your case what you are saying is that the screenshot is in your clipboard but cannot be pasted elsewhere. That can be many thing, most of which is irrelevant to Flameshot. @matejdro

Is there a way to enable verbose logging or something?

No, at the momebt the best user can get is what is provided in terminal

I found the issue. It doesn't work with .jpg as default image file but only with .png

I just made these changes and it works now.

image

lfparizzi avatar Dec 24 '24 13:12 lfparizzi

same problem flameshot v12.1.0 linux: 6.14.0-1-MANJARO

Exript avatar Jun 26 '25 08:06 Exript

@Exript considering that you are on an Arch based distro, try installing the AUR flameshot-git and see if the issue persists.

mmahmoudian avatar Jun 26 '25 18:06 mmahmoudian

@Exript considering that you are on an Arch based distro, try installing the AUR flameshot-git and see if the issue persists.

Still happening with it. I have tried flameshot, flameshot-git and even flatpak version. It was working fine until few days ago. I suspect it could have been the system update. Also it worked 2-3 times when i installed flatpak version and since then nothing.

Running cachyos with gnome and nvidia

AyushSehrawat avatar Aug 14 '25 19:08 AyushSehrawat

Do you have flameshot running in the background? That's vital and easily missed on a customised linux install such as arch

port19x avatar Aug 14 '25 20:08 port19x

Do you have flameshot running in the background? That's vital and easily missed on a customised linux install such as arch

In the tray means it's running in the background i guess ? When i run flameshot for the first time it isn't there, but from then onwards it's there. But it doesn't work first, second or any try :/

I have attached Print Screen to this command

script --command "QT_QPA_PLATFORM=wayland flameshot gui" /dev/null
❯ flameshot --version
Flameshot v13.0.1 (f0e46edf)
Compiled with Qt 6.9.1

Edit: I enabled the run flameshot in background on startup setting. Tested after reboot and it's still the same

AyushSehrawat avatar Aug 14 '25 21:08 AyushSehrawat

Hi, I have the same problem nothing happened when I clic on copy.

But I'm on Windows 11. Flameshot v13.1.0 (79395fd3) Compiled with Qt 6.8.1 winnt: 10.0.26100 windows: 11

Here is my settings Image

Do you have an idea ?

Uxose avatar Aug 22 '25 14:08 Uxose

I tried flatpak, arch repo, flameshot-git but none work. Currently on latest

❯ flameshot --version
Flameshot v13.1.0 (02469326)
Compiled with Qt 6.9.1

AyushSehrawat avatar Aug 22 '25 15:08 AyushSehrawat

I found a useful hack in another thread: https://github.com/flameshot-org/flameshot/issues/635#issuecomment-2302675095 I also rebound the "Accept the capture" keybinding to Ctrl + C for a more comfortable experience. The final command for my PrtSc shortcut is: sh -c "QT_QPA_PLATFORM=wayland flameshot gui -r | xclip -selection clipboard -t image/png"

setafd avatar Aug 28 '25 18:08 setafd

I found a useful hack in another thread: #635 (comment) I also rebound the "Accept the capture" keybinding to Ctrl + C for a more comfortable experience. The final command for my PrtSc shortcut is: sh -c "QT_QPA_PLATFORM=wayland flameshot gui -r | xclip -selection clipboard -t image/png"

Thanks! this works for me, directly opens gui with clipboard default

AyushSehrawat avatar Aug 29 '25 15:08 AyushSehrawat

I found a useful hack in another thread: #635 (comment) I also rebound the "Accept the capture" keybinding to Ctrl + C for a more comfortable experience. The final command for my PrtSc shortcut is: sh -c "QT_QPA_PLATFORM=wayland flameshot gui -r | xclip -selection clipboard -t image/png"

Got mine working on wayland with wl-clipboard instead of xclip bash -c "QT_QPA_PLATFORM=xcb flameshot gui -r | wl-copy"

Sometimes it ignores the "accept" and "abort" shortcuts, but reacts to ui buttons. It happens so rarely that it's difficult to find out what is special about those cases.

ServAlex avatar Aug 31 '25 21:08 ServAlex

I found a useful hack in another thread: #635 (comment) I also rebound the "Accept the capture" keybinding to Ctrl + C for a more comfortable experience. The final command for my PrtSc shortcut is: sh -c "QT_QPA_PLATFORM=wayland flameshot gui -r | xclip -selection clipboard -t image/png"

Got mine working on wayland with wl-clipboard instead of xclip bash -c "QT_QPA_PLATFORM=xcb flameshot gui -r | wl-copy"

Sometimes it ignores the "accept" and "abort" shortcuts, but reacts to ui buttons. It happens so rarely that it's difficult to find out what is special about those cases.

huh amazing! That copying is finally working for me too (combined with compiling manually due to fractional scaling). This is very blurry though, removing the env variable QT_QPA_PLATFORM=xcb fixed the blur for me, so for me, I just set this in my shortcuts: bash -c "flameshot gui -r | wl-copy" (Ubuntu 24.04, single monitor at 125% scaling)

EDIT: I'm now automatically saving a file additionally to the disk, not ideal but kind of doing the trick bash -c "flameshot gui -r | wl-copy && wl-paste > ~/Pictures/screenshot-$(date +"%Y-%m-%d_%H-%M-%S").png"

0cv avatar Sep 02 '25 07:09 0cv

sh -c "QT_QPA_PLATFORM=wayland flameshot gui -r | xclip -selection clipboard -t image/png"

Thanks, this works for me on Fedora 42.

gokul1630 avatar Sep 10 '25 07:09 gokul1630

I found a useful hack in another thread: #635 (comment) I also rebound the "Accept the capture" keybinding to Ctrl + C for a more comfortable experience. The final command for my PrtSc shortcut is: sh -c "QT_QPA_PLATFORM=wayland flameshot gui -r | xclip -selection clipboard -t image/png"

Got mine working on wayland with wl-clipboard instead of xclip bash -c "QT_QPA_PLATFORM=xcb flameshot gui -r | wl-copy"

Sometimes it ignores the "accept" and "abort" shortcuts, but reacts to ui buttons. It happens so rarely that it's difficult to find out what is special about those cases.

How did you make KB shortcut to work with it?

Edit (Gnome Arch Linux)

From the arch wiki:

#!/bin/sh
export QT_QPA_PLATFORM=wayland
/usr/bin/flameshot gui

But I wanted copy to clipboard work as well, so:

#!/bin/sh
export QT_QPA_PLATFORM=wayland
sh -c "QT_QPA_PLATFORM=xcb flameshot gui -r | wl-copy"

I saved it as flameshot-fix (don't include .sh). I saved it in my $PATH. It worked like a charm.

For Kb shortcut: I added script with full path to the command section:

command: /home/abuturab/.local/bin/flameshot-fix

Customize the path to your script location.

abuturabofficial avatar Sep 25 '25 05:09 abuturabofficial