flameshot icon indicating copy to clipboard operation
flameshot copied to clipboard

Hyprland support?

Open quantenzitrone opened this issue 2 years ago • 153 comments

Flameshot Version

Flameshot v12.1.0 (-) Compiled with Qt 5.15.7

Installation Type

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

Operating System type and version

NixOS 22.11pre425156.872fceeed60 (Raccoon)

Description

Flameshot doesn't work on Hyprland (a wayland compositor). With $XDG_CURRENT_DESKTOP set to the default "Hyprland", flameshot says:

~ $ echo $XDG_CURRENT_DESKTOP
Hyprland
~ $ flameshot &
[1] 127966
kf.windowsystem: Could not find any platform plugin
~ $ flameshot full
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: info: Screenshot aborted.
~ $

However, when I set the environment variable $XDG_CURRENT_DESKTOP to Sway flameshot just doesn't do anything.

~ $ XDG_CURRENT_DESKTOP=Sway
~ $ echo $XDG_CURRENT_DESKTOP
Sway
~ $ flameshot &
[1] 128100
kf.windowsystem: Could not find any platform plugin
~ $ time flameshot full
^C

real	0m16.907s
user	0m0.145s
sys	0m0.074s
~ $

Steps to reproduce

  1. install hyprland
  2. run flameshot gui

Screenshots or screen recordings

No response

System Information

~ $ inxi --width 80 --system --graphics
System:
  Host: nix Kernel: 6.0.7-zen1 x86_64 bits: 64 Desktop: N/A
  Distro: NixOS 22.11 (Raccoon)
Graphics:
  Message: No device data found.
  Device-1: DGEMU019I992XE HP Wide Vision HD Camera type: USB driver: uvcvideo
  Display: wayland server: X.Org 1.22.1.3 driver: loaded: N/A
  resolution: 1920x1080~60Hz
  OpenGL: renderer: Mesa Intel HD Graphics 630 (KBL GT2) v: 4.6 Mesa 22.2.2
~ $ wlr-randr                                                                                          ✘ 1
eDP-1 "Chimei Innolux Corporation 0x15D3 (eDP-1)"
  Physical size: 340x190 mm
  Enabled: yes
  Modes:
    1920x1080 px, 40.004002 Hz
    1920x1080 px, 60.007999 Hz (preferred, current)
  Position: 0,0
  Transform: normal
  Scale: 1.000000
~ $ lspci | grep -i 'vga\|3d\|2d'
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
~ $ lshw -class display
WARNING: you should run this program as super-user.
  *-display
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:141 memory:b3000000-b3ffffff memory:a0000000-afffffff memory:b0000000-b1ffffff ioport:4000(size=128) memory:b4080000-b40fffff
  *-display
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 04
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:139 memory:b2000000-b2ffffff memory:c0000000-cfffffff ioport:5000(size=64) memory:c0000-dffff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
~ $ uname -a
Linux nix 6.0.7-zen1 #1-NixOS ZEN SMP PREEMPT_DYNAMIC Tue Jan 1 00:00:00 UTC 1980 x86_64 GNU/Linux

quantenzitrone avatar Nov 12 '22 16:11 quantenzitrone

I am experiencing this aswell

Mango0x45 avatar Nov 13 '22 03:11 Mango0x45

Well, Hyprland looks like a promising WM to replace dwm, so I personally am interested in supporting it. But as far as I can tell it should work if you set it to sway. This is the part that generates the error you observed:

https://github.com/flameshot-org/flameshot/blob/d17eb53816bc572e161714b67de52daf1af23e86/src/utils/screengrabber.cpp#L99-L124

which calls:

https://github.com/flameshot-org/flameshot/blob/d17eb53816bc572e161714b67de52daf1af23e86/src/utils/desktopinfo.cpp#L26-L54

I don't see why it should not work. This needs further investigation.

mmahmoudian avatar Nov 13 '22 21:11 mmahmoudian

