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

Unable to export in Flatpak VSCode #451

Closed
josecastillolema opened this issue Mar 30, 2024 · 4 comments
Closed

Unable to export in Flatpak VSCode #451

josecastillolema opened this issue Mar 30, 2024 · 4 comments

Comments

@josecastillolema
Copy link

Is there a way to export slides in the Flatpak version of VSCode?

I am able to run i.e.: Chrome from the Flatpak vscode version:

> flatpak run --command=sh com.visualstudio.code
[📦 com.visualstudio.code]$ flatpak-spawn --host flatpak run com.google.Chrome

However unfortunately the following setting does not seem to work:

"markdown.marp.chromePath": "flatpak-spawn --host flatpak run com.google.Chrome"
@yhatt
Copy link
Member

yhatt commented Mar 31, 2024

markdown.marp.chromePath does not allow the shell command. You must specify the actual path for the Flatpak Chrome binary.

{
  "markdown.marp.chromePath": "/var/lib/flatpak/exports/bin/com.google.Chrome"
}

Related

@josecastillolema
Copy link
Author

Hi @yhatt , thanks for your quick response!
Unfortunately that won't work, /var/lib/flatpak is not accessible from inside flatpaks (neither is $HOME/.local/share/flatpak/exports/bin):

> ls /var/lib/flatpak/exports/bin/com.google.Chrome
/var/lib/flatpak/exports/bin/com.google.Chrome

> ls .local/share/flatpak/exports/bin/com.google.Chrome
.local/share/flatpak/exports/bin/com.google.Chrome

> flatpak run --command=sh com.visualstudio.code
[📦 com.visualstudio.code ~]$ ls /var/lib/flatpak/exports/bin/com.google.Chrome
ls: cannot access '/var/lib/flatpak/exports/bin/com.google.Chrome': No such file or directory

[📦 com.visualstudio.code ~]$ ls .local/share/flatpak/exports/bin/com.google.Chrome
ls: cannot access '.local/share/flatpak/exports/bin/com.google.Chrome': No such file or directory

The proposed workaround would work if VSCode was not a Flatpak and Chrome was, but wont work when both of them are.

This is by design, see Allow a flatpak to discover/call another flatpak #283

@yhatt
Copy link
Member

yhatt commented Mar 31, 2024

Thank you for more context to recognize the problem. By the design of flatpak as you've described, using flatpak Chrome from flatpak VS Code to export Marp slides would be difficult for now.

It looks like able to spawn Chrome process, by making the wrapper shell script like below and setting its path to markdown.marp.chromePath. But even if it succeed, the result of export PDF will save to inside of the Chrome flatpak sandbox, so VS Code cannot read that across sandboxes.

The example of wrapper script (Click to open)
#!/bin/sh

flatpak-spawn --host /var/lib/flatpak/exports/bin/com.google.Chrome "$@"

If there were the SDK Extension of freedesktop.org for Chrome/Chromium, this problem may be solved because the browser will be available in inside of the VS Code flatpak sandbox. This is already feedbacked to the Flathub community through Obsidian Marp Slides plugin, but there is no progress.

@josecastillolema
Copy link
Author

The wrapper works!
And the result of the export PDF is not saved inside the Chrome flatpak, but in any directory inside the home folder selected by the user.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants