flathub / com.logseq.Logseq

https://flathub.org/apps/details/com.logseq.Logseq
19 stars 12 forks source link

Can't access xdg-settings or open dialog to create new graph #105

Open sigmavirus24 opened 1 year ago

sigmavirus24 commented 1 year ago
~ ❯ flatpak run com.logseq.Logseq 
(rsapi) init loggers
LaunchProcess: failed to execvp:
xdg-settings
LaunchProcess: failed to execvp:
xdg-settings
20:38:10.154 › Logseq App(0.9.20) Starting... 
20:38:10.163 › restore proxy settings {:type "system"}
20:38:10.164 › set proxy to {:type "system"}
[48:1110/203813.628164:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times!
20:38:13.785 › :electron.handler/watch-dir {:path "/home/sigmavirus24/.logseq/config"}

If I enter the container I can see /run/host/usr/bin/xdg-settings but /usr/bin/ doesn't have xdg-settings.

~ ❯ flatpak run --filesystem=host --command=sh com.logseq.Logseq
[📦 com.logseq.Logseq ~]$ ls /usr/bin/xdg-*
/usr/bin/xdg-email  /usr/bin/xdg-open  /usr/bin/xdg-user-dir  /usr/bin/xdg-user-dirs-update
[📦 com.logseq.Logseq ~]$ /run/host/usr/bin/xdg-settings
xdg-settings: no operation given
Try 'xdg-settings --help' for more information.

If I download the AppImage then I can get things working without an issue, but I'd prefer to use flatpak.

~ ❯ flatpak info com.logseq.Logseq

Logseq - A local-first, non-linear, outliner notebook for organizing and
sharing your personal knowledge base

          ID: com.logseq.Logseq
         Ref: app/com.logseq.Logseq/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 0.9.20
     License: AGPL-3.0-or-later
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 425.3 MB
     Runtime: org.freedesktop.Platform/x86_64/22.08
         Sdk: org.freedesktop.Sdk/x86_64/22.08

      Commit: 34810510e13c9cf47043d5c10488a3eb3a028442ef2221f7bb6528fb0283f1f7
      Parent: d0de57b51cdc700e3a88465419ab22a745713d682083687a96b822be3f563073
     Subject: Updated node-gyp (48309caa)
        Date: 2023-11-02 14:00:13 +0000
daviddavo commented 1 year ago

I don't have any problems adding a new graph, the new window opens normally, but I have problems opening URLs: #106

sigmavirus24 commented 1 year ago

Sorry should have added that I'm running on Fedora 39 (I'm on my phone but it's the latest stable Fedora workstation version of I'm remembering the version right) and sway (Wayland) is my window manager. I don't think it's a window manager/Wayland/etc issue though.

Also confirmed that it's a system install and used Flatseal to verify it has Host permission. Like I said though, I think it's being mounted in the wrong place for some reason and that's the cause.

I can't remember which flatpak remote I used to install it though off the top of my head (flathub or fedora). Not sure if that would matter

daviddavo commented 1 year ago

Flatpak uses a thing called Portals to communicate with the Desktop Environment

Perhaps installing another backend could help?

This person has a similar issue with Fedora 38:

sigmavirus24 commented 1 year ago

Yeah, I'm trying to debug this a bit more, I don't want to leave this open without information. In digging a bit through what you gave me, I'm seeing a few things that are odd (don't feel the need to respond, this will be a bit of a stream of consciousness).

If I echo $XDG_CURRENT_DESKTOP I get GNOME. If I look at what's in the Flatpak when I launch it, it's also GNOME. If I inspect what's in systemd, e.g.,

$ systemctl --user show-environment | grep -E '(XDG_CURRENT_DESKTOP|WAYLAND_DISPLAY)'
WAYLAND_DISPLAY=wayland-1
XDG_CURRENT_DESKTOP=sway

If I override that with --env=XDG_CURRENT_DESKTOP=sway other things seem to break, including the rendering of the whole app. So that's clearly not the solution.

