~mozillateam/firefox/firefox.lunar

« back to all changes in this revision

Viewing changes to firefox

  • Committer: Sebastien Bacher
  • Date: 2023-12-21 14:11:23 UTC
  • Revision ID: seb128@ubuntu.com-20231221141123-l2mf1ytupjevdt3z
Replace the vcs content with a reference to the new repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
if ! [ -x /snap/bin/firefox ]; then
3
 
    echo "" >&2
4
 
    echo "Command '$0' requires the firefox snap to be installed." >&2
5
 
    echo "Please install it with:" >&2
6
 
    echo "" >&2
7
 
    echo "snap install firefox" >&2
8
 
    echo "" >&2
9
 
    exit 1
10
 
fi
11
 
 
12
 
if [ "$(xdg-settings get default-web-browser)" = "firefox.desktop" ]; then
13
 
  xdg-settings set default-web-browser firefox_firefox.desktop
14
 
fi
15
 
 
16
 
# GNOME Shell
17
 
OLD="firefox.desktop"
18
 
NEW="firefox_firefox.desktop"
19
 
FAVS=$(gsettings get org.gnome.shell favorite-apps 2> /dev/null)
20
 
if echo "$FAVS" | grep -q "'$OLD'"; then
21
 
  NEWFAVS=$(echo $FAVS | sed -e "s#'$OLD'#'$NEW'#")
22
 
  gsettings set org.gnome.shell favorite-apps "$NEWFAVS"
23
 
fi
24
 
 
25
 
# Unity
26
 
OLD="application://firefox.desktop"
27
 
NEW="application://firefox_firefox.desktop"
28
 
FAVS=$(gsettings get com.canonical.Unity.Launcher favorites 2> /dev/null)
29
 
if echo "$FAVS" | grep -q "'$OLD'"; then
30
 
  NEWFAVS=$(echo $FAVS | sed -e "s#'$OLD'#'$NEW'#")
31
 
  gsettings set com.canonical.Unity.Launcher favorites "$NEWFAVS"
32
 
fi
33
 
 
34
 
# MATE
35
 
OLD="/usr/share/applications/firefox.desktop"
36
 
NEW="/var/lib/snapd/desktop/applications/firefox_firefox.desktop"
37
 
OBJECTS=$(gsettings get org.mate.panel object-id-list 2> /dev/null)
38
 
for object in $OBJECTS; do
39
 
  object=$(echo $object | cut -d\' -f2)
40
 
  launcher=$(gsettings get org.mate.panel.object:/org/mate/panel/objects/$object/ launcher-location)
41
 
  if [ "$launcher" = "'$OLD'" ]; then
42
 
    gsettings set org.mate.panel.object:/org/mate/panel/objects/$object/ launcher-location "'$NEW'"
43
 
  fi
44
 
done
45
 
 
46
 
# KDE Plasma
47
 
OLD="applications:firefox.desktop"
48
 
NEW="applications:firefox_firefox.desktop"
49
 
if which qdbus > /dev/null; then
50
 
  SCRIPT="$(cat <<-EOF
51
 
    for (var i = 0; i < panelIds.length; ++i) {
52
 
      var panel = panelById(panelIds[i]);
53
 
      var widgets = panel.widgets();
54
 
      for (var j = 0; j < widgets.length; ++j) {
55
 
        var widget = widgets[j];
56
 
        if (widget.type == "org.kde.plasma.taskmanager") {
57
 
          widget.currentConfigGroup = "General";
58
 
          var launchers = widget.readConfig("launchers");
59
 
          if (launchers.includes("$OLD")) {
60
 
            widget.writeConfig("launchers", launchers.replace(/$OLD/g, "$NEW"));
61
 
          }
62
 
        }
63
 
      }
64
 
    }
65
 
EOF
66
 
  )"
67
 
  qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "$SCRIPT" 2> /dev/null
68
 
fi
69
 
 
70
 
# TODO: handle other desktop environments
71
 
 
72
 
exec /snap/bin/firefox "$@"