@mmahmoudian thanks for the response. I tried running flameshot in one terminal and env XDG_CURRENT_DESKTOP=Sway flameshot gui in another as you mentioned in https://github.com/flameshot-org/flameshot/issues/2351#issuecomment-1038025969. But there is no output messages from either commands at all.

I'm running the latest flameshot (built from the master branch) on Arch Linux's mainline kernel (6.0.8) with Hyprland. Please let me know if there's anything I can help with for the issue.

kyechou avatar Nov 13 '22 22:11 kyechou

@mmahmoudian , it looks like gotSignal is never triggered. The execution gets stuck at this line: https://github.com/flameshot-org/flameshot/blob/d17eb53816bc572e161714b67de52daf1af23e86/src/utils/screengrabber.cpp#L75

kyechou avatar Nov 13 '22 22:11 kyechou

It seems these issues might be related to this one: https://github.com/flameshot-org/flameshot/issues/2872 https://github.com/flatpak/xdg-desktop-portal/issues/861

However the problem exists with xdg-desktop-portal 1.15.0 and the latest commit of xdg-desktop-portal-wlr-git v0.6.0.r3.gc83b3cc-1.

env XDG_CURRENT_DESKTOP=sway XDG_SESSION_DESKTOP=sway QT_QPA_PLATFORM=wayland flameshot gui
dbus-monitor output
$ dbus-monitor --session sender=org.freedesktop.portal.Desktop destination=org.freedesktop.portal.Desktop
signal time=1668827818.577499 sender=org.freedesktop.DBus -> destination=:1.172 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.172"
signal time=1668827818.577593 sender=org.freedesktop.DBus -> destination=:1.172 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.172"
method call time=1668827823.267767 sender=:1.155 -> destination=:1.174 serial=45 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Properties; member=GetAll
   string "org.freedesktop.impl.portal.ScreenCast"
method return time=1668827823.267976 sender=:1.174 -> destination=:1.155 serial=4 reply_serial=45
   array [
      dict entry(
         string "AvailableSourceTypes"
         variant             uint32 1
      )
      dict entry(
         string "AvailableCursorModes"
         variant             uint32 3
      )
      dict entry(
         string "version"
         variant             uint32 2
      )
   ]
signal time=1668827823.268794 sender=org.freedesktop.DBus -> destination=:1.155 serial=87 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string "org.freedesktop.portal.Desktop"
method return time=1668827823.268884 sender=org.freedesktop.DBus -> destination=:1.173 serial=41 reply_serial=42
   uint32 1
method call time=1668827823.269085 sender=:1.161 -> destination=:1.173 serial=115 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Properties; member=GetAll
   string "org.freedesktop.portal.Inhibit"
error time=1668827823.269303 sender=:1.173 -> destination=:1.161 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=115
   string "No such interface “org.freedesktop.portal.Inhibit”"
method call time=1668827830.926087 sender=:1.175 -> 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=1668827830.926287 sender=:1.173 -> destination=:1.175 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=2
   string "No such interface “org.freedesktop.portal.Screenshot”"
method call time=1668827830.962327 sender=:1.175 -> destination=org.freedesktop.portal.Desktop serial=9 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method return time=1668827830.962652 sender=:1.173 -> destination=:1.175 serial=45 reply_serial=9
   string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
                      "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!-- GDBus 2.74.1 -->
