From 9c0fcc0de564f832b8a630666094a80a2e43de07 Mon Sep 17 00:00:00 2001 From: ohfp <1813007-ohfp@users.noreply.gitlab.com> Date: Fri, 1 Jan 2021 01:38:44 +0100 Subject: Improve the Flatpak build process .desktop file, icon and appdata are now properly exported by flatpak. "Wayland first" flatpak, falling back to X11 if not on Wayland. Note: this is currently potentially broken on many systems (ie. font rendering is broken). See https://github.com/flatpak/flatpak/issues/2861. Might work when using Wayland + Gnome, does not seem to work on Arch + Sway (couldn't get it working with any workaround for now). Several smaller issues addressed. A few untested issues might remain (Screensharing, WebRTC/Camera access) Addresses (at least partially): #128, #132, #131, #118 --- CHANGELOG.md | 1 + .../content/io.gitlab.LibreWolf.appdata.xml.in | 2 +- flatpak/build_flatpak.sh | 17 ++++++++------- flatpak/content/io.gitlab.LibreWolf.desktop | 25 ++++++++++++++++++++++ flatpak/content/io.gitlab.LibreWolf.json | 16 +++++++++++--- flatpak/content/librewolf.desktop | 12 ----------- 6 files changed, 49 insertions(+), 24 deletions(-) create mode 100644 flatpak/content/io.gitlab.LibreWolf.desktop delete mode 100644 flatpak/content/librewolf.desktop diff --git a/CHANGELOG.md b/CHANGELOG.md index 012692c..368efe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project follows the official Firefox releases, but also uses ### Fixed +- Flatpak now properly provides a .desktop-file (and some other small improvements) - Fixed AppImage crashes when `XDG_DATA_DIRS` is unset (fixes #139) ## [84.0-1] - 2020-12-25 diff --git a/binary_tarball/content/io.gitlab.LibreWolf.appdata.xml.in b/binary_tarball/content/io.gitlab.LibreWolf.appdata.xml.in index f47605c..ae240f3 100644 --- a/binary_tarball/content/io.gitlab.LibreWolf.appdata.xml.in +++ b/binary_tarball/content/io.gitlab.LibreWolf.appdata.xml.in @@ -1,7 +1,7 @@ io.gitlab.LibreWolf - io.gitlab.LibreWolf + io.gitlab.LibreWolf.desktop LibreWolf LibreWolf Web Browser CC0-1.0 diff --git a/flatpak/build_flatpak.sh b/flatpak/build_flatpak.sh index cc297e6..4fe57d8 100755 --- a/flatpak/build_flatpak.sh +++ b/flatpak/build_flatpak.sh @@ -10,7 +10,7 @@ FLATPAK_REPO=$2; FLATPAK_BUNDLE=$3; _SCRIPT_FOLDER=$(realpath $(dirname $0)); _FLATHUB_REPO="flathub https://flathub.org/repo/flathub.flatpakrepo"; -_FLATHUB_PACKAGES_TO_INSTALL="org.gnome.Platform/${CARCH}/3.36 org.gnome.Sdk/${CARCH}/3.36"; +_FLATHUB_PACKAGES_TO_INSTALL="org.gnome.Platform/${CARCH}/3.36 org.gnome.Sdk/${CARCH}/3.36 org.freedesktop.Platform//19.08 org.freedesktop.Sdk//19.08"; _EXTRACTED_BINARY_TARBALL_FOLDER=$_SCRIPT_FOLDER/librewolf _FLATPAK_JSON_FILE=$_SCRIPT_FOLDER/content/io.gitlab.LibreWolf.json; _FLATPAK_BUILD_SOURCE_FOLDER=$_SCRIPT_FOLDER/source; @@ -50,16 +50,17 @@ mv $_EXTRACTED_BINARY_TARBALL_FOLDER $_FLATPAK_BUILD_SOURCE_FOLDER; # Build Repo printf "\nBuilding flatpak repository\n"; cp "$_FLATPAK_JSON_FILE" ./; -flatpak-builder --disable-rofiles-fuse --repo="$FLATPAK_REPO" "$_FLATPAK_BUILD_FOLDER" io.gitlab.LibreWolf.json; # add appstream metadata -# TODO: firefox uses files/share/appdata/ in their flatpak, but https://docs.flatpak.org/en/latest/conventions.html says otherwise. which is "more" correct? -install -Dvm644 "$_FLATPAK_BUILD_SOURCE_FOLDER/librewolf/io.gitlab.LibreWolf.appdata.xml" "$_FLATPAK_BUILD_FOLDER/files/share/metainfo/io.gitlab.LibreWolf.appdata.xml" +# TODO: firefox uses files/share/appdata/ in their flatpak, but https://docs.flatpak.org/en/latest/conventions.html says otherwise. which is "more" correct? => using both for now, just in case... +install -Dvm644 "$_FLATPAK_BUILD_SOURCE_FOLDER/librewolf/io.gitlab.LibreWolf.appdata.xml" "$_SCRIPT_FOLDER/source/share/metainfo/io.gitlab.LibreWolf.appdata.xml" +install -Dvm644 "$_FLATPAK_BUILD_SOURCE_FOLDER/librewolf/io.gitlab.LibreWolf.appdata.xml" "$_SCRIPT_FOLDER/source/share/appdata/LibreWolf.appdata.xml" + +install -Dvm644 "$_SCRIPT_FOLDER/content/io.gitlab.LibreWolf.desktop" "$_SCRIPT_FOLDER/source/share/applications/LibreWolf.desktop" -# add .desktop file -install -Dvm644 "$_SCRIPT_FOLDER/content/librewolf.desktop" "$_FLATPAK_BUILD_FOLDER/files/share/application/librewolf.desktop" -# it's not clear if the above is sufficient; follow what mozilla does -install -Dvm644 "$_SCRIPT_FOLDER/content/librewolf.desktop" "$_FLATPAK_BUILD_FOLDER/export/share/application/librewolf.desktop" +install -Dvm644 "$_FLATPAK_BUILD_SOURCE_FOLDER/librewolf/browser/chrome/icons/default/default128.png" "$_SCRIPT_FOLDER/source/share/icons/hicolor/128x128/apps/io.gitlab.LibreWolf.png" + +flatpak-builder --disable-rofiles-fuse --repo="$FLATPAK_REPO" "$_FLATPAK_BUILD_FOLDER" io.gitlab.LibreWolf.json; # Build bundle printf "\nBuilding flatpak bundle\n"; diff --git a/flatpak/content/io.gitlab.LibreWolf.desktop b/flatpak/content/io.gitlab.LibreWolf.desktop new file mode 100644 index 0000000..d55cf7d --- /dev/null +++ b/flatpak/content/io.gitlab.LibreWolf.desktop @@ -0,0 +1,25 @@ +[Desktop Entry] +Name=LibreWolf +Exec=librewolf %u +Icon=io.gitlab.LibreWolf +Type=Application +MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json; +StartupWMClass=LibreWolf +Categories=Network;WebBrowser; +StartupNotify=true +Terminal=false +X-MultipleArgs=false +Keywords=Internet;WWW;Browser;Web;Explorer; +Actions=new-window;new-private-window;profilemanager; + +[Desktop Action new-window] +Name=Open a New Window +Exec=librewolf %u + +[Desktop Action new-private-window] +Name=Open a New Private Window +Exec=librewolf --private-window %u + +[Desktop Action profilemanager] +Name=Open the Profile Manager +Exec=librewolf --ProfileManager %u diff --git a/flatpak/content/io.gitlab.LibreWolf.json b/flatpak/content/io.gitlab.LibreWolf.json index 4bd5bbd..2392b32 100644 --- a/flatpak/content/io.gitlab.LibreWolf.json +++ b/flatpak/content/io.gitlab.LibreWolf.json @@ -4,6 +4,9 @@ "runtime-version": "3.36", "sdk": "org.gnome.Sdk", "command": "librewolf", + "rename-desktop-file": "LibreWolf.desktop", + "rename-appdata-file": "LibreWolf.appdata.xml", + "rename-icon": "io.gitlab.LibreWolf", "modules": [ "flatpak/content/shared-modules/dbus-glib/dbus-glib-0.110.json", { @@ -11,6 +14,10 @@ "buildsystem": "simple", "build-commands": [ "mkdir -p /app/share && mv librewolf -t /app/share", + "mv share/appdata /app/share", + "mv share/applications /app/share", + "mv share/icons /app/share", + "mv share/metainfo /app/share", "mkdir -p /app/bin && ln -s /app/share/librewolf/librewolf /app/bin/" ], "sources": [ @@ -23,20 +30,23 @@ ], "finish-args": [ "--share=ipc", - "--socket=x11", + "--socket=wayland", + "--socket=fallback-x11", "--socket=pcsc", "--socket=pulseaudio", "--persist=.librewolf", "--persist=.mozilla", "--filesystem=xdg-download:rw", - "--device=all", + "--device=dri", + "--filesystem=~/.config/dconf:ro", + "--env=DCONF_USER_CONFIG_DIR=.config/dconf", "--talk-name=org.freedesktop.FileManager1", "--system-talk-name=org.freedesktop.NetworkManager", "--talk-name=org.a11y.Bus", "--talk-name=org.gnome.SessionManager", "--talk-name=org.freedesktop.ScreenSaver", "--talk-name=org.gtk.vfs.*", - "--socket=wayland", + "--socket=session-bus", "--share=network" ] } diff --git a/flatpak/content/librewolf.desktop b/flatpak/content/librewolf.desktop deleted file mode 100644 index c6d6de1..0000000 --- a/flatpak/content/librewolf.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Name=LibreWolf -Exec=librewolf %u -Icon=librewolf -Type=Application -MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json; -StartupWMClass=LibreWolf -Categories=Network;WebBrowser; -StartupNotify=true -Terminal=false -X-MultipleArgs=false -Keywords=Internet;WWW;Browser;Web;Explorer -- cgit