Out of curiosity, since I managed to get Thunderbird to behave properly on a Fairphone 4... maybe it would be an idea to make a similar guide for Firefox web browser.
Step 1: Installing Firefox inside a Libertine container
For those of you newbies wondering how to get Firefox web browser working in desktop mode on Ubuntu Touch, this is one way that seems to work well. Firefox has so far crashed one time only.
This markup was written in nano and mousepad. Copy-paste functionality between windows seems to be non-existent between Firefox and other windows at the time of writing. The only way to copy this markup was to cat markdown-text.md in a terminal and manually copy the lines from terminal with right-click copy, and paste it in this forum.
I messed around with settings until I got something that would work in desktop mode for Fairphone 4 running channel 24.04/daily.
Installing Firefox as DEB
Install Libertine Tweak Tool from Openstore.
Activate lirsh command with Libertine Tweak Tool.
Open a terminal window and type:
lirsh
fakeroot
At this point it is possible to issue terminal commands:
install -d -m 0755 /etc/apt/keyrings
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | tee /etc/apt/preferences.d/mozilla
apt-get update
# If you want to update the whole Libertine container
apt-get upgrade --fix-missing
apt-cache policy firefox
apt-get install firefox
exit # jump out of fakeroot
firefox --version
# To install a different language pack, execute:
# lirsh
apt-cache search firefox-l10n
# to get the list of all available language packages.
#
# Install the language pack of your choice like:
fakeroot
apt-get install firefox-l10n-es-es # Spanish
# or
apt-get install firefox-l10n-de # German
# or
apt-get install firefox-l10n-fr # French
You may now see Firefox in Ubuntu Touch main menu, or not. One way to trigger a main menu update is to create an update or a .desktop file in one of the catalogues that Ubuntu Touch is monitoring. Try these lines one at a time, to see if the launcher appears, in a fresh terminal tab:
if [ -d /home/phablet/.local/share/icons/hicolor ]; then
touch /home/phablet/.local/share/icons/hicolor
else
mkdir -p /home/phablet/.local/share/icons/hicolor/scalable/apps
wget -O /home/phablet/.local/share/icons/hicolor/index.theme https://github.com/matthewbauer/appstream-generator/raw/refs/heads/master/data/hicolor-theme-index.theme
fi
A minimal index.theme can also be made like this:
cat <<EOF > /home/phablet/.local/share/icons/hicolor/index.theme
[Icon Theme]
Name=Hicolor
Comment=Ubuntu Touch fallback icon theme
Hidden=true
Directories=scalable/apps
[scalable/apps]
MinSize=1
Size=128
MaxSize=256
Context=Applications
Type=Scalable
EOF
If Firefox still does not show up in Ubuntu Touch main menu, you can try to make a change in folder /home/phablet/.local/share/applications:
cp -v /home/phablet/.cache/libertine-container/noble/rootfs/usr/share/applications/firefox.desktop /home/phablet/.local/share/applications/.
sleep 3
rm -v /home/phablet/.local/share/applications/firefox.desktop
Try hitting the "Super-key" (sometimes this key has four windows left of the space bar) and type firef which should be enough to make Firefox laucher visible.
Now you can test if terminal command launches something.
# lirsh
GDK_BACKEND=x11 firefox
On my Fairphone 4, the zoom factor is quite big. Let's try to lower the zoom.
One way to lower the zoom is to edit Libertine container noble file ~/.Xdefaults and adjust Xft.dpi: 120 from default value Xft.dpi: 197.
Exiting lirsh and re-entering lirsh should activate the new DPI setting.
Then re-launch firefox from command line and see if the zoom factor is better.
# lirsh
GDK_BACKEND=x11 firefox
Now the window looks a bit better with not such a large zoom factor in desktop mode.
The other way is to use a scaling factor directly before launching firefox.
Try this and see if the zoom factor is lower with standard setting Xft.dpi: 197.
# lirsh
GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox
Once the scaling is okay for your eyes you can create a firefox-launcher.
# lirsh
mkdir -p ~/.local/bin
echo "GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox" > ~/.local/bin/firefox-launcher
chmod +x ~/.local/bin/firefox-launcher
On my Fairphone 4, Libertine container noble folder ~/.local/bin
was not in my Libertine container variable $PATH:
# lirsh
echo $PATH
Editing Libertine container noble file ~/.bashrc should do the trick. The full path is:
/home/phablet/.cache/libertine-container/noble/rootfs/home/phablet/.bashrc
You can edit this file both from outside the Libertine container noble as well as from inside the Libertine container.
Added the following lines at the end of the Libertine container ~/.bashrc:
if [ -d ~/.local/bin ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
if [ -d ~/bin ]; then
export PATH="$HOME/bin:$PATH"
fi
Exiting lirsh and re-entering lirsh should activate the new setting.
exit # jump out of lirsh
lirsh
echo $PATH
firefox-launcher
This command should open firefox inside lirsh with desired zoom.
Step 2: Making a Firefox main menu item shortcut
Poking around with the settings, you may discover that there are actually two ways to launch Firefox once it is installed.
Launching Firefox from outside the Libertine container. This would require a separate launcher put in ~/.local/share/applications/firefox.desktop. User settings will be stored outside the Libertine container.
Launching from inside the Libertine container. This would require to edit the Libertine container's firefox.desktop file, which will sooner or later appear in Ubuntu Touch main menu. User settings will be stored inside the Libertine container.
For the purpose of illustration, I will do both approaches.
2a: Making a firefox.desktop outside Libertine container
It is not entierly clear to me what you have to do in order to trigger a main menu update after you have installed something in a Libertine container. Debian has a command update-menus which Ubuntu Touch does not have. Ususally, a reboot is the easiest way to update Ubuntu Touch main menu items. However, there should in theory be another way to refresh the main menu that is at this time unknown to me.
Now that this is working, let's try to create an Ubuntu Touch shortcut in the main menu. This can be done manually of course. In this example, I will piggy-back on what is already available.
Open another terminal tab (without lirsh environment).
mkdir -p ~/.local/share/applications
mkdir -p ~/.local/share/icons/hicolor/scalable/apps
wget -O ~/.local/share/icons/hicolor/scalable/apps/firefox.svg https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg
wget -O ~/.local/share/icons/hicolor/index.theme https://raw.githubusercontent.com/spk121/hicolor-icon-theme/refs/heads/master/index.theme
sed -i "s|^Comment=.*$|Comment=Ubuntu Touch Icon Theme|g" ~/.local/share/icons/hicolor/index.theme
echo "Update icon caches (maybe obsolete)"
touch ~/.local/share/icons/hicolor
update-icon-caches ~/.local/share/icons/hicolor
# or
touch ~/.local/share/icons/hicolor
gtk-update-icon-cache ~/.local/share/icons/hicolor
echo
echo "We can re-use the firefox.desktop file that is in the Libertine container"
cp -v /userdata/user-data/phablet/.cache/libertine-container/noble/rootfs/usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
echo
echo "Using scaling factor GDK_DPI_SCALE=1.2"
echo "to achieve similar scaling as with"
echo "Libertine container 'noble' GDK_DPI_SCALE=0.6"
sed -i "s|^Exec=.*$|Exec=bash -c \'GDK_DPI_SCALE=1.2 GDK_BACKEND=x11 /userdata/user-data/phablet/.cache/libertine-container/noble/rootfs/usr/bin/firefox\' %u|g" ~/.local/share/applications/firefox.desktop
echo
echo "Ubuntu Touch does not seem to find the firefox icon"
echo "by itself."
echo " Icon=firefox"
echo "Icon has to be specified exactly with path to show in main menu."
echo " Icon=/path/to/scalable/svg"
sed -i "s|^Icon=.*$|Icon=/home/phablet/.local/share/icons/hicolor/scalable/apps/firefox.svg|g" ~/.local/share/applications/firefox.desktop
echo
echo "Trigger main menu update"
mv ~/.local/share/applications/firefox.desktop ~/.local/share/applications/tmp.desktop
mv ~/.local/share/applications/tmp.desktop ~/.local/share/applications/firefox.desktop
echo
echo "You should now see Firefox"
echo "in Ubuntu Touch main menu."
echo
echo "Done."
Now there should be a visible "Firefox" launcher in Ubuntu Touch main menu.
Try hitting the "Super-key" (sometimes this key has four windows left of the space bar, sometimes it can have an apple design or command key) on your external wired PS-2 keyboard (or wireless keyboard) and type firef which should be enough to make Firefox laucher visible.
2b: Adjusting firefox.desktop inside Libertine container
Adjusting Libertine container firefox.desktop located at
/home/phablet/.cache/libertine-container/noble/rootfs/usr/share/applications/firefox.desktop
could be done manually with terminal command:
nano ~/.cache/libertine-container/noble/rootfs/usr/share/applications/firefox.desktop
You may also install mousepad in the Libertine container to get a graphical editor. However, copy-paste does not seem to work between windows.
There are four lines starting with Exec=:
Exec=firefox %u
Exec=firefox --new-window %u
Exec=firefox --private-window %u
Exec=firefox --ProfileManager
These four lines starting with Exec= need to be adjusted to something like:
Exec=bash -c "GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox %u"
Exec=bash -c "GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox --new-window %u"
Exec=bash -c "GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox --private-window %u"
Exec=bash -c 'GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox --ProfileManager'
This could be accomplished with using terminal command sed:
sed -i "s|^Exec=firefox %u$|Exec=bash -c \"GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox %u\"|g" /home/phablet/.cache/libertine-container/noble/rootfs/usr/share/applications/firefox.desktop
sed -i "s|^Exec=firefox --new-window %u$|Exec=bash -c \"GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox --new-window %u\"|g" /home/phablet/.cache/libertine-container/noble/rootfs/usr/share/applications/firefox.desktop
sed -i "s|^Exec=firefox --private-window %u$|Exec=bash -c \"GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox --private-window %u\"|g" /home/phablet/.cache/libertine-container/noble/rootfs/usr/share/applications/firefox.desktop
sed -i "s|^Exec=firefox --ProfileManager$|Exec=bash -c 'GDK_DPI_SCALE=0.6 GDK_BACKEND=x11 firefox --ProfileManager'|g" /home/phablet/.cache/libertine-container/noble/rootfs/usr/share/applications/firefox.desktop
Change the scaling factor GDK_DPI_SCALE to suit your eyes. Note that on my Fairphone 4 on channel 24.04/daily it seems to require a scaling factor less than 1.0 inside the Libertine container to scale things down. From outside the container, a scaling factor larger than 1.0 had to be used to scale things up.
Testing
If all went well, you should now be able to set up Firefox with any extensions you prefer.
Sample of extensions that seem to do what they are supposed to do to a great extent:
uBlock Origin
NoScript
Privacy Badger
Cookie Autodelete
I still don't care about cookies
Video DownloadHelper (not possible to select other video format than default). Remark: When opening a downloaded media clip with Thunar file manager, Lomiri crashed and closed all open apps.
Observations
The mouse pointer becomes huge when hovering Firefox. There should be a way to make the mouse pointer smaller.
Copy-paste does not work well. Not possible to copy and paste from Firefox to mousepad nor into nano. Clipboard looks full at the beginning and clicking on paste greys out clipboard while nothing is pasted.
https://duck.ai works (does not seem to work properly in Morph browser). However, you cannot copy-paste the answers.
Having Firefox browser open with several tabs at the same time uses 3.7Gi RAM memory, reports terminal command free -h.