Published on

Flameshot troubleshooting

  • avatar

使用 GNOME 自定义快捷键无法调起 flameshot gui


注意, 这里比较奇怪的是,直接在 GNOME 自定义 key binding 里面的 command 写上 /usr/bin/env QT_QPA_PLATFORM=wayland flameshot gui 是不会工作的.

必须通过 shell 脚本执行。暂时不知道原因。

sudo tee /usr/local/bin/flameshot-gui-workaround > /dev/null <<'EOF'
# workaround thanks to
env QT_QPA_PLATFORM=wayland flameshot gui


sudo chmod a+x /usr/local/bin/flameshot-gui-workaround

然后我们把原来配置的 GNOME 自定义 shortcut 的 command 从 flameshot gui 换成 /usr/local/bin/flameshot-gui-workaround :


点击 "Take Screenshot" 无法显示截图界面


xdg-desktop-por[848788]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog


Hi guys, I was going to add my 2 cents on how it doesn't work for me, but then I experimented a bit more and it started working.

OS: Fedora 37, Wayland, Gnome 43, Flameshot: 12.1.0 installed using dnf, xdg-desktop-portal-1.15.0-1.fc37

What I did to make it work:

Run flameshot Open flameshot's settings window(I also maximized the window to lower the chances of loosing focus of that window - probably not needed) Take a screenshot using flameshot - I clicked the tray icon that came from a gnome extension Permissions question should appear - grant it It should now work fine without asking for permissions next time you take a screenshot The same can be done for flameshot run from the terminal, or triggered by a keyboard shortcut. You need to run flameshot in the terminal instead of using gnome launcher, and repeat the above steps. In this case I don't know if it's the flameshot settings window that needs to be actively focused to trigger the permissions prompt. But it's one of those.

In summary, I can now run flameshot from the tray icon, from terminal, from the ALT+F2(gnome's run command tool) and it takes screenshots without asking for permissions.

点击 "Take Screenshot" 直接被拒绝

与前面说的 "GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog" 错误不同, 这次是直接被拒绝。 出现这种情况,基本上是因为,在第一次弹出权限确认窗口的时候,你没有选择(直接按esc也相当于回答了no), 或者选择了 no, 后面就会直接拒绝了。


org.flameshot.Flameshot.desktop[887167]: flameshot: error: Unable to capture screen


好在万能的 github 用户也给出了解决办法:

先 dump 一下当前的配置:

import dbus
import json

bus = dbus.SessionBus()
perm = bus.get_object('org.freedesktop.impl.portal.PermissionStore', '/org/freedesktop/impl/portal/PermissionStore')
perm_iface = dbus.Interface(perm, dbus_interface='org.freedesktop.impl.portal.PermissionStore')

perm_iface.Lookup("screenshot", "screenshot")
print(json.dumps(perm_iface.Lookup("screenshot", "screenshot"), indent=4))

正常情况下,dump 成 json 后的结果应该类似:

        "": [
        "kitty": [
        "org.flameshot.Flameshot": [

这里主要是检查是否存在 org.flameshot.Flameshot 并且值应该为 ["yes"].

比如这种情况就是之前拒绝过的情况(值为 no):

>>> perm_iface.Lookup("screenshot", "screenshot")
(dbus.Dictionary({dbus.String(''): dbus.Array([dbus.String('yes')], signature=dbus.Signature('s')), dbus.String('org.flameshot.Flameshot'): dbus.Array([dbus.String('no')], signature=dbus.Signature('s'))}, signature=dbus.Signature('sas')), dbus.Byte(0, variant_level=1))

我们把它 set 回去成 yes:

perm_iface.Set("screenshot", dbus.Boolean(True), "screenshot", {"":["yes"], "org.flameshot.Flameshot": ["yes"]}, dbus.Byte(0x0))

>>> perm_iface.Lookup("screenshot", "screenshot")
(dbus.Dictionary({dbus.String(''): dbus.Array([dbus.String('yes')], signature=dbus.Signature('s')), dbus.String('org.flameshot.Flameshot'): dbus.Array([dbus.String('yes')], signature=dbus.Signature('s'))}, signature=dbus.Signature('sas')), dbus.Byte(0, variant_level=1))

"保存到文件" 无反应

不知道什么时候开始 flameshot 保存到文件的功能不工作了。也没报错。


找到了这个 issue


cat ~/.config/flameshot/flameshot.ini

发现配置就这几行。 但是明明 GUI 配置界面显示了保存路径是 /home/ttys3/Pictures/Screenshots 啊?

重新进入 general 配置,发现有一个 Prefered save file extension 没有值, 于是随手选了一个 avif 格式, 然后再看文件配置,发现已经有保存路径的配置了:


然后再测试保存到文件的功能,也 OK 了. 看来就是 saveAsFileExtension 为空导致文本配置并没有保存成功。问题是它没取到 savePath 居然不报错。



Taking screenshots with Java under Wayland

flameshot 官方文档里的 troubleshooting 也是不错的参考

First try the using the command flameshot gui in terminal. This does exactly what clicking on the tray icon does. (make sure can you see Flameshot icon in the tray area)

If the above step didn't work:

Open 3 terminals

Kill Flameshot if it is already open using pkill flameshot

In the first terminal run dbus-monitor --session sender=org.flameshot.Flameshot

In the second terminal run flameshot

In the third terminal run flameshot gui