From 2a1d73af251bf4328c4a4f8229fba78f7dec1525 Mon Sep 17 00:00:00 2001 From: naturallaw77 Date: Sat, 15 Aug 2026 17:31:25 -0500 Subject: [PATCH] Migrate dock/folder/mime entries from brave to brave-origin on upgrade --- CHANGELOG.md | 5 ++++ modules/core/sovran_systemsos-desktop.nix | 29 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e9d4d8..94c11e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 favorite, Browsers app-folder entry, `xdg.mime.defaultApplications`, and the `$BROWSER` session variable now all point at Brave Origin, and the Sovran Hub launcher runs it. + - On installs upgrading from the old Brave package, the desktop theme init + now migrates `brave-browser.desktop` → `brave-origin.desktop` in the dock + favorites, the Browsers app folder, and the user's `mimeapps.list`, so + the dock icon and default-browser handler survive the switch without a + manual re-pin. ### Fixed - The Hub launcher now uses a persistent per-user browser profile diff --git a/modules/core/sovran_systemsos-desktop.nix b/modules/core/sovran_systemsos-desktop.nix index ad40f0f..117b3a6 100644 --- a/modules/core/sovran_systemsos-desktop.nix +++ b/modules/core/sovran_systemsos-desktop.nix @@ -44,6 +44,35 @@ let fi fi + # ── Brave Origin migration (existing installs upgrading from `brave`) ── + # The old package's brave-browser.desktop no longer exists, so GNOME drops + # it from the dock and the Browsers folder. Swap the id in place, but only + # when the stale value is still present (never touch user customizations). + if [ -f "$USER_DB" ]; then + FAVS="$(${pkgs.dconf}/bin/dconf read /org/gnome/shell/favorite-apps 2>/dev/null || true)" + if [ -n "$FAVS" ]; then + NEW_FAVS="''${FAVS//brave-browser.desktop/brave-origin.desktop}" + if [ "$NEW_FAVS" != "$FAVS" ]; then + ${pkgs.dconf}/bin/dconf write /org/gnome/shell/favorite-apps "$NEW_FAVS" + fi + fi + + BROWSER_APPS="$(${pkgs.dconf}/bin/dconf read /org/gnome/desktop/app-folders/folders/Browsers/apps 2>/dev/null || true)" + if [ -n "$BROWSER_APPS" ]; then + NEW_BROWSER_APPS="''${BROWSER_APPS//brave-browser.desktop/brave-origin.desktop}" + if [ "$NEW_BROWSER_APPS" != "$BROWSER_APPS" ]; then + ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/app-folders/folders/Browsers/apps "$NEW_BROWSER_APPS" + fi + fi + fi + + # A previous fresh install wrote the user's mimeapps.list with the old id; + # XDG gives it precedence over the new system-wide default, so rewrite it. + MIME_LIST="$HOME/.config/mimeapps.list" + if [ -f "$MIME_LIST" ] && ${pkgs.gnugrep}/bin/grep -q 'brave-browser\.desktop' "$MIME_LIST"; then + ${pkgs.gnused}/bin/sed -i 's/brave-browser\.desktop/brave-origin.desktop/g' "$MIME_LIST" + fi + # Already applied — skip if [ -f "$STAMP" ]; then exit 0