Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flameshot is broken on wlroots-based compositors because USE_WAYLAND_GRIM is not set. #292700

Closed
dmayle opened this issue Mar 2, 2024 · 12 comments · Fixed by #327228
Closed

flameshot is broken on wlroots-based compositors because USE_WAYLAND_GRIM is not set. #292700

dmayle opened this issue Mar 2, 2024 · 12 comments · Fixed by #327228
Labels
9.needs: package (update) This needs a package to be updated

Comments

@dmayle
Copy link
Contributor

dmayle commented Mar 2, 2024

Describe the bug

flameshot has two backends, one that works in KDE, and one that works in wlroots-based compositors, but the flag USE_WAYLAND_GRIM must be set in order to enable it.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Try to use flameshot in wlroots-based compositor like sway

Expected behavior

It works

Screenshots

[nix-shell:~]$ env XDG_CURRENT_DESKTOP=sway XDG_SESSION_DESKTOP=sway QT_QPA_PLATFORM=wayland flameshot gui
flameshot: error: Unable to capture screen
flameshot: error: Unable to capture screen
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
flameshot: info: Screenshot aborted.

Additional context

Add any other context about the problem here.

Notify maintainers

@hamhut1066

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.18, NixOS, 24.05 (Uakari), 24.05.20240229.1536926`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/etc/nixpath/nixpkgs`

Add a 👍 reaction to issues you find important.

@dmayle dmayle added the 0.kind: bug Something is broken label Mar 2, 2024
@dmayle
Copy link
Contributor Author

dmayle commented Mar 2, 2024

@dmayle
Copy link
Contributor Author

dmayle commented Mar 3, 2024

It turns out that this flag is not yet available in a release. To use it, I created the following package override:

  flameshotGrim = pkgs.flameshot.overrideAttrs (oldAttrs: {
    src = pkgs.fetchFromGitHub {
      owner = "flameshot-org";
      repo = "flameshot";
      rev = "3d21e4967b68e9ce80fb2238857aa1bf12c7b905";
      sha256 = "sha256-OLRtF/yjHDN+sIbgilBZ6sBZ3FO6K533kFC1L2peugc=";
    };
    cmakeFlags = [
      "-DUSE_WAYLAND_CLIPBOARD=1"
      "-DUSE_WAYLAND_GRIM=1"
    ];
    buildInputs = oldAttrs.buildInputs ++ [ pkgs.libsForQt5.kguiaddons ];
  });

and now flameshot works!

For home-manager I also added the following:

services.flameshot = {
  enable = true;
  package = flameshotGrim;
};

@eclairevoyant
Copy link
Contributor

Not sure I'd call this a bug if there's no release with this code, though it seems like it will be some time before the next release: flameshot-org/flameshot#3443

KFearsoff added a commit to KFearsoff/NixOS-config that referenced this issue Mar 23, 2024
Remove overlay once NixOS/nixpkgs#292700 is resolved
@KFearsoff
Copy link
Contributor

I can confirm that the overlay above works for me.

There's a small caveat: grim should be available in the PATH, otherwise the setup will be a little more janky.

@dmayle
Copy link
Contributor Author

dmayle commented Mar 24, 2024

Not sure I'd call this a bug if there's no release with this code, though it seems like it will be some time before the next release: flameshot-org/flameshot#3443

Whether or not there's a release, it's still a bug. There were more attempts to fix this 2-3 years back, but as you can read in that linked issue, the authors are currently not working on updates.

Since there's no official release, it might not make sense to issue an interim package update, but as long as I have my working flameshot, I'm happy. I just wanted to share this with others who run into the same problem

@dmayle
Copy link
Contributor Author

dmayle commented Mar 24, 2024

I can confirm that the overlay above works for me.

There's a small caveat: grim should be available in the PATH, otherwise the setup will be a little more janky.

I hadn't noticed that... I've just updated buildInputs (to add grim) and removed grim from my default home-manager environment... I think that should take care of it, but I'll test to be sure.

@eclairevoyant eclairevoyant added 9.needs: package (update) This needs a package to be updated and removed 0.kind: bug Something is broken labels Mar 24, 2024
@dmayle
Copy link
Contributor Author

dmayle commented Apr 22, 2024

I can confirm that the overlay above works for me.

There's a small caveat: grim should be available in the PATH, otherwise the setup will be a little more janky.

After using for awhile, I can confirm. You need to add grim into your environment in order for this to work consistently.

@Kreyren
Copy link
Contributor

Kreyren commented Jul 14, 2024

I can't seem to get that to work on GNOME see NiXium-org/NiXium#115

@eclairevoyant
Copy link
Contributor

I can't seem to get that to work on GNOME

Yes, grim is for wlroots-based compositors, not mutter.

@Kreyren
Copy link
Contributor

Kreyren commented Jul 15, 2024

Yes, grim is for wlroots-based compositors, not mutter. -- @eclairevoyant (#292700 (comment))

Unrelated to this issue then? -> Krey, make a new issue?

@eclairevoyant
Copy link
Contributor

eclairevoyant commented Jul 15, 2024

Sure, but I don't know if upstream even supports mutter; doesn't seem like it based on flameshot-org/flameshot#3639, flameshot-org/flameshot#3473, etc.

@Kreyren
Copy link
Contributor

Kreyren commented Jul 15, 2024

Sure, but I don't know if upstream even supports mutter; doesn't seem like it based on flameshot-org/flameshot#3639, flameshot-org/flameshot#3473, etc. -- @eclairevoyant (#292700 (comment))

For context it's currently broken, but it worked with the fix in #292700 (comment) until recently, so thought it was relevant to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
9.needs: package (update) This needs a package to be updated
Projects
None yet
4 participants