flameshot-org / flameshot

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

Can't use flameshot in sway. #3284

Closed shengliawa closed 1 year ago

shengliawa commented 1 year ago

Flameshot Version

Flameshot v12.1.0 (-) Compiled with Qt 5.15.5

Installation Type

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

Operating System type and version

Arch Linux x86_64 Use default repo

Description

It just hang with no report, when the task end it give lots of same errors on the notification daemon . 20230730_07h11m26s_grim

Steps to reproduce

  1. Follow the Arch Linux Installition Guide to install a base system with NetworkManager, GNU nano , sudo .
  2. Install the sway, mako and kanshi .
  3. Install xdg-desktop-portal,xdg-desktop-portal-wlr , grim, and flameshot.
  4. Install dmenu to run flameshot.
  5. make script like this
    #!/bin/bash
    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
  6. Copy and edit sway config file, and add this line at the bottom at the config file
    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

    Change bar to waybar to use the tray icon to quit flameshot. i follow this to install waybar

  7. chmod +x $thescript and run it ,
  8. Use dmenu to run the flameshot
  9. Click the tray icon and it didn't work, it just hang with no report, when the task end it give lots of same errors on the notification daemon .

Screenshots or screen recordings

20230730_07h11m26s_grim 20230730_07h12m03s_grim

System Information

  1. Arch Linux Use default repo
  2. Default monitor configuration, just one screen.
  3. SwayWM with xwayland support.
shengliawa commented 1 year ago

When use the dbus-monitor --session sender=org.freedesktop.portal.Desktop destination=org.freedesktop.portal.Desktop and try taking a screenshot, it outputs this:

[shengliawa@arch ~]$ dbus-monitor --session sender=org.freedesktop.portal.Desktop destination=org.freedesktop.portal.Desktop
signal time=1690676803.229535 sender=org.freedesktop.DBus -> destination=:1.71 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.71"
signal time=1690676803.229594 sender=org.freedesktop.DBus -> destination=:1.71 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.71"
method call time=1690676808.094374 sender=:1.72 -> 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=1690676808.094782 sender=:1.28 -> destination=:1.72 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=2
   string "无此接口“org.freedesktop.portal.Screenshot”"
method call time=1690676812.231505 sender=:1.72 -> destination=org.freedesktop.portal.Desktop serial=19 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method return time=1690676812.232495 sender=:1.28 -> destination=:1.72 serial=112 reply_serial=19
   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.76.4 -->
<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.PowerProfileMonitor">
    <property type="b" name="power-saver-enabled" access="read"/>
    <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.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=1690676812.238699 sender=:1.72 -> destination=org.freedesktop.portal.Desktop serial=26 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Screenshot; member=Screenshot
   string ""
   array [
      dict entry(
         string "handle_token"
         variant             string "df136c9139e341b2bb8a631ea01f8618"
      )
      dict entry(
         string "interactive"
         variant             boolean false
      )
   ]
error time=1690676812.239552 sender=:1.28 -> destination=:1.72 error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=26
   string "在路径 org.freedesktop.portal.Screenshot 的对象上没有“/org/freedesktop/portal/desktop”接口"
shengliawa commented 1 year ago

On sway version 1.8.1

FelixJochems commented 1 year ago

DBUS is wonky as hell for wayland, have you tried compiling it with the USE_WAYLAND_GRIM flag?

mmahmoudian commented 1 year ago

@shengliawa try installing with AUR.it should have all the flags and dependencies.

shengliawa commented 1 year ago

I install the flameshot-git in the AUR.It sometime works , but it was so slow to use, i wait 3 minute to wait the flameshot start,also,selecting the screenshot area is very slow too. Flameshot Version Flameshot v12.1.0 (a447b3d6) Compiled with Qt 5.15.10

shengliawa commented 1 year ago

It output this. it seems like the QT.wayland don't support a feature? flameshot: warning: grim's screenshot component is implemented based on wlroots, it may not be used in GNOME or similar desktop environments QLayout: Attempting to add QLayout "" to SidePanelWidget "", which already has a layout qt.qpa.wayland: Wayland does not support QWindow::requestActivate() qt.qpa.wayland: Wayland does not support QWindow::requestActivate() qt.qpa.wayland: Wayland does not support QWindow::requestActivate() qt.qpa.wayland: Wayland does not support QWindow::requestActivate() qt.qpa.wayland: Wayland does not support QWindow::requestActivate() qt.qpa.wayland: Wayland does not support QWindow::requestActivate() qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

mmahmoudian commented 1 year ago

We have a PR to fix the speed issue