flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
23.96k stars 1.52k forks source link

Flameshot doesnt copy URL to clipboard after upload #3453

Open ghost opened 6 months ago

ghost commented 6 months ago

Flameshot Version

Flameshot v12.1.0 (Debian 12.1.0-2) Compiled with Qt 5.15.8

Installation Type

Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)

Operating System type and version

Debian GNU/Linux 12 (bookworm) x86_64, KDE Plasma 5.27.5

Description

After uploading a screenshot, the URL is not being copied to the clipboard.

Using Debian 12 with KDE Plasma on Wayland.

Steps to reproduce

  1. run flameshot
  2. select a screen area
  3. upload the image
  4. URL of the imgur image does not get copied to clipboard

Screenshots or screen recordings

No response

System Information

OS: Debian GNU/Linux 12 (bookworm) x86_64 Host: MS-7C56 2.0 Kernel: 6.1.0-16-amd64 Uptime: 3 hours, 57 mins Packages: 2448 (dpkg) Shell: bash 5.2.15 Resolution: 1920x1080 DE: Plasma 5.27.5 WM: kwin Theme: [Plasma], Breeze [GTK2/3] Icons: [Plasma], breeze-dark [GTK2/3] Terminal: konsole CPU: AMD Ryzen 7 5700G with Radeon Graphics (16) @ 3.800GHz GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series Memory: 10495MiB / 27950MiB

Monirzadeh commented 6 months ago

this call not happen (sessionBus created without problem) https://github.com/flameshot-org/flameshot/blob/3d21e4967b68e9ce80fb2238857aa1bf12c7b905/src/core/flameshotdaemon.cpp#L154-L156

we can use this

QClipboard* clipboard = QGuiApplication::clipboard();
clipboard->setText(text);

but i am not sure this will be best approach. will this affect other platform or not etc..

bbnolauv commented 5 months ago

same problem here. Can not copy URL after uploading to Imgur. Actually it already displays "URL copied to clipboard" but empty when i paste.

OS: Arch Linux x86_64 Kernel: 6.6.10-arch1-1 Shell: zsh 5.9 DE: Hyprland WM: sway Theme: Numix [GTK2], Dracula [GTK3] Terminal: kitty CPU: Intel i5-9300H (8) @ 4.100GHz GPU: NVIDIA GeForce GTX 1650 Mobile / Max-Q GPU: Intel CoffeeLake-H GT2 [UHD Graphics 630]

root-hal9000 commented 5 months ago

Same here, running flatpak versio on onKubuntu 23.10, wayland session - although the URLs are stored in the history in flameshot itself, so they are retrievable that way

Monirzadeh commented 5 months ago

@bbnolauv @ffcruz85 can you test this and report if it work for you? https://github.com/flameshot-org/flameshot/issues/3453#issuecomment-1872931207

bbnolauv commented 5 months ago

@Monirzadeh it works. But now I encountered another problem. The "flameshot gui" runs normally and no errors are reported, but the clipboard is empty with no pictures. I have no idea why. (This bug is not due to your modification. Maybe I should not continue to reply to this issue but open a new issue.)

Nonetheless, thank you.

Monirzadeh commented 5 months ago

@Monirzadeh it works. But now I encountered another problem. The "flameshot gui" runs normally and no errors are reported, but the clipboard is empty with no pictures. I have no idea why. (This bug is not due to your modification. Maybe I should not continue to reply to this issue but open a new issue.)

Nonetheless, thank you.

@bbnolauv with copy selection to clipboard? can you send me the issue you open for that? i am not sure but some sort of problem in dbus functionally in flameshot i can see that too. maybe and just maybe i can found the root of problem and send a PR to fix both of them.

root-hal9000 commented 5 months ago

@Monirzadeh I am sorry, I did not understand what you meant with the test comment - make those changes and build it myself? Also - I actually have more information, I just realized that's only happening in Wayland - it worked in fine X11. If I remember correctly, Flameshot doesn't fully support wayland anyway right? I get other issues there, like when I have 3 monitors and when I activate flameshot, it only shows a screenshot selection area in the main monitor, with the image of 2 monitors (but not the third one) squished there

Monirzadeh commented 5 months ago

@ffcruz85 i just want sure this change work fine in other enviroments. if it possible for you please clone the project and build that with that change i mention and report if it not working in your machine. it work for me on wayland (some bugs still exist) i test that on my build from source and it work fine on wayland with external monitor. do you use git version or last stable release?

root-hal9000 commented 5 months ago

@Monirzadeh stable release installed with apt here's output of flameshot --version: Flameshot v12.1.0 (Debian 12.1.0-2) Compiled with Qt 5.15.8 I will clone from git and try your fix - from main branch right?

Monirzadeh commented 5 months ago

yes.

root-hal9000 commented 5 months ago

@Monirzadeh Ok, I just tried - and just to be clear, you meant replace those lines 154-156 with the two you provided, not add below them right? It worked and copied to clipboard! It also popped up a preview screen with options to copy URL, delete, etc screen - which wasn't happening before but maybe that was a setting I had disabled? I am adding the console output below, as well as all the requested info under the issue reporting page in case that helps in any way. Oh, regarding the wayland issue I mentioned, where it's essentially squishing all my 3 monitors into the main one but clipping them off, it's showing all of DP-4, half of DP-3, and none of DP-2 -- per the output below

Console output:

QSocketNotifier: Can only be used with threads started with QThread
libEGL warning: egl: failed to create dri2 screen
Unable to get current screen, starting to use primary screen. It may be a cause of logical error and working with a wrong screen.
QLayout: Attempting to add QLayout "" to SidePanelWidget "", which already has a layout
Unable to get current screen, starting to use primary screen. It may be a cause of logical error and working with a wrong screen.
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
Unable to get current screen, starting to use primary screen. It may be a cause of logical error and working with a wrong screen.
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
flameshot: info: URL copied to clipboard.
QLayout: Attempting to add QLayout "" to SidePanelWidget "", which already has a layout
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setCompositionMode: Painter not active
QPainter::translate: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::setBrush: Painter not active

./flameshot --version

Flameshot v12.1.0 (3d21e496)
Compiled with Qt 5.15.10

inxi --width 80 --system --graphics

System:
  Host: HAL9000 Kernel: 6.5.0-14-generic arch: x86_64 bits: 64
    Desktop: KDE Plasma v: 5.27.8 Distro: Ubuntu 23.10 (Mantic Minotaur)
Graphics:
  Device-1: NVIDIA TU104 [GeForce RTX 2070 SUPER] driver: nvidia v: 535.146.02
  Device-2: AMD Raphael driver: amdgpu v: kernel
  Device-3: Logitech Webcam C930e driver: snd-usb-audio,uvcvideo type: USB
  Display: wayland server: X.org v: 1.21.1.7 with: Xwayland v: 23.2.0
    compositor: kwin_wayland driver: X: loaded: amdgpu,nvidia
    unloaded: fbdev,modesetting,nouveau,vesa dri: radeonsi gpu: nvidia,amdgpu
    resolution: 1: 1050x1680 2: 3840x2160 3: 1920x1080
  API: OpenGL v: 4.5 Mesa 23.2.1-1ubuntu3.1 renderer: llvmpipe (LLVM 15.0.7
    256 bits)

xrandr | grep -v " disconnected "

DP-2 connected 1050x1680+5760+91 right (normal left inverted right x axis y axis) 430mm x 270mm
   1680x1050     59.85*+
   1400x1050     59.86  
   1280x1024     59.89  
   1280x960      59.94  
   1152x864      59.78  
   1024x768      59.68  
   800x600       59.86  
   640x480       59.38  
   320x240       59.52  
   1440x900      59.89  
   1280x800      59.81  
   1152x720      59.75  
   960x600       59.63  
   928x580       59.88  
   800x500       59.50  
   768x480       59.38  
   720x480       59.71  
   640x400       59.20  
   320x200       58.96  
   1600x900      59.82  
   1368x768      59.88  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.55  
   640x350       59.77  
DP-3 connected primary 3840x2160+1920+0 (normal left inverted right x axis y axis) 600mm x 340mm
   3840x2160     59.98*+
   2048x1536     59.95  
   1920x1440     59.90  
   1600x1200     59.87  
   1440x1080     59.99  
   1400x1050     59.98  
   1280x1024     59.89  
   1280x960      59.94  
   1152x864      59.96  
   1024x768      59.92  
   800x600       59.86  
   640x480       59.38  
   320x240       59.52  
   2560x1600     59.94  
   1920x1200     59.88  
   1680x1050     59.95  
   1440x900      59.89  
   1280x800      59.81  
   1152x720      59.75  
   960x600       59.63  
   928x580       59.88  
   800x500       59.50  
   768x480       59.90  
   720x480       59.71  
   640x400       59.95  
   320x200       58.96  
   3200x1800     59.96  
   2880x1620     59.96  
   2560x1440     59.96  
   2048x1152     59.90  
   1920x1080     59.96  
   1600x900      59.95  
   1368x768      59.88  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.55  
   640x350       59.77  
DP-4 connected 1920x1080+0+391 (normal left inverted right x axis y axis) 480mm x 270mm
   1920x1080     59.96*+
   1440x1080     59.99  
   1400x1050     59.98  
   1280x1024     59.89  
   1280x960      59.94  
   1152x864      59.96  
   1024x768      59.92  
   800x600       59.86  
   640x480       59.38  
   320x240       59.52  
   1680x1050     59.95  
   1440x900      59.89  
   1280x800      59.81  
   1152x720      59.97  
   960x600       59.63  
   928x580       59.88  
   800x500       59.50  
   768x480       59.90  
   720x480       59.71  
   640x400       59.95  
   320x200       58.96  
   1600x900      59.95  
   1368x768      59.88  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.55  
   640x350       59.77

lshw -class display

  *-display                 
       description: VGA compatible controller
       product: TU104 [GeForce RTX 2070 SUPER]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: iomemory:fc0-fbf iomemory:fc0-fbf irq:131 memory:fb000000-fbffffff memory:fcc0000000-fccfffffff memory:fcd0000000-fcd1ffffff ioport:f000(size=128) memory:fc000000-fc07ffff
  *-display
       description: VGA compatible controller
       product: Raphael
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:0d:00.0
       version: c2
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi msix vga_controller bus_master cap_list
       configuration: driver=amdgpu latency=0
       resources: iomemory:fc0-fbf iomemory:fc0-fbf irq:69 memory:fce0000000-fcefffffff memory:fcf0000000-fcf01fffff ioport:d000(size=256) memory:fc500000-fc57ffff
  *-graphics
       product: EFI VGA
       physical id: 1
       logical name: /dev/fb0
       capabilities: fb
       configuration: depth=32 resolution=3840,2160

uname -a Linux HAL9000 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Monirzadeh commented 5 months ago

i want just add

QClipboard* clipboard = QGuiApplication::clipboard();
clipboard->setText(text);

after

checkDBusConnection(sessionBus); 

i think it should solve problem to have url in clipboard. upload selection ask you for upload capture and than press yes. if everything work fine it should show you a notification that url add to clipboard.

root-hal9000 commented 5 months ago

@Monirzadeh I had replaced instead of added, but yes, in either case, it worked and the URL was in the clipboard

bbnolauv commented 5 months ago

@Monirzadeh it works. But now I encountered another problem. The "flameshot gui" runs normally and no errors are reported, but the clipboard is empty with no pictures. I have no idea why. (This bug is not due to your modification. Maybe I should not continue to reply to this issue but open a new issue.) Nonetheless, thank you.

@bbnolauv with copy selection to clipboard? can you send me the issue you open for that? i am not sure but some sort of problem in dbus functionally in flameshot i can see that too. maybe and just maybe i can found the root of problem and send a PR to fix both of them.

Sorry, i cannot reproduce this now. Dont know whats wrong within it