lunaneff / gnome-shell-extension-zenbook-duo

GNU General Public License v3.0
14 stars 10 forks source link

Screenshots don't work #4

Closed lunaneff closed 2 years ago

lunaneff commented 2 years ago

Originally posted by @jibsaramnim in PR #2:

I tried out your updated version with new settings UI, it's so nice to see! Unfortunately I had no luck getting the screenshot options to work other than the interactive one. I am not sure if this is an issue specific to my setup though, as running gnome-terminal directly also throws errors. Do you happen to know if this is perhaps currently not working under Wayland? I can make screenshots just fine using the interactive mode, at least.

lunaneff commented 2 years ago

Strange that screenshots and custom commands don't work for you, they worked when I tried it. Although that was on Xorg, so I don't have to re-log all the time.

For screenshots: do you see any errors when you run gnome-screenshot without any arguments in a terminal?

And for custom commands: do you have a sh in your PATH and does it accept arguments like this to run a command: sh -c <command>?

jibsaramnim commented 2 years ago

For screenshots: do you see any errors when you run gnome-screenshot without any arguments in a terminal?

I do. I just tested this on my main desktop too (also running Fedora 35 under Wayland) and I'm getting the same errors. I'm pretty sure this is just currently an issue with gnome-screenshot under Wayland. Running gnome-screenshot --interactive works fine, as one might expect.

~ ❯❯❯ gnome-screenshot
** Message: 17:01:28.991: Unable to use GNOME Shell's builtin screenshot interface, resorting to fallback X11.

(gnome-screenshot:316880): Gdk-CRITICAL **: 17:01:28.991: gdk_pixbuf_get_from_surface: assertion 'width > 0 && height > 0' failed

(gnome-screenshot:316880): GdkPixbuf-CRITICAL **: 17:01:28.991: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

(gnome-screenshot:316880): GdkPixbuf-CRITICAL **: 17:01:28.991: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

(gnome-screenshot:316880): GdkPixbuf-CRITICAL **: 17:01:28.991: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

(gnome-screenshot:316880): GdkPixbuf-CRITICAL **: 17:01:28.991: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

(gnome-screenshot:316880): Gtk-CRITICAL **: 17:01:28.999: gtk_window_resize: assertion 'width > 0' failed

** (gnome-screenshot:316880): CRITICAL **: 17:01:29.000: Unable to capture a screenshot of any window

And for custom commands: do you have a sh in your PATH and does it accept arguments like this to run a command: sh -c ?

I do, and I can run custom commands like that yes. When I try sh -c "gnome-screenshot" I get the exact same errors.

The only way I can get it to not show these errors is to pass --display=$DISPLAY to it, but then it shows a (warning) message and the screenshot made is all black:

 ❯❯❯ gnome-screenshot --display=$DISPLAY
** Message: 17:04:19.038: Unable to use GNOME Shell's builtin screenshot interface, resorting to fallback X11.

But as I'm pretty sure this is a Wayland specific issue with gnome-screenshot launched through cli, I'm not entirely sure if there's much we can do about it for this project. Perhaps sticking with having the --interactive option as the default selection would avoid the issue for those that do run on Wayland?

jibsaramnim commented 2 years ago

I just realized your issue title, launching custom commands does actually work for me. I tried setting the option to gnome-terminal for example, and it launched just fine.

lunaneff commented 2 years ago

Oh, I misunderstood your original comment

jibsaramnim commented 2 years ago

It's my mistake, I was sort of all over the place with my comments. I should try to keep issues/PRs a bit more on-topic :).

lunaneff commented 2 years ago

I looked up the error message on the gnome-screenshot repo, looks like it's known and already fixed in MR #55. They also released version 41 yesterday, which includes the fix. Now we just have to wait for distros to update their package

jibsaramnim commented 2 years ago

Nice find, and good news! I figured I'd be something unrelated to your extension :).

lunaneff commented 2 years ago

Arch now has version 41, and I can confirm that it's fixed after the update

jibsaramnim commented 2 years ago

Nice! I think it will take a bit longer before it'll show up for my distro, but I think it's safe to say we can close this issue as it's definitely not caused by your extension at least :).