OttoAllmendinger / gnome-shell-screenshot

Gnome Shell extension for making and uploading screenshots
MIT License
267 stars 53 forks source link

Gnome 41 support #158

Closed plumlis closed 2 years ago

plumlis commented 3 years ago

It seems haven‘t gnome 41 ready yet?

plumlis commented 3 years ago

-- Journal begins at Mon 2021-05-10 13:40:14 CST. -- 9月 28 11:54:19 plum-laptop gnome-shell[4977]: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed 9月 28 11:54:19 plum-laptop gnome-shell[4977]: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed 9月 28 11:57:43 plum-laptop gnome-shell[4977]: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed 9月 28 11:57:55 plum-laptop gnome-shell[4977]: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed 9月 28 11:57:55 plum-laptop gnome-shell[4977]: meta_window_set_stack_position_no_sync: assertion 'window->stack_position >= 0' failed 9月 28 11:58:56 plum-laptop gnome-shell[4977]: Timelines with detached actors are not supported 9月 28 11:59:04 plum-laptop gnome-shell[4977]: JS ERROR: Error: cmd: gjs /home/plum/.local/share/gnome-shell/extensions/gnome-shell-screenshot@ttll.de/auxhelper.js --filename /tmp/gnome-shell-screenshot-0B2DA1.png --area 1048,161,378,262 exitCode=256 spawnAsync/</<@/home/plum/.local/share/gnome-shell/extensions/gnome-shell-screenshot@ttll.de/extension.js:469:30 9月 28 11:59:17 plum-laptop gnome-shell[4977]: Timelines with detached actors are not supported 9月 28 11:59:17 plum-laptop gnome-shell[4977]: Timelines with detached actors are not supported 9月 28 12:00:56 plum-laptop gnome-shell[4977]: JS ERROR: Error: cmd: gjs /home/plum/.local/share/gnome-shell/extensions/gnome-shell-screenshot@ttll.de/auxhelper.js --filename /tmp/gnome-shell-screenshot-W9ZVA1.png --area 424,640,527,236 exitCode=256 spawnAsync/</<@/home/plum/.local/share/gnome-shell/extensions/gnome-shell-screenshot@ttll.de/extension.js:469:30

saboya commented 2 years ago

In their infinite wisdom the Gnome team decided to just break userspace abruptly:

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970

Essentially this extension has to be reimplemented using org.freedesktop.portal.Screenshot, but unclear if it can have feature parity with the existing functionality.

The alternative is using unsafe mode, which you can do by using this:

https://extensions.gnome.org/extension/4517/unsafe-mode/

OttoAllmendinger commented 2 years ago

Thanks for the heads up. Looks like it won't be an easy change.

ramottamado commented 2 years ago

In their infinite wisdom the Gnome team decided to just break userspace abruptly:

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1970

Essentially this extension has to be reimplemented using org.freedesktop.portal.Screenshot, but unclear if it can have feature parity with the existing functionality.

The alternative is using unsafe mode, which you can do by using this:

https://extensions.gnome.org/extension/4517/unsafe-mode/

Hello, I'm the author of said extension. Basically, that extension works by enabling unsafe_mode from Mutter global context (which you can always do from LG or from your own extension, just see the source code itself).

The problem is this mode is (surprise!) unsafe for end users, since this enable arbitrary code executions (just like ol' GNOME 3 days) by abusing Eval() dbus method.

Since security is a big issue, and nobody wants some rogue apps, scripts or extensions running malicious codes on their machine because an extension just open up the possibility to, I've since inactivated the extension, but you can still install the extension from the source code.

So you can either:

  1. Enable unsafe_mode from your extension (which is not advised, and potentially a security breach)
  2. Register your DBus caller as n allowed caller on the Shell side from your extension
  3. Re-implement the caller
stefangweichinger commented 2 years ago

Is there a usable workaround for Gnome 41 now, or not? I just upgraded to Fedora 35 beta and find myself without this very useful extension ;-) thanks for any info on that

saboya commented 2 years ago

@stefangweichinger Since you're using Fedora 35, you might as well use this:

https://copr.fedorainfracloud.org/coprs/yalter/gnome-shell-screenshot-ui/

It has a new "native" screenshot ui that will probably be enough for most people. I'm using that for now.

stefangweichinger commented 2 years ago

@saboya thanks. "Everybody else should avoid this repo." sound good ;-)

rduivenvoorde commented 2 years ago

Mmm, really miss this extension.

I had a look now at the 'Default Gnome Screenshot tool', and was actually rather positive about it's capabilities:

Screenshot

Only thing I miss is your nice 'menu' item...

So I wonder (and that would be my question) if it would be doable to 'merge' your menu with the workings of the screenshot tool? OR is this actually already what you did? OR would it be more appropriate to make this a feature request in the Screenshot Tool repo: "plz make it possible to (optionally) add a menu to the topbar"

OttoAllmendinger commented 2 years ago

for those who can't wait any longer, I pushed this branch here https://github.com/OttoAllmendinger/gnome-shell-screenshot/tree/gnome41-unsafe-mode

moore-bryan commented 2 years ago

Sorry, @OttoAllmendinger, the above "unsafe" fix doesn't work for me; i.e., same Error exit code=256 issue on my Fedora 35 install.

BlackDex commented 2 years ago

@moore-bryan that is because there is an error in the code. In his hast @OttoAllmendinger forgot to add , after the "40" versions while adding "41".

I applied these changes manually within my ~/.local/share/gnome-shell/extensions/gnome-shell-screenshot@ttll.de directory to the same files. And at line 1289 of the extension.js i add the following:

global.context.unsafe_mode = true;

Reloaded Gnome-Shell and now it is working like a charm again.

rduivenvoorde commented 2 years ago

@BlackDex are you sure about the comma? It is already an array?

I checked out the gnome41-unsafe-mode and did the install as written in readme and extension is working here (Debian testing). No comma needed, both with (an optional) and without it works.

Only change I see is the 'broken lock' icon, probably because it is 'unsafe'?

Screenshot-20211111183720-267x66

BlackDex commented 2 years ago

@rduivenvoorde , normally javascript array's need a , to separate the array elements. But, i'm not sure regarding gnome-shell actually, could be different.

Could be that it is causing issues now, but maybe no critical items. Also since the metadata just has one element, which is no issue there.

moore-bryan commented 2 years ago

Well, the comma is irrelevant for me because I'd already adjusted the metadata.json file to include the correct version and adding the code at line 1289 breaks everything; that is, without it, the icon will load but I can't screenshot and with it the extension cannot be enabled at all.

jmrodri commented 2 years ago

Is there a usable workaround for Gnome 41 now, or not? I just upgraded to Fedora 35 beta and find myself without this very useful extension ;-) thanks for any info on that

I'm having the same problem now. I should've known this is my most used extension.

lvanderree commented 2 years ago

@BlackDex are you sure about the comma? It is already an array?

I checked out the gnome41-unsafe-mode and did the install as written in readme and extension is working here (Debian testing). No comma needed, both with (an optional) and without it works.

Only change I see is the 'broken lock' icon, probably because it is 'unsafe'?

Screenshot-20211111183720-267x66

That is correct. I was also wondering what this icon was... https://discourse.gnome.org/t/what-does-the-lock-icon-mean/8040

lvanderree commented 2 years ago

My workaround is to have the PrtSc-key bounded to the gnome-screenshot-tool. Which sort of works OK, but I would rather still use this extension.

fhuberts commented 2 years ago

I'm on Fedora 35, and it has these shortcuts: image

I think switching to the new shortcuts is doable, I'm going to try :-)

somepaulo commented 2 years ago

I think switching to the new shortcuts is doable, I'm going to try :-)

The trouble of memorizing all those shortcuts, especially when you only need screenshots once in a while, was most people's reason for using this extension (imho). No need to remember, just use the convenient menu.

OttoAllmendinger commented 2 years ago

portal support: #168

OttoAllmendinger commented 2 years ago

Version with Gnome 41 support is now active in the store.