I looked to make sure that xdg-desktop-portal was running, it is. I saw in systemctl --user status xdg-desktop-portal though that there were some errors which I grabbed with journalctl

Nov 13 10:48:32 laptop xdg-desktop-por[11835]: Backend call failed: No such interface “org.freedesktop.impl.portal.FileChooser” on object at path /org/freedesktop/portal/desktop

Given I'm trying to open a FileChooser in Logseq, that seems to be a clear indication that something else is going on and it's maybe not xdg-setings that's the issue here. So that's helpful. I am on xdg-desktop-portal 1.16.0

$ dnf repoquery --installed --info xdg-desktop-portal
Name         : xdg-desktop-portal
Version      : 1.16.0
Release      : 3.fc38
Architecture : x86_64
Size         : 2.0 M
Source       : xdg-desktop-portal-1.16.0-3.fc38.src.rpm
Repository   : @System
From repo    : fedora
Summary      : Portal frontend service to flatpak
URL          : https://github.com/flatpak/xdg-desktop-portal/
License      : LGPLv2+
Description  : xdg-desktop-portal works by exposing a series of D-Bus interfaces known as
             : portals under a well-known name (org.freedesktop.portal.Desktop) and object
             : path (/org/freedesktop/portal/desktop). The portal interfaces include APIs for
             : file access, opening URIs, printing and others.

But I haven't tried upgrading to 1.17 or 1.18 manually yet. I don't have much time to dig into this, but I'm doing it in small bits and pieces and hopefully this helps someone else in the future

sigmavirus24 commented 1 year ago

Hm, so fun fact, this is broken on sway for all flatpak apps. I swapped over to Gnome and it works. So now I'm embarking on determining what's different between rofi launching something/launching it from the CLI (flatpak run) and Gnome. So I guess I'll be swapping back and forth for a while comparing systemctl --user show-environment and such.

kanru commented 1 year ago

Launching from Gnome uses the desktop entry (for example the system install one is /var/lib/flatpak/exports/share/applications/com.logseq.Logseq.desktop). The Exec entry has some additional parameters

[Desktop Entry]
Name=Logseq Desktop
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=run.sh --file-forwarding com.logseq.Logseq @@u %U @@
Terminal=false
Type=Application
Icon=com.logseq.Logseq
StartupWMClass=Logseq
Comment=A privacy-first, open-source platform for knowledge management and collaboration.
MimeType=x-scheme-handler/logseq;
Categories=Utility;office;
NoDisplay=false
Actions=Wayland;
X-Flatpak=com.logseq.Logseq

[Desktop Action Wayland]
Name=Wayland Backend
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=run.sh --file-forwarding com.logseq.Logseq @@u %U @@ --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations
sigmavirus24 commented 1 year ago

So, I have a diff of the two but I wonder if it's as simple as Gnome launches it differently from Rofi or the CLI and that was the biggest problem. After upgrading to Fedora 39 yesterday I'm on 1.18 of xdg-desktop-portal and that seems to have fixed things for Rofi usage at least. Maybe the better place for working out the rest of the differences is in how Rofi finds Desktop apps it launches and what that impacts for a Flatpak apps. I think most sway folks are using Rofi so it seems like a reasonable place to try to fix things in the event of future issues potentially but I don't know enough to say that for certain

jahed commented 9 months ago

I'm getting the same error on Ubuntu 23.10. I think it's the reason the DPI isn't right so everything looks like it's rendered at a low native resolution then linearly scaled up, resulting in a blurry image. Had a similar issue with https://github.com/flathub/com.notesnook.Notesnook/issues/27

Some other Electron apps render fine on Wayland. Trying out various flags and launch settings from those working apps didn't fix it. It could be that the app is using an older dependency version (like GTK) without a bug fix. Or it could be Ubuntu 23.10? I'm on Flatpak 1.14.4.