Open manfredlotz opened 1 year ago
I forgot to mention that in case the screenshot doesn't work I also see
May 29 13:01:49 hogwart xdg-desktop-por[8123]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied:
Only the focused app is allowed to show a system access dialog
in the syslogs
Thanks for the detailed report. It is highly appreciated.
I have to say thank you for your work on this great tool!! :-)
@manfredlotz Hi, can you help to test if grim
can take screenshots?
Hm, when I install grim
from extra, i.e extra/grim 1.4.0-3 and try to start it I get
compositor doesn't support wlr-screencopy-unstable-v1
There is more grim like stuff in AUR. Which one should I try?
Sure enough, wlroots' screenshot adapter doesn't work, can you find other command line screenshots for gnome?
You mean one working with Wayland, I assume. I will take a look.
The Gnome builtin screenshot utiliy works of course but I guess this is not a test you like to see.
You mean one working with Wayland, I assume. I will take a look.
yep
Just find the command line screencast tool for gnome's wayland technology, and I'll be able to use it as a screencast adapter
The Gnome builtin screenshot utiliy works of course but I guess this is not a test you like to see.
It should be a command-line screenshot tool that can output screenshots through stdout or files, without any graphical interface, and it applies to the wayland screenshot protocol of GNOME and can work properly in the wayland environment of gnome.
@manfredlotz Can you help me find it?
I will try. I wasn't yet successful to find a command line screenshot tool working with Wayland. Searching....
I will try. I wasn't yet successful to find a command line screenshot tool working with Wayland. Searching....
If you find it, just let me know, and then I'll check the documentation for this tool, and then, I'll submit a PR to enable this adapter.
This solves the problem of relying on dbus under wayland
Not yet found anything. The only quick and dirty way I found was
This works fine.
Should add that I did not specifically set any env var.
Using dbus to take screenshots in wayland is not a good idea. I prefer to use a screenshot adapter that supports the corresponding wayland compositor screenshot protocol
I'll look for it, but I'm not sure I can find the right one. If you can, please let me know.
It is not easy to find anything. I let you know if I will find something.
@manfredlotz https://github.com/ksnip/ksnip
Can you help test this? Use the following command
ksnip -p 1.png -c
It also has a GUI function for editing, but we only need the command line
You can do automatic downloads from your distribution's package manager
Hm, when I try
ksnip -p 1.png -c
I get
Info: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Warning: No capture mode selected, using default.
Critical: Invalid reply from DBus: Screenshot is not allowed
Now trying: env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland ksnip -p 1.png -c
and get
Critical: Unknown platform, using default X11 Image Grabber.
Warning: No capture mode selected, using default.
fish: Job 1, 'env XDG_SESSION_TYPE= QT_QPA_PL…' terminated by signal SIGSEGV (Address boundary error)
Hm, when I try
ksnip -p 1.png -c
I getInfo: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. Warning: No capture mode selected, using default. Critical: Invalid reply from DBus: Screenshot is not allowed
Now trying:
env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland ksnip -p 1.png -c
and get
Critical: Unknown platform, using default X11 Image Grabber. Warning: No capture mode selected, using default. fish: Job 1, 'env XDG_SESSION_TYPE= QT_QPA_PL…' terminated by signal SIGSEGV (Address boundary error)
GNOME seems to have only a dbus screenshot interface, my goodness!
env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland ksnip -p 1.png -c
env XDG_SESSION_TYPE=gnome QT_QPA_PLATFORM=wayland ksnip -p 1.png -c
try
OK, I tried env XDG_SESSION_TYPE=gnome QT_QPA_PLATFORM=wayland ksnip -p 1.png -c
and got
Critical: Unknown platform, using default X11 Image Grabber.
Warning: No capture mode selected, using default.
fish: Job 1, 'env XDG_SESSION_TYPE=gnome QT_Q…' terminated by signal SIGSEGV (Address boundary error)
When I do env XDG_SESSION_TYPE=wayland QT_QPA_PLATFORM=wayland ksnip -p 1.png -c
I can select an area for the screenshot but I get the following and there is no file 1.png
Info: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Warning: No capture mode selected, using default.
Warning: Wayland does not support QWindow::requestActivate()
Critical: Invalid reply from DBus: Screenshot is not allowed
@manfredlotz okay It looks like gnome has to interface via the dbus bus
@manfredlotz Can you check if gnome's official screenshot tool can meet the following requirements:
If these requirements can be met, please provide valid command line parameters and explanation of the parameters
In Gome 44 the screenshot utility is just part of gnome-shell
But I could install gnome-screenshot 41.0+r25+g45f08f0-1
and running gnome-screenshot -f 1.png
in a terminal did just work fine.
-f, --file=filename Save screenshot directly to this file
@manfredlotz okay,I got it
@manfredlotz https://github.com/flameshot-org/flameshot/pull/3215
Please help test this commit with the following cmake parameters
-DUSE_WAYLAND_GNOME=true
Thanks for the detailed report. It is highly appreciated.
@mmahmoudian I tried to take the issue and start working on it, and now it has its first PR
I replaced the both ../src/utils/screengrabber.cpp
and ../src/utils/screengrabber.h
and rebuilt with cmake ../ -DUSE_WAYLAND_GNOME=true
How shall I invoke flameshot
in the flameshot desktop file for testing? I mean which variables shall I explicitly set?
@manfredlotz No, if you replace the source code, you must also replace the following files:
src/utils/screengrabber.cpp
src/utils/screengrabber.h
src/CMakeLists.txt
In fact you can also choose to pull branches by executing the following command
https://github.com/jack9603301/flameshot
then:
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DUSE_WAYLAND_GNOME=true -DCMAKE_BUILD_TYPE=Release
make
sudo make install
note: Please replace the file again or pull the branch, I found the error and have submitted a fix (forced commit)
Ok, I got your repository and did like you described.
When invoking flameshot from command line I see
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Now doing a screenshot by clicking on the flameshot icon in the system tray working fine and seeing these messages in the terminal
QLayout: Attempting to add QLayout "" to SidePanelWidget "", which already has a layout
flameshot: info: Capture saved to clipboard.
When starting flameshot from the desktop file (no variables set explicitly here) screenshot is not working
@manfredlotz no
try run:
flameshot gui
flameshot gui
from the command line works fine, as did flameshot
without any parameter and clicking on the systray icon
@manfredlotz That's right, how did you compile it, please tell me the compile command!
I did exactly what you gave me, i.e. the cmake
command was
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DUSE_WAYLAND_GNOME=true -DCMAKE_BUILD_TYPE=Release
Is there a way to get debug messages?
I did exactly what you gave me, i.e. the
cmake
command was
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DUSE_WAYLAND_GNOME=true -DCMAKE_BUILD_TYPE=Release
@manfredlotz Show me the .desktop
file of your desktop flameshot file
In order to be clean I removed my local .desktop file and took the one installed with sudo make install
@manfredlotz okay, I suspect there is a problem with your local .desktop file definition
When you are sure there is no problem, test it, it should work fine with the presence of gnome's wayland screenshot adapter (gnome-screenshot)
Being in the build/
directory I see that both
src/share/applications/org.flameshot.Flameshot.desktop
and /usr/share/applications/org.flameshot.Flameshot.desktop
are the same.
@manfredlotz You can try it, the command line launch flameshot can run, that means you create icons by mouse launch should also be normal
Not sure I understand. In then end I want to autostart flameshot
and being able to do a screenshot. Gnome auto-starts flameshot
by using the flameshot .desktop file. And this doesn't work even with the newly built flameshot
@manfredlotz Can you record a screen? Send it over and I'll take a look.
After startup I have the flameshot icon in the systray at the upper right side
Now I want to be able to get a screenshot by clicking on the icon.
@manfredlotz Don't you get a response when you click on this icon?
When I use the installed .desktop file to let Gnome start flameshot and I click on that icon I get one shutter noise and nothing else.
But (as explained in my initial post) if I put the call to flameshot in a script and invoke that script via the .desktop file then things working fine.
@manfredlotz How can it be so strange?
@manfredlotz Would you like me to remote your computer in order to check what is going on with your system?
No.
When I try to make a screenshot by clicking on the systray flameshot icon I get the message (seen by journalctl)
Jun 03 05:37:27 hogwart xdg-desktop-por[6966]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
This is the same message I reported in the beginning when I opened the issue.
On your system things are working fine?
I found something. When I open flameshot configuration window and then try to make a screenshot by clicking the flameshot tray icon I get this window
Clicking on allow and taking screenshots is working fine.
I have no idea why I need to open the flameshot configuration window in order to be able to allow flameshot to take screenshots.
Flameshot Version
This is EndeavourOS with Gnome 44 and Wayland.
flameshot
is 12.1.0-1Flameshot v12.1.0 (-) Compiled with Qt 5.15.5 linux: 6.3.4-zen1-1-zen endeavouros: unknown
Installation Type
Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)
Operating System type and version
Linux, 6.3.4-zen
Description
As I was unable to get a screenshot with
flameshot
I copied/usr/share/applications/org.flameshot.Flameshot.desktop
to~/.local/share/applications/org.flameshot.Flameshot.desktop
Then I changed the exec line to
Exec=env XDG_SESSION_TYPE= QT_QPA_PLATFORM=wayland /usr/bin/flameshot
flameshot
starts ok but screenshot not workingI ran
dbus-monitor --session sender=org.flameshot.Flameshot
and gotBut when I create a script
~/bin/flameshot.sh
containingthen
flameshot
starts ok and screenshot is working fineHere the
dbus-monitor
showsI have no idea if this is a
flameshot
specific error or if there is some kind of permission whichflameshot
lacks when called directlySteps to reproduce
see above in the description
Screenshots or screen recordings
No response
System Information