flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
23.92k stars 1.52k forks source link

Niri WM support #3605

Open Sovenok-Hacker opened 1 month ago

Sovenok-Hacker commented 1 month ago

Feature Description

If I run Flameshot on my Arch setup with Niri WM, it fails with "Unable to detect desktop environment (GNOME? KDE? Sway? ...)". Will it be hard to enable Flameshot on Niri? And if it is simple, can I contribute?

berkentekin commented 1 month ago

It's weird that you get this error, looking at the code I don't see any way a Wayland WM can get to the stage where it prints that error. Worst case scenario your DE should be set as "OTHER" in the code, and you should get a warning about having grim installed.

Maybe try setting your XDG_CURRENT_DESKTOP environment variable to something like "niri" or "niriwm" first, if it's unset.

Adding a WM to the code is actually easy, you just need to modify desktopinfo and screengrabber. But there's some other issue here.

If you want to debug the code yourself, add the following statements to ScreenGrabber::grabEntireDesktop just before the switch statement:

        auto wm = m_info.windowManager();
        AbstractLogger::info() << tr("Detected window manager: %1").arg(static_cast<int>(wm));

        switch (wm) { // Change the existing switch statement to this

You should get a number between 0 and 5, each corresponding to an enum value in desktopinfo.h.