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

Added river support #3674

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions docs/Sway and wlroots support.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Flameshot currently supports Sway and other wlroots based Wayland compositors th
## Basic steps
The following packages need to be installed: `xdg-desktop-portal xdg-desktop-portal-wlr grim`. Please ensure your distro packages these, or install them manually.

Ensure that environment variables are set properly. If your distro does not set them automatically, use a launch script to export `XDG_CURRENT_DESKTOP=sway` **before** Sway is launched.
Ensure that environment variables are set properly. If your distro does not set them automatically, use a launch script to export `XDG_CURRENT_DESKTOP=sway` or `XDG_CURRENT_DESKTOP=river` **before** Sway or River is launched.
```sh
#!/bin/bash
export SDL_VIDEODRIVER=wayland
Expand All @@ -15,7 +15,20 @@ export XDG_SESSION_DESKTOP=sway
exec sway
```

You will also need to ensure that systemd/dbus is aware of these environment variables; this should be done **in your sway config** so that the DISPLAY and WAYLAND_DISPLAY variables are defined.
or


```sh
#!/bin/bash
export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
export QT_QPA_PLATFORM=wayland
export XDG_CURRENT_DESKTOP=river
export XDG_SESSION_DESKTOP=river
exec river
```

You will also need to ensure that systemd/dbus is aware of these environment variables; this should be done **in your sway or river config** so that the DISPLAY and WAYLAND_DISPLAY variables are defined.

(taken from [Sway wiki](https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start)):
```sh
Expand All @@ -29,6 +42,13 @@ To ensure that Flameshot is correctly positioned on multiple outputs (monitors)
for_window [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0
```

and add the following on your River config:

```
riverctl rule-add -app-id "flameshot" float
```

Otherwise, flameshot will not take all of the screen and tiles its window instead like a normal application. Note however, that some clipboard stuff is broken so it might be good to save your screenshot as a file while having it copied to a clipboard in case if clipboard does some weird stuff like not pasting the overall screenshot.


Starting from 0.17.0 xdg-desktop-portal requires a configuration file (e.g. in ~/.config/xdg-desktop-portal/sway-portals.conf):
Expand All @@ -54,21 +74,6 @@ Q) Flameshot takes one screenshot, then won't take anymore!

A) There is a bug in xdg-desktop-portal-wlr and Flameshot causing calls with the same token to fail. If you see a sdbus vtable error in the xdpw logs, either used the [patched version](https://github.com/nullobsi/xdg-desktop-portal-wlr/tree/improve-screenshot) or update Flameshot to the latest master.

# River wlroots support

Like mentioned above, flameshot now works on wlroots based Wayland compositors, however, there is a weird problem with river and that is when setting `XDG_CURRENT_DESKTOP=river`, flameshot won't work. The fix is you need to trick flameshot that you are on `sway`. Hence, you need to run river like so:

```sh
XDG_CURRENT_DESKTOP=sway dbus-run-session river
```

and add the following on your config such as in `$HOME/.config/river/init`

```
riverctl float-filter-add "flameshot"
```

Otherwise, flameshot will not take all of the screen and tiles its window instead like a normal application. Note however, that some clipboard stuff is broken so it might be good to save your screenshot as a file while having it copied to a clipboard in case if clipboard does some weird stuff like not pasting the overall screenshot.

#### For more information, please refer to https://github.com/emersion/xdg-desktop-portal-wlr/wiki/%22It-doesn't-work%22-Troubleshooting-Checklist

4 changes: 2 additions & 2 deletions src/utils/desktopinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ DesktopInfo::WM DesktopInfo::windowManager()
if (desktop.contains(QLatin1String("qtile"), Qt::CaseInsensitive)) {
return DesktopInfo::QTILE;
}
if (desktop.contains(QLatin1String("sway"), Qt::CaseInsensitive)) {
return DesktopInfo::SWAY;
if (desktop.contains(QLatin1String("sway"), Qt::CaseInsensitive) || desktop.contains(QLatin1String("river"), Qt::CaseInsensitive)) {
return DesktopInfo::WLROOTS;
}
if (desktop.contains(QLatin1String("Hyprland"), Qt::CaseInsensitive)) {
return DesktopInfo::HYPRLAND;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/desktopinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DesktopInfo
KDE,
OTHER,
QTILE,
SWAY,
WLROOTS,
HYPRLAND
};

Expand Down
2 changes: 1 addition & 1 deletion src/utils/screengrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)
freeDesktopPortal(ok, res);
break;
case DesktopInfo::QTILE:
case DesktopInfo::SWAY:
case DesktopInfo::WLROOTS:
case DesktopInfo::HYPRLAND:
case DesktopInfo::OTHER: {
#ifndef USE_WAYLAND_GRIM
Expand Down