pop-os / cosmic-screenshot

Utility for capturing screenshots via XDG Desktop Portal
GNU General Public License v3.0
25 stars 11 forks source link

[BUG] Cosmic Screenshot does not work with the Cosmic Desktop with Arch Linux #42

Open TheKamboy opened 2 months ago

TheKamboy commented 2 months ago

Thought I would make a new issue here since commenting under an inactive one doesn't do anything.

Log:

~
 RUST_BACKTRACE=full cosmic-screenshot
thread 'main' panicked at src/main.rs:71:10:
failed to receive screenshot response: Response(Other)
stack backtrace:
   0:     0x5606f6eb06e5 - <unknown>
   1:     0x5606f6ed824b - <unknown>
   2:     0x5606f6eacdef - <unknown>
   3:     0x5606f6eb04be - <unknown>
   4:     0x5606f6eb1859 - <unknown>
   5:     0x5606f6eb15fa - <unknown>
   6:     0x5606f6eb1d63 - <unknown>
   7:     0x5606f6eb1c44 - <unknown>
   8:     0x5606f6eb0ba9 - <unknown>
   9:     0x5606f6eb1977 - <unknown>
  10:     0x5606f6ed6713 - <unknown>
  11:     0x5606f6ed6c06 - <unknown>
  12:     0x5606f6c21ad4 - <unknown>
  13:     0x5606f6d0e890 - <unknown>
  14:     0x5606f6ce0011 - <unknown>
  15:     0x5606f6cbfc3c - <unknown>
  16:     0x5606f6ccc478 - <unknown>
  17:     0x5606f6ceb553 - <unknown>
  18:     0x5606f6cb99e9 - <unknown>
  19:     0x5606f6ea7c2d - <unknown>
  20:     0x5606f6ccc545 - <unknown>
  21:     0x766df481fe08 - <unknown>
  22:     0x766df481fecc - __libc_start_main
  23:     0x5606f6bfd475 - <unknown>
  24:                0x0 - <unknown>
TheKamboy commented 2 months ago

Also, putting XDG_DESKTOP_PORTAL=cosmic in /etc/enviroment doesn't work.

kekkoudesu commented 2 months ago

Same result on Fedora Silverblue.

TheKamboy commented 2 months ago

Something I find odd is that if I use Cosmic Screenshot with a different wayland based enviroment (ex. Hyprland) it works.

soloturn commented 2 months ago

for me cosmic-screenshot on cosmic desktop works. it looses focus sometimes so one cannot click the capture button.

what i find weird that gnome screenshot does not work with cosmic desktop.

asjur commented 2 months ago

Same here, unable to launch it.

pauljako commented 2 months ago

Same Issue on fedora 40 arm64

drazil100 commented 1 month ago

me too. While I have seen a panic previously, mine just hangs now with no interface.

joshuamegnauth54 commented 1 month ago

@TheKamboy To clarify, cosmic-screenshot works on Hyprland and other DEs/WMs because this program simply calls into an interface that's implemented across different desktop environments.

@drazil100 Hi again!! Your original issue had an interesting bit of information that I'll copy here for anyone attempting this issue.

