flameshot-org / flameshot

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

Flameshot not working on ubuntu 24.04 LTS #3700

Open aman2talk opened 3 months ago

aman2talk commented 3 months ago

Flameshot Version

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

Installation Type

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

Operating System type and version

ubuntu: 24.04 LTS

Description

The app doesn't get installed from snap store. if you try to install using the apt, It gets installed but when you start the app and try to capture the screenshot it says "Unable to capture the screen".

Steps to reproduce

No response

Screenshots or screen recordings

image

System Information

linux: 6.8.0-41-generic

Kev-Prime commented 3 months ago

+1 this having the same issues on arch most recent updoot nuked flameshot.

Kev-Prime commented 3 months ago

Anyone having issues with 12.1.0 on Linux just check all your packages for updates apply them and restart. Fixed for me hope it works for you.

aman2talk commented 3 months ago

I installed the fresh OS ubuntu 24.04 LTS with all the available updates. But it does not launch. But I am able to trigger the app via command line 'flameshot gui'. I even tried it compiling from source but same issue.

aman2talk commented 3 months ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

1. Edit GDM(GNOME Display Manager) Configuration

a) Open the GDM configuration file using a text editor with root privileges sudo nano /etc/gdm3/custom.conf

b) Uncomment or add the following line under the [daemon] section WaylandEnable=false

2. Restart GDM:

Restart the GDM display manager to apply the changes: sudo systemctl restart gdm3 Alternatively, you can reboot your system.

3. Verify the Change

To confirm you're now using Xorg, open a terminal and run echo $XDG_SESSION_TYPE This should output x11 if you're successfully running on Xorg.

Now restart the flameshot app and try to take the screenshot. It will work flawlessly :)

Kev-Prime commented 3 months ago

I just confirmed it works on both my X11 environment and wayland.

Falmeshot supports both.

If one isn't work certainly feel free to try the other of course.

jonathanhirschman commented 3 months ago

Having same/similar issue - Flameshot works on x11 no problem, has issues in Wayland. In case it matters, I'm using Nvidia proprietary drivers. Update: same issue on another machine using open drivers for Intel Xe graphics, so it ain't because Nvidia.

Here's what I'm seeing:

1) Via hotkey

I have a hot key defined in Ubuntu prefs for Flameshot grabs: image

Using the hotkey under Wayland results in this:

image

This works on x11, and has always worked for me in the past.

2) From command line: $ /usr/bin/flameshot gui

Results in a screen flash, a bit of a pause, and then flameshot works as expected. It remains in the tray.

3) From tray icon menu:

Selecting "Take Screenshot" works as per the command line.

Version is 12.1.0 installed via apt, all updates applied.

image

eNg1ne85 commented 3 months ago

I have the same issue on Ubuntu 24.04.1 Wayland Gnome session

2024-09-04T09:24:46.696152+02:00 nbdgajda xdg-desktop-por[3966]: Failed to associate portal window with parent window 2024-09-04T09:24:46.698601+02:00 nbdgajda xdg-desktop-por[3958]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog 2024-09-04T09:24:46.725625+02:00 nbdgajda org.flameshot.Flameshot.desktop[16566]: flameshot: error: Unable to capture screen

jdmallen commented 3 months ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

1. Edit GDM(GNOME Display Manager) Configuration

a) Open the GDM configuration file using a text editor with root privileges sudo nano /etc/gdm3/custom.conf

b) Uncomment or add the following line under the [daemon] section WaylandEnable=false

2. Restart GDM:

Restart the GDM display manager to apply the changes: sudo systemctl restart gdm3 Alternatively, you can reboot your system.

3. Verify the Change

To confirm you're now using Xorg, open a terminal and run echo $XDG_SESSION_TYPE This should output x11 if you're successfully running on Xorg.

Now restart the flameshot app and try to take the screenshot. It will work flawlessly :)

Confirmed this fixed the issue for me on Ubuntu 24.04. Thanks!

pvbcoelho commented 2 months ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

1. Edit GDM(GNOME Display Manager) Configuration

a) Open the GDM configuration file using a text editor with root privileges sudo nano /etc/gdm3/custom.conf

b) Uncomment or add the following line under the [daemon] section WaylandEnable=false

2. Restart GDM:

Restart the GDM display manager to apply the changes: sudo systemctl restart gdm3 Alternatively, you can reboot your system.

3. Verify the Change

To confirm you're now using Xorg, open a terminal and run echo $XDG_SESSION_TYPE This should output x11 if you're successfully running on Xorg.

Now restart the flameshot app and try to take the screenshot. It will work flawlessly :)

This worked for me, thanks :)

bvdvb commented 2 months ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

1. Edit GDM(GNOME Display Manager) Configuration

a) Open the GDM configuration file using a text editor with root privileges sudo nano /etc/gdm3/custom.conf

b) Uncomment or add the following line under the [daemon] section WaylandEnable=false

2. Restart GDM:

Restart the GDM display manager to apply the changes: sudo systemctl restart gdm3 Alternatively, you can reboot your system.

3. Verify the Change

To confirm you're now using Xorg, open a terminal and run echo $XDG_SESSION_TYPE This should output x11 if you're successfully running on Xorg.

Now restart the flameshot app and try to take the screenshot. It will work flawlessly :)

Works, super thank you

roland-ewald commented 2 months ago

If you want to keep using wayland, this workaround may help too: https://github.com/flameshot-org/flameshot/issues/3712#issuecomment-2334966021

eNg1ne85 commented 2 months ago

If you want to keep using wayland, this workaround may help too: #3712 (comment)

