You are not logged in.

#1 2023-04-04 10:41:39

LittleSandra
Member
Registered: 2021-01-25
Posts: 81

[Solved] How to start flameshot under Sway / Wayland?

Dear all smile

When I run "flameshot config" it works, but "flameshot gui" gives me

$ flameshot gui
flameshot: error: Unable to detect desktop environment (GNOME? KDE? Sway? ...)
flameshot: error: Hint: try setting the XDG_CURRENT_DESKTOP environment variable.
flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
flameshot: info: Screenshot aborted.

I am using Wayland/Sway.

Any ideas what is going on?

Hugs,
Sandra smile

Last edited by LittleSandra (2023-04-04 12:21:26)

Offline

#2 2023-04-04 11:25:35

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,237

Re: [Solved] How to start flameshot under Sway / Wayland?

Tried the hint?

XDG_CURRENT_DESKTOP=Sway flameshot gui

you probably generally want to set that environment variable when starting sway

Online

#3 2023-04-04 11:30:55

stanczew
Member
Registered: 2021-03-02
Posts: 93

Offline

#4 2023-04-04 11:32:37

LittleSandra
Member
Registered: 2021-01-25
Posts: 81

Re: [Solved] How to start flameshot under Sway / Wayland?

V1del wrote:

Tried the hint?

XDG_CURRENT_DESKTOP=Sway flameshot gui

you probably generally want to set that environment variable when starting sway

That doesn't give a GUI either.

I have followed this howto

https://github.com/flameshot-org/flames … support.md

sudo pacman -S xdg-desktop-portal xdg-desktop-portal-wlr grim flameshot

and I start Sway from .bash_profile

# https://wiki.archlinux.org/title/Xinit#Autostart_X_at_login
if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then

  # https://github.com/flameshot-org/flameshot/blob/master/docs/Sway%20and%20wlroots%20support.md
  export SDL_VIDEODRIVER=wayland
  export _JAVA_AWT_WM_NONREPARENTING=1
  export QT_QPA_PLATFORM=wayland
  export XDG_CURRENT_DESKTOP=sway
  export XDG_SESSION_DESKTOP=sway

  exec sway > ~/.sway.log 2>&1
fi

And I have the following in Sway config

exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
exec hash dbus-update-activation-environment 2>/dev/null && \
     dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

Are there any debugging I can enable?

Last edited by LittleSandra (2023-04-04 11:34:04)

Offline

#5 2023-04-04 11:42:01

LittleSandra
Member
Registered: 2021-01-25
Posts: 81

Re: [Solved] How to start flameshot under Sway / Wayland?

If I try that I get

[a@t470s ~]$ ↳ dbus-monitor --session sender=org.freedesktop.portal.Desktop destination=org.freedesktop.portal.Desktop
bash: ↳: command not found
[a@t470s ~]$ dbus-monitor --session sender=org.freedesktop.portal.Desktop destination=org.freedesktop.portal.Desktop
signal time=1680608459.857518 sender=org.freedesktop.DBus -> destination=:1.55 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.55"
signal time=1680608459.857572 sender=org.freedesktop.DBus -> destination=:1.55 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.55"
method call time=1680608469.304538 sender=:1.58 -> destination=org.freedesktop.portal.Desktop serial=2 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Properties; member=Get
   string "org.freedesktop.portal.Screenshot"
   string "version"
error time=1680608469.304684 sender=:1.15 -> destination=:1.58 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=2
   string "No such interface “org.freedesktop.portal.Screenshot”"

Offline

#6 2023-04-04 12:21:11

LittleSandra
Member
Registered: 2021-01-25
Posts: 81

Re: [Solved] How to start flameshot under Sway / Wayland?

I solved it by downgrading to "xdg-desktop-portal 1.14.6-1".

I also

sudo pacman -S xdg-desktop-portal-gtk

and added

QT_QPA_PLATFORM=wayland
XDG_CURRENT_DESKTOP=sway

to "/etc/environment", but that might not be needed.

Offline

#7 2023-04-05 20:15:59

stanczew
Member
Registered: 2021-03-02
Posts: 93

Re: [Solved] How to start flameshot under Sway / Wayland?

LittleSandra wrote:

I solved it by downgrading to "xdg-desktop-portal 1.14.6-1".

That version is over 8 months old; how did you figure out this was needed? Is the rest of your system up to date? Are you sure this solved the issue, and not the other actions you took?

Offline

#8 2023-04-05 20:54:22

BluishHumility
Member
Registered: 2023-03-31
Posts: 26

Re: [Solved] How to start flameshot under Sway / Wayland?

I can confirm downgrading xdg-desktop-portal to 1.14.6-1 is a known fix for this issue, despite 1.14.6-1 being a bit long in the tooth. It was anticipated that 1.16.0 would resolve this issue, but the consensus is it did not. The relevant discussion is here: https://github.com/flameshot-org/flameshot/issues/2872

LittleSandra wrote:

and added

QT_QPA_PLATFORM=wayland
XDG_CURRENT_DESKTOP=sway

to "/etc/environment", but that might not be needed.

These variables are needed, but you can avoid explicitly setting them in /etc/environment by setting up a wrapper script to launch Sway, such as described in the greetd wiki: https://man.sr.ht/~kennylevinsen/greetd … ypewayland

Using greetd is obviously not needed, you can use a wrapper script for launching Sway with any method.

Offline

Board footer

Powered by FluxBB