$ cosmic-screenshot
thread 'main' panicked at src/main.rs:69:10:
failed to send screenshot request: Zbus(MethodError(OwnedErrorName(ErrorName(Str(Owned("org.freedesktop.DBus.Error.UnknownMethod")))), Some("No such interface “org.freedesktop.portal.Screenshot” on object at path /org/freedesktop/portal/desktop"), Msg { type: Error, sender: UniqueName(Str(Borrowed(":1.58"))), reply-serial: 17, body: Signature("s") }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It seems like the screenshot interface isn't being exposed or doesn't exist for some reason.

For those of you experiencing this issue, can you try getting some logs? Try:

journalctl --user -ef

And then look for logs related to xdg-desktop-portal-cosmic or maybe even the compositor.

joshuamegnauth54 commented 1 month ago

Interestingly, #56 is experiencing the same problem but on Pop so it doesn't seem to be directly related to Arch or other distros.

drazil100 commented 1 month ago

I noticed I have issues when I try to use it when I launch with start-cosmic but not always. When I log in through cosmic-greeter it works though.

Edit: I worded that so poorly... Fixed

joshuamegnauth54 commented 1 month ago

I can't reproduce this yet. :sob: I may need log excerpts from some of you.

I'll likely spin up an Arch VM since it seems more reproducible there.

drazil100 commented 1 month ago
austin@msi:~$ RUST_BACKTRACE=1 cosmic-screenshot
thread 'main' panicked at src/main.rs:69:10:
failed to send screenshot request: Zbus(MethodError(OwnedErrorName(ErrorName(Str(Owned("org.freedesktop.DBus.Error.UnknownMethod")))), Some("No such interface “org.freedesktop.portal.Screenshot” on object at path /org/freedesktop/portal/desktop"), Msg { type: Error, sender: UniqueName(Str(Borrowed(":1.8"))), reply-serial: 17, body: Signature("s") }))
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
austin@msi:~$ RUST_BACKTRACE=full cosmic-screenshot
thread 'main' panicked at src/main.rs:69:10:
failed to send screenshot request: Zbus(MethodError(OwnedErrorName(ErrorName(Str(Owned("org.freedesktop.DBus.Error.UnknownMethod")))), Some("No such interface “org.freedesktop.portal.Screenshot” on object at path /org/freedesktop/portal/desktop"), Msg { type: Error, sender: UniqueName(Str(Borrowed(":1.8"))), reply-serial: 17, body: Signature("s") }))
stack backtrace:
   0:     0x556bb54c0645 - <unknown>
   1:     0x556bb54e81ab - <unknown>
   2:     0x556bb54bcd4f - <unknown>
   3:     0x556bb54c041e - <unknown>
   4:     0x556bb54c17b9 - <unknown>
   5:     0x556bb54c155a - <unknown>
   6:     0x556bb54c1cc3 - <unknown>
   7:     0x556bb54c1ba4 - <unknown>
   8:     0x556bb54c0b09 - <unknown>
   9:     0x556bb54c18d7 - <unknown>
  10:     0x556bb54e6673 - <unknown>
  11:     0x556bb54e6b66 - <unknown>
  12:     0x556bb5231a17 - <unknown>
  13:     0x556bb531e850 - <unknown>
  14:     0x556bb52f01f1 - <unknown>
  15:     0x556bb52cfbfc - <unknown>
  16:     0x556bb52dc438 - <unknown>
  17:     0x556bb52fb513 - <unknown>
  18:     0x556bb52c99a9 - <unknown>
  19:     0x556bb54b7b8d - <unknown>
  20:     0x556bb52dc505 - <unknown>
  21:     0x7fa1fb37ee08 - <unknown>
  22:     0x7fa1fb37eecc - __libc_start_main
  23:     0x556bb520d435 - <unknown>
  24:                0x0 - <unknown>
TheKamboy commented 1 month ago

I haven't commented in a while since I had moved on from using cosmic (for now) but it seems like cosmic screenshot doesn't work with certain distributions of Arch Linux. I recently switched to Arch Craft, and cosmic screenshot works in cosmic there. I'm not sure if I should rename the issue to something like Cosmic Screenshot panics in certain Arch Distributions, or something else.

drazil100 commented 1 month ago

For me it seems like it's intermittent on manjaro. It definitely wasn't working when I was using start-cosmic as opposed to cosmic-greeter, but now that I'm on cosmic-greeter it usually works. It depends on the day though. I have to reboot to fix it. Idk what's causing it.

drazil100 commented 1 month ago

I got it! I figured out a reproduction case that works on the Pop!_OS 24.04 alpha!

  1. Boot up your system until you get to the cosmic-greeter login screen
  2. Switch to a tty
  3. Run a graphical program with cage (in my case cage alacritty)
  4. Close the program and log out of the tty entirely (doubt this step is required)
  5. Switch back to the cosmic-greeter login screen and log in normally
  6. Try to take a screenshot.

cosmic-screenshot will panic any time you try to run it until you reboot.

I assume this is some sort of weird race condition where if something manages to insert itself inbetween boot and logging into cosmic cosmic-screenshot can't hook in properly. This would explain why there haven't really been reports of issues with it in the Pop alpha. My guess is that some session managers actually interfere with cosmic-screenshot.

It appears from what I can tell that cosmic-screenshot is highly sensitive to how you log into cosmic and what runs before logging into cosmic. Once you are in and cosmic-screenshot runs once it will continue working for the remainder of the session, but if it doesn't run it will continue not to run for the remainder of the session.

ctrldemi commented 1 month ago

Just experienced this issue on archlinux. It only shows up when starting cosmic from the tty with cosmic-session. When using cosmic-comp, cosmic-greeter or any other display manager to log in it initializes correctly and does not panic.