Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ubuntu 24.04 , not able to use the shortcut key to call flameshot for taking screenshots. #3712

Open
changchichung opened this issue Sep 2, 2024 · 8 comments
Labels
Unconfirmed Bug The bug is not confirmed by anyone else.

Comments

@changchichung
Copy link

changchichung commented Sep 2, 2024

Flameshot Version

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

Installation Type

apt

Operating System type and version

ubuntu 24.04.1 Desktop

Description

I've been using a custom shortcut key, Ctrl+1, to call the "flameshot gui" command for taking screenshots on Ubuntu 22.04.

Recently, I upgraded to Ubuntu 22.04.1 and reinstalled my laptop. I tried to set up the same custom shortcut key for flameshot, but it's not working and I'm getting an error.
I tried manually running "flameshot gui" in the terminal window, and it worked fine.

I then checked the /var/log/syslog file and found an error message when trying to use the shortcut key

2024-09-02T13:59:58.348562+08:00 chchang-ThinkPad-T470p systemd[2202]: Started app-gnome-flameshot-852640.scope - Application launched by gsd-media-keys.
2024-09-02T13:59:58.503497+08:00 chchang-ThinkPad-T470p xdg-desktop-por[4074]: Failed to associate portal window with parent window 
2024-09-02T13:59:58.504938+08:00 chchang-ThinkPad-T470p xdg-desktop-por[3919]: 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-02T13:59:58.520813+08:00 chchang-ThinkPad-T470p flameshot[852640]: flameshot: error: Unable to capture screen
2024-09-02T13:59:58.529360+08:00 chchang-ThinkPad-T470p flameshot[852640]: flameshot: error: Unable to capture screen
2024-09-02T13:59:58.600501+08:00 chchang-ThinkPad-T470p flameshot[852640]: flameshot: info: Screenshot aborted.

Steps to reproduce

No response

Screenshots or screen recordings

No response

System Information

  1. ubuntu 24.04.1
  2. monitor
  3. wayland , GNOME 46
@changchichung changchichung added the Unconfirmed Bug The bug is not confirmed by anyone else. label Sep 2, 2024
@zhuangweiji
Copy link

zhuangweiji commented Sep 2, 2024

The system prompted me to update to Ubuntu 24.04.1 LTS. After the update, I can normally use flameshot gui in the command line.

However, I cannot use the shortcut key.
image
image

I have already bound flameshot gui to Alt + A in Settings > Keyboard > View and Customise Shortcuts > Custom shortcuts.

image

the /var/log/syslog file:

2024-09-02T18:25:56.414396+08:00 HP-680 systemd[3262]: Started app-gnome-flameshot-9041.scope - Application launched by gsd-media-keys.
2024-09-02T18:25:56.479808+08:00 HP-680 xdg-desktop-por[4183]: Failed to associate portal window with parent window 
2024-09-02T18:25:56.480580+08:00 HP-680 xdg-desktop-por[4095]: 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-02T18:25:56.489617+08:00 HP-680 flameshot[9041]: flameshot: error: Unable to capture screen
2024-09-02T18:25:56.495023+08:00 HP-680 flameshot[9041]: flameshot: error: Unable to capture screen
2024-09-02T18:25:56.579197+08:00 HP-680 flameshot[9041]: flameshot: info: Screenshot aborted.

@NerijusNoreika
Copy link

Have the same error as the comment above.

@roland-ewald
Copy link

Same here; see also this discussion: flatpak/xdg-desktop-portal#1070

This comment provides a nice workaround (TLDR, QT_QPA_PLATFORM=wayland is required as environment variable for the shortcut to work, so you have to wrap the call into a one-liner script and configure that as custom shortcut):
flatpak/xdg-desktop-portal#1070 (comment)

@fedelmar
Copy link

Have you try this solution?

#3498 (comment)

@EnverOsmanov
Copy link

Same here; see also this discussion: flatpak/xdg-desktop-portal#1070

This comment provides a nice workaround (TLDR, QT_QPA_PLATFORM=wayland is required as environment variable for the shortcut to work, so you have to wrap the call into a one-liner script and configure that as custom shortcut): flatpak/xdg-desktop-portal#1070 (comment)

My environment variable is set to "QT_QPA_PLATFORM=wayland;xcb", it was needed for some other app (I think it's qBittorrent).
That's why flameshot was still not working.

Running flameshot with own variable worked:

QT_QPA_PLATFORM=wayland flameshot

@ilhamwahyu-ni
Copy link

ilhamwahyu-ni commented Sep 28, 2024

temporary solution, you can use a bash shell script,
here I named bash "ss.sh"

and the keyboard buttons work...

image

image
chmod +x ./ss.sh

image

Ubuntu 20.04

@mca-gif
Copy link

mca-gif commented Sep 30, 2024

Without creating additional files, this can be done directly from the Gnome Keyboard Custom Shortcuts configuration by setting the command to sh -c "QT_QPA_PLATFORM=wayland flameshot gui"

This has been tested with Ubuntu 24.04 with flameshot installed via the repositories.

image

@x-dl
Copy link

x-dl commented Oct 25, 2024

Without creating additional files, this can be done directly from the Gnome Keyboard Custom Shortcuts configuration by setting the command to sh -c "QT_QPA_PLATFORM=wayland flameshot gui"

This has been tested with Ubuntu 24.04 with flameshot installed via the repositories.

image

thank you bro , it solves my problem , its very nice of you ,thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unconfirmed Bug The bug is not confirmed by anyone else.
Projects
None yet
Development

No branches or pull requests

9 participants