Yes, it is working now on wayland, thank you.

Duduxs commented 2 months ago

If you want to keep using wayland, this workaround may help too: #3712 (comment)

This workaround is working on wayland without any problems.

image

Thanks.

oleh-mordach commented 2 months ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

1. Edit GDM(GNOME Display Manager) Configuration

a) Open the GDM configuration file using a text editor with root privileges sudo nano /etc/gdm3/custom.conf

b) Uncomment or add the following line under the [daemon] section WaylandEnable=false

2. Restart GDM:

Restart the GDM display manager to apply the changes: sudo systemctl restart gdm3 Alternatively, you can reboot your system.

3. Verify the Change

To confirm you're now using Xorg, open a terminal and run echo $XDG_SESSION_TYPE This should output x11 if you're successfully running on Xorg.

Now restart the flameshot app and try to take the screenshot. It will work flawlessly :)

Ubuntu24.04 Flameshot v12.1.0 (Debian 12.1.0-2build2) Compiled with Qt 5.15.12

Works for me. Thanks.

oviuap commented 2 months ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

1. Edit GDM(GNOME Display Manager) Configuration

a) Open the GDM configuration file using a text editor with root privileges sudo nano /etc/gdm3/custom.conf

b) Uncomment or add the following line under the [daemon] section WaylandEnable=false

2. Restart GDM:

Restart the GDM display manager to apply the changes: sudo systemctl restart gdm3 Alternatively, you can reboot your system.

3. Verify the Change

To confirm you're now using Xorg, open a terminal and run echo $XDG_SESSION_TYPE This should output x11 if you're successfully running on Xorg.

Now restart the flameshot app and try to take the screenshot. It will work flawlessly :)

it works for me on 24.04.1 LTS (Noble Numbat). Thanks!!!!

liuliu-miao commented 2 months ago

it works for me on 24.04.1 LTS with wayland, custom shorcur command: bash -c -- "flameshot gui > /dev/null" image

mrugeshrocks commented 1 month ago

For me with enabling wayland this flameshot works but it breaks 3finger swipe gesture which i use to switch workspace.

Workaround with Xorg . Modify your screenshot command and add sudo

image

SharifMAbdullah commented 1 month ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

Following these steps blew up my GUI. I had to switch to tty and then comment this line again WaylandEnable=false

dsimardmtm commented 1 month ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

If you follow the suggestion above, you'll get Flameshot working, but you’ll end up breaking something else. The change is too broad just to get Flameshot working.

What I did instead was change the Flameshot shortcut like this:

# /usr/share/applications/org.flameshot.Flameshot.desktop
[Desktop Entry]
Name=Flameshot
# ... many lines of config ...
Exec=flameshot gui  # originally `Exec=flameshot`
Icon=org.flameshot.Flameshot
Terminal=true  # originally `Terminal=false`

This is a hack, but it’s much more targeted and has less impact on the system. I’m sure there’s a better way, but I just want to annotate a screen capture and not spend too much time trying to make it work.

christianciu commented 3 weeks ago

This works for me https://flameshot.org/docs/guide/wayland-help/#gnome-shortcut-does-not-trigger-flameshot

I just create a sh file and bind it to Print keyboard shortcut

#!/bin/sh
flameshot gui
MrBns commented 1 week ago

Hi Everyone, I found the solution for the above issue. Actually the problem is, By default Ubuntu 24.04 is using the Wayland as GDM (GNOME Display Manager) and flameshot and upwork time tracker require Xorg to function properly. You have to use the Xorg instead. To Switch from Wayland to Xorg follow the steps below.

1. Edit GDM(GNOME Display Manager) Configuration

a) Open the GDM configuration file using a text editor with root privileges sudo nano /etc/gdm3/custom.conf

b) Uncomment or add the following line under the [daemon] section WaylandEnable=false

2. Restart GDM:

Restart the GDM display manager to apply the changes: sudo systemctl restart gdm3 Alternatively, you can reboot your system.

3. Verify the Change

To confirm you're now using Xorg, open a terminal and run echo $XDG_SESSION_TYPE This should output x11 if you're successfully running on Xorg.

Now restart the flameshot app and try to take the screenshot. It will work flawlessly :)

Lol, we should switch to X11 just for this flameshot not working ? @aman2talk . Instead they should add first class support for wayland. because almost every Desktop environment like plasma, gnome is By default Wayland now.

aman2talk commented 1 week ago

@MrBns Yes, Of course they should. If you read the task description carefully you would have noticed, It's not only the flameshot, Upwork didn't support wayland as well till then (I am not sure if they released the wayland update now). Being a developer, I need both. So shifting to the wayland makes sense for me. Furthermore since I am not a part of flameshot or upwork dev team, I need to find the reliable workaround to get my system stable and working without any issue. It's working fine for me since then no issue at all. Hope the same for you.

jwestman89 commented 5 days ago

A very easy fix for this is to create a script that allows flameshot access to your displays:

I created a script called flameshot_gui.sh

_#!/bin/bash
#Dynamically export the DISPLAY environment variable
export DISPLAY=$(echo $DISPLAY)
export XDG_RUNTIME_DIR=/run/user/$(id -u)
flameshot gui_

save this script in e.g. /usr/bin and add executable permissions with sudo chmod a+x flameshot_gui.sh

Then go to

Settings -> Keyboard -> Key bindings -> Custom

add a new binding to your print screen button that just calls flameshot_gui.sh and it will work normally.

Tested on: Linux wrk 6.8.0-49-generic #49-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 4 02:06:24 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux