Skip to content

Commit a570fde

Browse files
midischwarz12cvoges12
andauthored
Added river support (#3674)
* Added river support This attempts to generalize wlroots compositors by checking against the proper desktop name instead of only sway. This fixes the problem of only supporting sway. Any additional desktop will just have to be added to the source to check for the correct string. * fix: riverwm floating docs * docs: removed no longer relevant comment * fix: clang-format length * refactor(desktopinfo): clang-format -i --------- Co-authored-by: cvoges12 <[email protected]> Co-authored-by: cvoges12 <[email protected]> Co-authored-by: midirhee12 <[email protected]>
1 parent 899c55e commit a570fde

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

docs/Sway and wlroots support.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Flameshot currently supports Sway and other wlroots based Wayland compositors th
44
## Basic steps
55
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.
66

7-
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.
7+
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.
88
```sh
99
#!/bin/bash
1010
export SDL_VIDEODRIVER=wayland
@@ -15,7 +15,20 @@ export XDG_SESSION_DESKTOP=sway
1515
exec sway
1616
```
1717

18-
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.
18+
or
19+
20+
21+
```sh
22+
#!/bin/bash
23+
export SDL_VIDEODRIVER=wayland
24+
export _JAVA_AWT_WM_NONREPARENTING=1
25+
export QT_QPA_PLATFORM=wayland
26+
export XDG_CURRENT_DESKTOP=river
27+
export XDG_SESSION_DESKTOP=river
28+
exec river
29+
```
30+
31+
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.
1932

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

45+
and add the following on your River config:
46+
47+
```
48+
riverctl rule-add -app-id "flameshot" float
49+
```
50+
51+
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.
3252

3353

3454
Starting from 0.17.0 xdg-desktop-portal requires a configuration file (e.g. in ~/.config/xdg-desktop-portal/sway-portals.conf):
@@ -68,7 +88,7 @@ and add the following on your config such as in `$HOME/.config/river/init`
6888
riverctl float-filter-add "flameshot"
6989
```
7090

71-
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.
91+
Otherwise, Flameshot will not take all of the screen and tiles its window instead like a normal application.
7292

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

src/utils/desktopinfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ DesktopInfo::WM DesktopInfo::windowManager()
3434
if (desktop.contains(QLatin1String("qtile"), Qt::CaseInsensitive)) {
3535
return DesktopInfo::QTILE;
3636
}
37-
if (desktop.contains(QLatin1String("sway"), Qt::CaseInsensitive)) {
38-
return DesktopInfo::SWAY;
37+
if (desktop.contains(QLatin1String("sway"), Qt::CaseInsensitive) ||
38+
desktop.contains(QLatin1String("river"), Qt::CaseInsensitive)) {
39+
return DesktopInfo::WLROOTS;
3940
}
4041
if (desktop.contains(QLatin1String("Hyprland"), Qt::CaseInsensitive)) {
4142
return DesktopInfo::HYPRLAND;

src/utils/desktopinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class DesktopInfo
1717
COSMIC,
1818
OTHER,
1919
QTILE,
20-
SWAY,
20+
WLROOTS,
2121
HYPRLAND
2222
};
2323

src/utils/screengrabber.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)
161161
freeDesktopPortal(ok, res);
162162
break;
163163
case DesktopInfo::QTILE:
164-
case DesktopInfo::SWAY:
164+
case DesktopInfo::WLROOTS:
165165
case DesktopInfo::HYPRLAND:
166166
case DesktopInfo::OTHER: {
167167
if (!ConfigHandler().useGrimAdapter()) {

0 commit comments

Comments
 (0)