Open quantenzitrone opened 2 years ago
I am experiencing this aswell
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:
which calls:
I don't see why it should not work. This needs further investigation.
@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.
@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
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
Edit: Make a clean, reinstalled setup and update the command output.
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
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.
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/user@1000.service/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?
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
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 which versions?
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 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)?
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
are there any fixes for this at present (packages to install, ect.) or is this still under-progress?
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.
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.
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
hyprland released own fork of xdg-desktop-portal-wlr. This fork supports window capture https://github.com/hyprwm/xdg-desktop-portal-hyprland
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
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
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 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
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 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.
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.
@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
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?
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..
Wait, that's your package...Okay...
REPLACE="Exec=env XDG_CURRENT_DESKTOP=sway /usr/bin/flameshot"
for me, changing XDG_CURRENT_DESKTOP to sway not making flameshot to work on Hyprland
REPLACE="Exec=env XDG_CURRENT_DESKTOP=sway /usr/bin/flameshot"
for me, changing XDG_CURRENT_DESKTOP to sway not making flameshot to work on Hyprland
Me too, it just hangs. However in dbus-monitor I can see the following:
dbus-monitor --session sender=org.freedesktop.portal.Desktop destination=org.freedesktop.portal.Desktop
...[other log messages]...
string "Allow Applications to Take Screenshots?"
string "An application wants to be able to take screenshots at any time."
string "This permission can be changed at any time from the privacy settings."
...[continuation of the message]...
Still not working by passing environment variable, it just hangs...
$ env XDG_CURRENT_DESKTOP=sway flameshot full
Tried debugging through dbus-monitor
too :
$ dbus-monitor --session sender=org.freedesktop.portal.Desktop destination=org.freedesktop.portal.Desktop
...
method call time=1678906922.996473 sender=:1.884 -> 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=1678906922.996574 sender=:1.328 -> destination=:1.884 error_name=org.freedesktop.DBus.Error.InvalidArgs reply_serial=2
string "No such interface “org.freedesktop.portal.Screenshot”"
method call time=1678906923.021918 sender=:1.884 -> destination=org.freedesktop.portal.Desktop serial=9 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.DBus.Introspectable; member=Introspect
method return time=1678906923.022097 sender=:1.328 -> destination=:1.884 serial=73 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">
...
method call time=1678906923.022923 sender=:1.884 -> 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 "813e52894d8745b3a2785bcd85cb8287"
)
dict entry(
string "interactive"
variant boolean false
)
]
error time=1678906923.023028 sender=:1.328 -> destination=:1.884 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"
any updates?
@cynikkk
Still not working by passing environment variable, it just hangs...
You don't need to set environmental variable anymore if you have the latest commits
@vec715 Read this from 25 days ago: https://github.com/flameshot-org/flameshot/issues/2978#issuecomment-1436715162
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 that region selection is extremely slow. Everything (hyprland, xdg-desktop-portal-hyprland, grim, flameshot) is built from source. Flameshot is built with USE_WAYLAND_GRIM=1
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 that region selection is extremely slow. Everything (hyprland, xdg-desktop-portal-hyprland, grim, flameshot) is built from source. Flameshot is built with USE_WAYLAND_GRIM=1
I've had some success by forcing it to run through xwayland with QT_QPA_PLATFORM=xcb flameshot
and somehow it works, but it breaks keyboard shortcuts because it complains about losing focus. Might be able to work around it with hyprland's pass dispatcher, haven't tested it yet.
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 that region selection is extremely slow. Everything (hyprland, xdg-desktop-portal-hyprland, grim, flameshot) is built from source. Flameshot is built with USE_WAYLAND_GRIM=1
I've had some success by forcing it to run through xwayland with
QT_QPA_PLATFORM=xcb flameshot
and somehow it works, but it breaks keyboard shortcuts because it complains about losing focus. Might be able to work around it with hyprland's pass dispatcher, haven't tested it yet.
⋊> ~ flameshot --version
Flameshot v12.1.0 (3ededae5)
Compiled with Qt 5.15.8
Tried compiling it with USE_WAYLAND_GRIM=1, ran with QT_QPA_PLATFORM=xcb flameshot
and got the focus issue too.
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 that region selection is extremely slow. Everything (hyprland, xdg-desktop-portal-hyprland, grim, flameshot) is built from source. Flameshot is built with USE_WAYLAND_GRIM=1
I've had some success by forcing it to run through xwayland with
QT_QPA_PLATFORM=xcb flameshot
and somehow it works, but it breaks keyboard shortcuts because it complains about losing focus. Might be able to work around it with hyprland's pass dispatcher, haven't tested it yet.
I have this issue on Sway and Hyprland, seems this is not a Hyprland issue but rather more so a problem with the program itself. I remember making it work completely fine on Sway before (somehow, miraculously) the program was updated to not require certain env-vars to be set to sway
, so this is an implementation issue.
@mmahmoudian Update after four months. Using Linux 6.2.9 kernel; latest git versions of Hyprland, xdg-desktop-portal-hyprland, wlroots, wayland, wayland-protocols, wayland-scanners, grim and slurp. I also have latest versions of qt5 and qt6. I enabled use-wayland-grim.
@emrakyz I have personally experienced that issue only on KDE Plasma Wayland. I think we have a regression somewhere. This needs to be investigated.
Update: I just tried it on hyprland (latest of everything) and compiled flameshot head with cmake ../ -DUSE_WAYLAND_GRIM=true
and I observed a few millisecond lag, but not much to be disturbing or noticable
hyprland 0.23.0beta-4 community 4,1 MB
xdg-desktop-portal 1.16.0-1 extra 2,1 MB
xdg-desktop-portal-kde 5.27.4.1-1 extra 1,0 MB
xdg-desktop-portal-wlr 0.6.0-1 community 104,1 kB
grim 1.4.0-3 community 37,3 kB
wayland 1.22.0-1 extra 820,0 kB
wayland-protocols 1.31-1 extra 509,4 kB
plasma-wayland-session 5.27.4.1-1 extra 3,5 kB
qt5-wayland 5.15.8+kde+r63-1 extra 6,4 MB
qt6-wayland 6.4.3-1 extra 6,8 MB
bemenu-wayland 0.6.14-1 community 55,4 kB
@mmahmoudian
Hyprland uses own implementation for xdg-desktop-portal called "xdg-desktop-portal-hyprland". It's also recommended to remove other implementations such as -kde and -wlr.
Is it possible that we have that problem because of Nvidia GPU? But I have no problem with Grim+Slurp or video recording.
Plus, the scaling also have issues as you can see in the video. It zooms when I start flameshot.
I definitely feel the lack of Flameshot :)
Hyprland uses own implementation for xdg-desktop-portal called "xdg-desktop-portal-hyprland".
Thanks for the notice. I know that hyprland has their fork of xdg-desktop-portal-wlr , but while testing, I removed it and installed the xdg-desktop-portal-wlr and it didn't change the situation, so I reported the last state. About the xdg-desktop-portal-kde, I have it because of KDE Plasma.
Is it possible that we have that problem because of Nvidia GPU?
I don't think that is the issue. As I said, I also face the same laggy behavior in KDE Plasma Wayland (it was in Intel GPU).
Plus, the scaling also have issues as you can see in the video. It zooms when I start flameshot.
I have not experience that on hyprland or plasma. Do you have fractional scaling? Or do you have multiple monitors?
I definitely feel the lack of Flameshot :)
Thanks. This issue needs to be addressed, but we are severely short-staffed. One of our two main devs left the project due to burn-out, and the other one is also very busy with personal life and his job. We have asked numerous times from the community to join the project as devs, but no one stepped up. Basically I am trying to keep the lights on at this point.
Apart from this short frustraited rant😅, as always any contribution is very welcome. Even if it means fixing a typo, or telling others who want to challenge their C++ skills.
Do you have fractional scaling? Or do you have multiple monitors?
I have fractional scaling enabled on hypr.conf: monitor=DP-1,2560x1440@165,auto,2
I have tried different qt environment variables but that didn't change it. If I set qt env like this, QT_SCREEN_SCALE_FACTOR=0.5 it seems to work but, since it lags I can not be sure it's working normally.
Basically I am trying to keep the lights on at this point.
It's surprising because, I have never seen a project even close to what Flameshot achieved. All functions you need from a screenshot tool without bloat; working cross platform; fully free and open source. Thanks for your work! I will try to inform more people.
There is also a possibility that since Flameshot normally is a very stable and completed program, there is not much to extend or improve in general meaning. So less people are interested. As Wayland has lots of problems for now, with the increased use of Wayland compositors, these issues will probably be addressed.
Btw, is there a way to compile Flameshot with Qt6 directly? I have both versions and I only used two cmake configs: USE_WAYLAND_CLIPBOARD USE_WAYLAND_GRIM
There is also a possibility that since Flameshot normally is a very stable and completed program, there is not much to extend or improve in general meaning. So less people are interested. As Wayland has lots of problems for now, with the increased use of Wayland compositors, these issues will probably be addressed.
We need to still push for three things:
Some people have shown interest in implementing the plugin system, and even one of Flameshot devs is having a branch on his fork for this. But it is still far from anything tangible as far as I know.
Wayland is a big issue especially when we get certain "opinionated" attitude from some devs (e.g Gnome folks who gave us a veeeeery hard time and practically caused burn-out).
Another dev was from Ukraine and, understandably, due to the war they have been focusing on real-life matters.
Btw, is there a way to compile Flameshot with Qt6 directly?
I know that the former main dev of Flameshot was at some point actively pushing to port it for Qt6, but that branch didn't get pushed up-stream. Perhaps it can be forked.
New release for xdg-desktop-portal-wlr: https://github.com/emersion/xdg-desktop-portal-wlr/releases/tag/v0.7.0
add Hyprland to wlr.portal
https://github.com/emersion/xdg-desktop-portal-wlr/blob/master/wlr.portal#L4
That means that when xdg-desktop-portal
reads XDG_CURRENT_DESKTOP=Hyprland, it will know that xdg-desktop-portal-wlr
is compatible and will automatically start it if necessary and send ScreenCast and Screenshot requests to it
I updated the AUR and I just confirmed that the AUR now out of the box works just fine on Hyprland.
@erikdubois would it be possible for you to also confirm this?
yes it works to make a picture with the last code on github It now also understands what screen to take a picture from (dual screen here).
But the button to copy/paste does not work yet.
I solved that like this - https://github.com/erikdubois/pkgbuild/blob/2d8ae6cb088798325d0d8c4fa1c9798deb0ef92d/edu-flameshot-git/PKGBUILD#L94
and
we add something to the .desktop file to take x11
echo
echo "Changing flameshot"
echo
if [ -f /usr/share/applications/org.flameshot.Flameshot.desktop ]; then
FIND="Exec=\/usr\/bin\/flameshot"
REPLACE="Exec=\/usr\/bin\/env GDK_BACKEND=x11 \/usr\/bin\/flameshot"
sudo sed -i "s/$FIND/$REPLACE/g" /usr/share/applications/org.flameshot.Flameshot.desktop
fi
@erikdubois Thanks. Yes for the clipboard flag I did the same some days ago:
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=flameshot-git#n94
and as far as I can tell, the clipboard is already very functional on hyprland. The only caveat is that on my machine it is very slow (maybe I should reboot), and tit takes about 20 seconds from the time I tell it to copy until the time that it is fully copied. For instance, I could easily paste it with correct dimension and resolution in Inkscape. also this slowness does not change whether I start the daemon and then the gui
or I just call it.
About that flag you are setting in the .desktop
file, I should say that it has one caveat: it does not work if someone call the daemon or other flameshot subcommands. That environmental variable only will be set if and only if the .desktop
file is used.
We for sure need to improve Flameshot to be more compatible with wlroot and wayland in general.
Do you think this issue can be closed?
@mmahmoudian
Hi! I have solved two problems by: 1. The lagging problem is solved by the pull request #3059 2. The scaling problem can be solved according to your scaling ratio. In my case scaling is 2.0 so;
QT_SCREEN_SCALE_FACTORS="0.5" flameshot gui
that makes the scaling Now I got only these problems left (These problems also happened before the two problems fixed):
Environment:
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:
However, when I set the environment variable $XDG_CURRENT_DESKTOP to Sway flameshot just doesn't do anything.
Steps to reproduce
flameshot gui
Screenshots or screen recordings
No response
System Information