Skip to content

Instantly share code, notes, and snippets.

@JChristensen
Last active November 4, 2023 19:31
Show Gist options
  • Save JChristensen/9ffc211d52a70d51e76bc0fa2b486c8c to your computer and use it in GitHub Desktop.
Save JChristensen/9ffc211d52a70d51e76bc0fa2b486c8c to your computer and use it in GitHub Desktop.
Bash script to create the userChrome.css file for Thunderbird v115 and restore the Menu Bar to its rightful place above the Unified Toolbar. Written for Linux Mint, should also work on Ubuntu and other Debian derivatives.
#!/bin/bash
# Create the userChrome.css file for Thunderbird to restore
# the Menu Bar to its rightful place above the Unified Toolbar.
# Run this script from the Thunderbird profile folder, usually something like
# ~/.thunderbird/xxxxxxxx.default/ or ~/.thunderbird/xxxxxxxx.default-release
# where "xxxxxxxx" is a random alphanumeric string.
# Thunderbird must not be running to use this script.
# From https://support.mozilla.org/en-US/questions/1422908, H/T to Toad-Hall.
# J.Christensen 04Oct2023
# check to see if thunderbird is running
running=$(ps h -C thunderbird)
status=$?
if (( status == 0 )); then
echo "It looks like Thunderbird is running."
echo "$running"
echo "Please exit Thunderbird before running this script!"
echo "Script aborted."
exit 1
fi
pwd=$(pwd)
echo "This script must be run from the Thunderbird profile directory."
echo "The current working directory is: $pwd"
# check to see if this looks like the right directory,
# ask the user if he wants to continue
re=".*/\.thunderbird/[[:alnum:]]{8}\.default(-release)?"
if [[ $pwd =~ $re ]]; then
echo "This looks OK."
read -p "Do you want to proceed? [Y/n] "
else
echo "This may not be a Thunderbird profile directory."
read -p "Do you want to proceed anyway? [Y/n] "
fi
# process the user's reply
r=${REPLY,,} # make reply lower case
if [[ "$r" =~ ^[[:space:]]*n ]]; then
echo "Script aborted."
exit 2
fi
dirname="chrome"
filename="$dirname/userChrome.css"
echo "Creating directory: $dirname"
mkdir $dirname
echo "Creating file: $filename"
cat << _EOF_ >$filename
@import url("chrome://messenger/content/unifiedtoolbar/unifiedToolbarWebextensions.css");
/* Position Menu Bar above Unified Toolbar */
#toolbar-menubar {
order: -1 !important;
}
_EOF_
echo "Script complete, thank you!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment