zen-browser / desktop

🌀 Experience tranquillity while browsing the web without people tracking you!
https://zen-browser.app
Mozilla Public License 2.0
19.05k stars 459 forks source link

AppImage can't set itself as the default web browser (Reason in the description). #1797

Open Samueru-sama opened 1 month ago

Samueru-sama commented 1 month ago

Captchas

What happened?

After a read some comments in the discord, turns out that the Zen AppImage can't set itself as the default web browser, it will work the first time you try but if you close and reopen the browser it won't be the default one anymore.

The reason for this issue is that when you set Zen as the default, it generates its own .desktop entry in ${XDG_DATA_HOME:-$HOME/.local/share}/applications but the Exec= part contains the full path to the zen binary in tmp, which is a location that changes name every time Zen is relaunched.

image

To fix this issue Zen needs to check the env variable $APPIMAGE which contains the full path to the AppImage and use that when generating the .desktop entry.

Note in the meantime this issue can be fixed by editing the .desktop and pointing the Exec= line to the Zen AppImage location and that will set Zen as the default web browser even if it says it isn't.

Reproducible?

Version

1.0.1-a.5

What platform are you seeing the problem on?

Linux

Relevant log output

No response

linear[bot] commented 1 month ago

ZEN-1794 AppImage can't set itself as the default web browser (Reson in the description).

neogeographica commented 1 month ago

This bug also means you start accumulating multiple "userapp-Zen Browser-*.desktop" files in that .local/share/applications directory.

Also really garbages up the content of .config/mimeapps.list

Samueru-sama commented 1 month ago

I checked that on the librewolf appimage you can't set librewolf as the default browser, I don't know if this is also missing from other versions of librewolf.

I wonder how the snap of firefox and other web browsers handle this, because those are also squashfs images that get mounted at random locations like appimages.

edit: I actually tried to install snap to see how it works there and I can't because snap has a hard dependency to system LOL

RayZ3R0 commented 3 weeks ago

@Samueru-sama Appimage has that issue yeah. Which distro are you on? If you are on ubuntu based distro, you can try using pacstall

Samueru-sama commented 3 weeks ago

@Samueru-sama Appimage has that issue yeah. Which distro are you on? If you are on ubuntu based distro, you can try using pacstall

I'm on Artix linux and I use the appimage with AM.

AM already puts the right .desktop in place and it is already the default app so this issue I opened doesn't affect me, however fixing the issue should be as simple as changing the "argv0" in the code to check for $APPIMAGE which contains the path to the actual appimage and not the zen binary.

I may be able to PR a fix but I just don't know where to even look in the source code to see how Zen determines its location.

RayZ3R0 commented 3 weeks ago

Ah, okay. We'll look into it