<node>
  <interface name="org.freedesktop.DBus.Properties">
    <method name="Get">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="s" name="property_name" direction="in"/>
      <arg type="v" name="value" direction="out"/>
    </method>
    <method name="GetAll">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="a{sv}" name="properties" direction="out"/>
    </method>
    <method name="Set">
      <arg type="s" name="interface_name" direction="in"/>
      <arg type="s" name="property_name" direction="in"/>
      <arg type="v" name="value" direction="in"/>
    </method>
    <signal name="PropertiesChanged">
      <arg type="s" name="interface_name"/>
      <arg type="a{sv}" name="changed_properties"/>
      <arg type="as" name="invalidated_properties"/>
    </signal>
  </interface>
  <interface name="org.freedesktop.DBus.Introspectable">
    <method name="Introspect">
      <arg type="s" name="xml_data" direction="out"/>
    </method>
  </interface>
  <interface name="org.freedesktop.DBus.Peer">
    <method name="Ping"/>
    <method name="GetMachineId">
      <arg type="s" name="machine_uuid" direction="out"/>
    </method>
  </interface>
  <interface name="org.freedesktop.portal.Trash">
    <method name="TrashFile">
      <arg type="h" name="fd" direction="in"/>
      <arg type="u" name="result" direction="out"/>
    </method>
    <property type="u" name="version" access="read"/>
  </interface>
  <interface name="org.freedesktop.portal.MemoryMonitor">
    <signal name="LowMemoryWarning">
      <arg type="y" name="level"/>
    </signal>
    <property type="u" name="version" access="read"/>
  </interface>
  <interface name="org.freedesktop.portal.GameMode">
    <method name="QueryStatus">
      <arg type="i" name="pid" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <method name="RegisterGame">
      <arg type="i" name="pid" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <method name="UnregisterGame">
      <arg type="i" name="pid" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <method name="QueryStatusByPid">
      <arg type="i" name="target" direction="in"/>
      <arg type="i" name="requester" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <method name="RegisterGameByPid">
      <arg type="i" name="target" direction="in"/>
      <arg type="i" name="requester" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <method name="UnregisterGameByPid">
      <arg type="i" name="target" direction="in"/>
      <arg type="i" name="requester" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <method name="QueryStatusByPIDFd">
      <arg type="h" name="target" direction="in"/>
      <arg type="h" name="requester" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <method name="RegisterGameByPIDFd">
      <arg type="h" name="target" direction="in"/>
      <arg type="h" name="requester" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <method name="UnregisterGameByPIDFd">
      <arg type="h" name="target" direction="in"/>
      <arg type="h" name="requester" direction="in"/>
      <arg type="i" name="result" direction="out"/>
    </method>
    <property type="b" name="Active" access="read"/>
    <property type="u" name="version" access="read"/>
  </interface>
  <interface name="org.freedesktop.portal.ProxyResolver">
    <method name="Lookup">
      <arg type="s" name="uri" direction="in"/>
      <arg type="as" name="proxies" direction="out"/>
    </method>
    <property type="u" name="version" access="read"/>
  </interface>
  <interface name="org.freedesktop.portal.NetworkMonitor">
    <method name="GetAvailable">
      <arg type="b" name="available" direction="out"/>
    </method>
    <method name="GetMetered">
      <arg type="b" name="metered" direction="out"/>
    </method>
    <method name="GetConnectivity">
      <arg type="u" name="connectivity" direction="out"/>
    </method>
    <method name="GetStatus">
      <arg type="a{sv}" name="status" direction="out"/>
    </method>
    <method name="CanReach">
      <arg type="s" name="hostname" direction="in"/>
      <arg type="u" name="port" direction="in"/>
      <arg type="b" name="reachable" direction="out"/>
    </method>
    <signal name="changed"/>
    <property type="u" name="version" access="read"/>
  </interface>
  <interface name="org.freedesktop.portal.Secret">
    <method name="RetrieveSecret">
      <arg type="h" name="fd" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <arg type="o" name="handle" direction="out"/>
    </method>
    <property type="u" name="version" access="read"/>
  </interface>
  <interface name="org.freedesktop.portal.ScreenCast">
    <method name="CreateSession">
      <arg type="a{sv}" name="options" direction="in"/>
      <arg type="o" name="handle" direction="out"/>
    </method>
    <method name="SelectSources">
      <arg type="o" name="session_handle" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <arg type="o" name="handle" direction="out"/>
    </method>
    <method name="Start">
      <arg type="o" name="session_handle" direction="in"/>
      <arg type="s" name="parent_window" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <arg type="o" name="handle" direction="out"/>
    </method>
    <method name="OpenPipeWireRemote">
      <arg type="o" name="session_handle" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <arg type="h" name="fd" direction="out"/>
    </method>
    <property type="u" name="AvailableSourceTypes" access="read"/>
    <property type="u" name="AvailableCursorModes" access="read"/>
    <property type="u" name="version" access="read"/>
  </interface>
  <interface name="org.freedesktop.portal.PowerProfileMonitor">
    <property type="b" name="power-saver-enabled" access="read"/>
    <property type="u" name="version" access="read"/>
  </interface>
  <interface name="org.freedesktop.portal.Realtime">
    <method name="MakeThreadRealtimeWithPID">
      <arg type="t" name="process" direction="in"/>
      <arg type="t" name="thread" direction="in"/>
      <arg type="u" name="priority" direction="in"/>
    </method>
    <method name="MakeThreadHighPriorityWithPID">
      <arg type="t" name="process" direction="in"/>
      <arg type="t" name="thread" direction="in"/>
      <arg type="i" name="priority" direction="in"/>
    </method>
    <property type="i" name="MaxRealtimePriority" access="read"/>
    <property type="i" name="MinNiceLevel" access="read"/>
    <property type="x" name="RTTimeUSecMax" access="read"/>
    <property type="u" name="version" access="read"/>
  </interface>
</node>
"
method call time=1668827830.963884 sender=:1.175 -> destination=org.freedesktop.portal.Desktop serial=16 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Screenshot; member=Screenshot
   string ""
   array [
      dict entry(
         string "handle_token"
         variant             string "33d4f6f1d52e4bd697fb7e9cfe8820ad"
      )
      dict entry(
         string "interactive"
         variant             boolean false
      )
   ]
error time=1668827830.964084 sender=:1.173 -> destination=:1.175 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=16
   string "No such interface “org.freedesktop.portal.Screenshot” on object at path /org/freedesktop/portal/desktop"
method call time=1668827851.236965 sender=:1.177 -> destination=:1.173 serial=19 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Properties; member=GetAll
   string "org.freedesktop.portal.Settings"
error time=1668827851.237123 sender=:1.173 -> destination=:1.177 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=19
   string "No such interface “org.freedesktop.portal.Settings”"
method call time=1668827851.237281 sender=:1.177 -> destination=:1.173 serial=20 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Settings; member=Read
   string "org.freedesktop.appearance"
   string "color-scheme"
error time=1668827851.237366 sender=:1.173 -> destination=:1.177 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=20
   string "No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop"
method call time=1668827851.691958 sender=:1.177 -> destination=:1.173 serial=31 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Settings; member=Read
   string "org.freedesktop.appearance"
   string "color-scheme"
error time=1668827851.692161 sender=:1.173 -> destination=:1.177 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=31
   string "No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop"
xdg-desktop-portal output
$ /usr/lib/xdg-desktop-portal --replace --verbose
XDP: load portals from /usr/share/xdg-desktop-portal/portals
XDP: loading /usr/share/xdg-desktop-portal/portals/gnome-keyring.portal
XDP: portal implementation for gnome
XDP: portal implementation supports org.freedesktop.impl.portal.Secret
XDP: loading /usr/share/xdg-desktop-portal/portals/wlr.portal
XDP: portal implementation for wlroots, sway, Wayfire, river, phosh, Hyprland
XDP: portal implementation supports org.freedesktop.impl.portal.Screenshot
XDP: portal implementation supports org.freedesktop.impl.portal.ScreenCast
XDP: providing portal org.freedesktop.portal.MemoryMonitor
XDP: providing portal org.freedesktop.portal.PowerProfileMonitor
XDP: providing portal org.freedesktop.portal.NetworkMonitor
XDP: providing portal org.freedesktop.portal.ProxyResolver
XDP: providing portal org.freedesktop.portal.Trash
XDP: providing portal org.freedesktop.portal.GameMode
XDP: providing portal org.freedesktop.portal.Realtime

** (/usr/lib/xdg-desktop-portal:40676): WARNING **: 21:17:03.227: No skeleton to export
XDP: Using wlr.portal for org.freedesktop.impl.portal.Screenshot in Hyprland
XDP: Falling back to gnome-keyring.portal for org.freedesktop.impl.portal.Secret
XDP: providing portal org.freedesktop.portal.Secret
XDP: Using wlr.portal for org.freedesktop.impl.portal.ScreenCast in Hyprland
XDP: providing portal org.freedesktop.portal.ScreenCast
XDP: org.freedesktop.portal.Desktop acquired

Edit: Make a clean, reinstalled setup and update the command output.

kyechou avatar Nov 13 '22 23:11 kyechou

According to https://github.com/flameshot-org/flameshot/issues/2872, I tested flameshot with the downgraded xdg-desktop-portal 1.14.6, and it works flawlessly on both Hyprland and Sway. With the updated xdg-desktop-portal and xdg-desktop-portal-wlr, the behavior is as described in https://github.com/flameshot-org/flameshot/issues/2959.

~I'm not sure if this is an upstream issue, and I'm also not familiar with the code enough to know what to report upstream.~

Either way, I think this issue is very likely to be the same as https://github.com/flameshot-org/flameshot/issues/2959, except that it requires the environment variables env XDG_CURRENT_DESKTOP=sway XDG_SESSION_DESKTOP=sway QT_QPA_PLATFORM=wayland to run on Hyprland. But that should be relatively easier to fix by adding a few conditionals as indicated by @mmahmoudian https://github.com/flameshot-org/flameshot/issues/2978#issuecomment-1312831336.

Edit: Attach the working screenshot with the downgraded xdg-desktop-portal 1.14.6 Edit 2: Reported here https://github.com/emersion/xdg-desktop-portal-wlr/issues/246

Screenshot

2022-11-18_21-08

kyechou avatar Nov 19 '22 03:11 kyechou

As mentioned in #2872, I tested flameshot with the downgraded xdg-desktop-portal 1.14.6, and it works flawlessly on both Hyprland and Sway. With the updated xdg-desktop-portal and xdg-desktop-portal-wlr, the behavior is as described in #2959.

This is not related to Hyprland itself, but I have the same results with newm: with xdg-desktop-portal 1.14.6, Flameshot also works great (except it doesn’t go fullscreen on its own, but I think that’s specific to newm). But with 1.15.0, it doesn’t work anymore with seemingly the same issues.

Phundrak avatar Nov 23 '22 15:11 Phundrak

It doesn't work with xdg-desktop-portal 1.14.6 for me either.

~ $ systemctl --user status xdg-desktop-portal                                                                                                                                                                      ✘ 130
● xdg-desktop-portal.service - Portal service
     Loaded: loaded (/etc/systemd/user/xdg-desktop-portal.service; static)
     Active: active (running) since Thu 2022-11-24 07:16:40 CET; 48s ago
   Main PID: 2523 (.xdg-desktop-po)
      Tasks: 6 (limit: 19048)
     Memory: 3.2M
        CPU: 46ms
     CGroup: /user.slice/user-1000.slice/[email protected]/session.slice/xdg-desktop-portal.service
             └─2523 /nix/store/28j9l7j502rd8qgdbxc8bmgsrzqvhrd2-xdg-desktop-portal-1.14.6/libexec/xdg-desktop-portal

Nov 24 07:16:40 nix systemd[1426]: Starting Portal service...
Nov 24 07:16:40 nix systemd[1426]: Started Portal service.
~ $ export XDG_CURRENT_DESKTOP=sway
~ $ echo $XDG_CURRENT_DESKTOP
sway
~ $ time flameshot gui                                                                                                                                                                                              ✘ 130
kf.windowsystem: Could not find any platform plugin
^C
________________________________________________________
Executed in   29.34 secs      fish           external
   usr time  137.58 millis    0.00 millis  137.58 millis
   sys time   72.05 millis    1.75 millis   70.30 millis

see flameshot still doesn't do anything is anyone else here on NixOS?

quantenzitrone avatar Nov 24 '22 06:11 quantenzitrone

Hi @Quantenzitrone, I'm not entirely sure but you might also want to set XDG_CURRENT_DESKTOP to sway for the xdg-desktop-portal service.

The official home-manager module provided by hyprland imports the environments in the very first line of hyprland's config file, and XDG_CURRENT_DESKTOP is hard-coded to Hyprland in hyprland's code.

I ended up with patching Hyprland to set XDG_CURRENT_DESKTOP to sway, in paticular this line https://github.com/hyprwm/Hyprland/blob/f6067816fb2bbd7dc9a00da6391cc6dcf5991035/src/Compositor.cpp#L342

blurgyy avatar Nov 24 '22 08:11 blurgyy

Installing xdg-desktop-portal-git, xdg-desktop-portal-wlr-git and xdg-desktop-portal-gtk-git from AUR, and using XDG_CURRENT_DESKTOP=sway seems to fix the issue for me.

adamant-pwn avatar Nov 28 '22 03:11 adamant-pwn

@adamant-pwn which versions?

mmahmoudian avatar Nov 28 '22 06:11 mmahmoudian

Like @adamant-pwn I have all the packages installed. But when our XDG_CURRENT_DESKTOP=Hyprland is on we will not have a screenshot from flameshot When we change it (export ... sway) then it works again so my suggestion would be

whatever you do to make it work in sway do exactly the same thing if you find out that you are on Hyprland my two cents

flameshot-git on ArchLinux/ArcoLinux version r1858.b4300d30-1

erikdubois avatar Dec 04 '22 15:12 erikdubois

@erikdubois Thanks for your comment 🍻 . As I briefly touched upon before, adding hyprland (which I'm also getting into as well and loving it) is relatively easy, but the part about "downgrading xdg-desktop-portal to 1.14.6" as reported by users [1, 2] is the tricky part.

Can confirm that your observation about setting the environmental variable (XDG_CURRENT_DESKTOP=sway) has worked with the latest xdg-desktop-portal (version 1.15.0-1 at the time of writing this)?

mmahmoudian avatar Dec 05 '22 09:12 mmahmoudian

That is exactly the version I use now.

It feels like this could be an easy win.

Do the same as on Sway but start with a different XDG_CURRENT_DESKTOP

erikdubois avatar Dec 05 '22 16:12 erikdubois

are there any fixes for this at present (packages to install, ect.) or is this still under-progress?

Hex5DA avatar Dec 17 '22 21:12 Hex5DA

Hi @onlyTr3v0r, Apart from adding the additional conditional for Hyprland in flameshot (https://github.com/flameshot-org/flameshot/issues/2978#issuecomment-1312831336), the core issue with xdg-desktop-portal-wlr was reported upstream (https://github.com/emersion/xdg-desktop-portal-wlr/issues/246), and I believe both are still under progress.

kyechou avatar Dec 17 '22 22:12 kyechou

We already have a PR that addresses the Flameshot related part. That PR is under review and will be merged soon.

I would like to also encourage you all to read the open PRs and help us reviewing them. It would help us tremendously. Even if you don't know C++, finding a typo would be a great help.

mmahmoudian avatar Dec 18 '22 09:12 mmahmoudian

We already have a PR that address the Flameshot related part. That PR is under review and will be merged soon.

Add a link to the PR: https://github.com/flameshot-org/flameshot/pull/3018

kyechou avatar Dec 18 '22 20:12 kyechou

hyprland released own fork of xdg-desktop-portal-wlr. This fork supports window capture https://github.com/hyprwm/xdg-desktop-portal-hyprland

ghost avatar Dec 28 '22 13:12 ghost

Unfortunately, it also didn't work for me, though I install xdg-desktop-portal-hyprland-git.

hyprland released own fork of xdg-desktop-portal-wlr. This fork supports window capture https://github.com/hyprwm/xdg-desktop-portal-hyprland

NamelessDev0000 avatar Dec 30 '22 15:12 NamelessDev0000

We have a working flameshot-tray that lets us take pictures on Hyprland. We let Flameshot believe it is on Sway.

I can only repeat what I have said earlier last month. https://github.com/flameshot-org/flameshot/issues/2978#issuecomment-1337645101

Here you see how we made it work on ArcoLinux. https://youtu.be/skHFa0rPZFk

if [ -f /usr/share/applications/org.flameshot.Flameshot.desktop ]; then FIND="Exec=/usr/bin/flameshot" REPLACE="Exec=env XDG_CURRENT_DESKTOP=sway /usr/bin/flameshot" sudo sed -i "s/$FIND/$REPLACE/g" /usr/share/applications/org.flameshot.Flameshot.desktop fi

erikdubois avatar Jan 06 '23 15:01 erikdubois

What's the status on this? I know it works if I force it to think I'm on Sway, but that seems unnecessary. EDIT: To be specific, it works the first time, then I have to log out and log back in, then it works again.

DexterHaxxor avatar Feb 13 '23 12:02 DexterHaxxor

@DexterHaxxor The status is that someone need to invest a bit of time to do this. I personally haven't found some time to implement and test. The solution @erikdubois provided is a quick nice hack for now, but we need to either add hyprland explecitly, or find a way to bundle multiple Wayland WMs with some sort of auto-discovery or default fallback. This should be explored

mmahmoudian avatar Feb 14 '23 12:02 mmahmoudian

The #3018 have added support for hyprland and grim. This of course needs to be tested. There is a chance that you need to use -DUSE_WAYLAND_GRIM=true for cmake and build it again. We are in the process of discussion about how to add this to AUR, but any suggestions/input/feedback is welcome.

mmahmoudian avatar Feb 20 '23 10:02 mmahmoudian

@mmahmoudian I have tried it and had problems. I am on Gentoo / Hyprland / 6.2 Kernel so I had all dependencies. I just removed Flameshot that is from the package manager.

Steps: 1- Git clone the repository. 2- mkdir build cd build cmake -DUSE_WAYLAND_GRIM=true ../ make 3- $ flameshot gui

Problems: 1- After trying "flameshot gui", the screen zooms and the resolution drops. 2- It's lagging too much. The selection is extremely slow. I select somewhere on my screen and it's getting selected in 15 seconds.

emrakyz avatar Feb 20 '23 22:02 emrakyz

Problems: 1- After trying "flameshot gui", the screen zooms and the resolution drops. 2- It's lagging too much. The selection is extremely slow. I select somewhere on my screen and it's getting selected in 15 seconds.

Can confirm. Not entirely sure about the first issue you mentioned (might just be misunderstanding it), but I am definitely getting the lag. The interesting thing is, this behavior seems to be the same for me with and without the flag USE_WAYLAND_GRIM=true, The lag happened without, and gave the warning to recompile, and then happened seemingly the same with, and gave me the warning about grim's screenshot component being implemented based on wlroots etc etc, as per screengrabber.cpp. Here's a video, in case it helps.

Bvngee avatar Feb 23 '23 00:02 Bvngee

@BvngeeCord Hi! The first issue might have been because of the scaling. I can't screenshot the whole screen with flameshot. After prompt, I can only see and select a part of my screen and that doesn't look clear; it's blurry. The second problem is the same you have in the video but the difference is that I couldn't get it to work without USE_WAYLAND_GRIM=true.

Hyplrland config: monitor=DP-1,2560x1440@165,auto,2

emrakyz avatar Feb 23 '23 01:02 emrakyz

Ah, the zooming is definitely a scaling issue then, as I'm not doing any. My config is monitor=DP-1,2560x1440@75,2560x0,1 monitor=DP-2,2560x1440@75,0x0,1, but it occurred when I switched to a value other than 1. Flameshot also seems to like defaulting to DP-1, although that could be completely unrelated?

Bvngee avatar Feb 23 '23 07:02 Bvngee

The #3018 have added support for hyprland and grim. This of course needs to be tested. There is a chance that you need to use -DUSE_WAYLAND_GRIM=true for cmake and build it again. We are in the process of discussion about how to add this to AUR, but any suggestions/input/feedback is welcome.

taking a look at https://aur.archlinux.org/flameshot-git.git could be helpful..

ardishko avatar Feb 28 '23 19:02 ardishko

Wait, that's your package...Okay...

ardishko avatar Feb 28 '23 19:02 ardishko