Skip to content

Instantly share code, notes, and snippets.

@alexdelorenzo
Last active April 10, 2022 02:28
Show Gist options
  • Save alexdelorenzo/041f1d28df63419527bd189390a0595a to your computer and use it in GitHub Desktop.
Save alexdelorenzo/041f1d28df63419527bd189390a0595a to your computer and use it in GitHub Desktop.
Install Firefox with Global Menu patches on Ubuntu derived Linux distributions. https://alexdelorenzo.dev/notes/firefox-global-menu
#!/usr/bin/env bash
# Copyright 2022 Alex DeLorenzo. Licensed under the AGPLv3.
#
# This script requires Bash, byobu, curl, and pup. You can find the latter here:
# https://github.com/ericchiang/pup
# For more information, see https://alexdelorenzo.dev/notes/firefox-global-menu
#
# Usage:
# $ ./install_ff.sh amd64
readonly ARCH="${1:-amd64}"
readonly URL="https://packages.ubuntu.com/bionic/$ARCH/firefox/download"
readonly DEB_PATH="div#content > ul > li > a attr{href}"
readonly debUrl="$(curl -s "$URL" | pup "$DEB_PATH")"
readonly debFile="$(basename "$debUrl")"
# download if file does not exist
test -e "$debFile" || {
printf "Downloading %s\n" "$debUrl"
curl -O "$debUrl"
}
# get current and downloaded firefox versions
currVer="$(apt show firefox | grep Version | col2 | cut -d- -f1)"
downloadVer="$(dpkg -I "$debFile" | grep Version | col2 | cut -d- -f1)"
printf "Installed: %s\n" "$currVer"
printf "Downloaded: %s\n" "$downloadVer"
# check if installed version is different from downloaded version
test "$currVer" != "$downloadVer" && {
# install
sudo apt install ./"$debFile"
# hold version
sudo apt-mark hold firefox
}
@rbreaves
Copy link

rbreaves commented Nov 27, 2021

Some dependencies are needed.

sudo apt-get install byobu

Also install brew imo and do brew install pup to save the hassle of trying to get it up and running.

There is also an issue of the close, minimize and restore/maximize buttons disappearing with this fix as well.

@rbreaves
Copy link

Possible to work around this by customizing your toolbar and checkmarking show titlebar or maybe a more proper fix, but it involves editing the css of Firefox to bring back the normal buttons without the title bar.

https://www.reddit.com/r/kde/comments/nm1vub/comment/gzpj9x4/?utm_source=reddit&utm_medium=web2x&context=3

@alexdelorenzo
Copy link
Author

alexdelorenzo commented Dec 20, 2021

Thanks for the heads up about the byobu dependency, @rbreaves.

I haven't had problems with the sizes of the window buttons, but that might be because I'm using KWin and its default window decorations, and not Firefox's.

pup is packaged for Sid, as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment