1
dot-files/bin/themer

59 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
################################################################################
#
# themer
# Installs/updates unofficial libadwaita themes for various programs
#
################################################################################
########################################
# Install adw-gtk3 for legacy GTK3 applications
echo
echo "*** Installing adw-gtk3 theme for GTK3 applications... ***"
echo
# Download and install adw-gtk3
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/lassekongo83/adw-gtk3/releases/latest | grep browser_download_url | cut -d '"' -f 4)
wget "${DOWNLOAD_URL}" -O /tmp/adw-gtk3.tar
mkdir -p ${HOME}/.local/share/themes
tar xf /tmp/adw-gtk3.tar -C ${HOME}/.local/share/themes/
# Install adw-gtk3 for Flatpak applications
sudo flatpak install --noninteractive org.gtk.Gtk3theme.adw-gtk3 org.gtk.Gtk3theme.adw-gtk3-dark
# Apply adw-gtk3-dark theme to legacy applications
# (Using the dark variant here until GNOME re-adds per-application dark theme support for legacy apps)
gsettings set org.gnome.desktop.interface gtk-theme "adw-gtk3-dark"
# Ensure GTK2 applications still use regular Adwaita
echo 'include "/usr/share/themes/Adwaita/gtk-2.0/gtkrc"' > ${HOME}/.gtkrc-2.0
########################################
# Install Adwaita theme for Firefox
echo
echo "*** Installing Adwaita theme for Firefox... ***"
echo
# Download and install gnome-firefox-theme
rm -rf /tmp/firefox-gnome-theme/
git clone https://github.com/rafaelmardojai/firefox-gnome-theme.git /tmp/firefox-gnome-theme/
(
cd /tmp/firefox-gnome-theme/
git checkout v$(firefox --version | sed -nr 's/[^0-9]*([0-9]*).*/\1/p') # Making sure to use the appropriate version
bash ./scripts/auto-install.sh
)
# Set user flags for theme
function set_ff_flag ()
{
USER_JS_FILE=${HOME}/.mozilla/firefox/*.default-release/user.js
sed -i 's/user_pref("'${1}'",.*);/user_pref("'${1}'",'${2}');/' $USER_JS_FILE
grep -q ${1} $USER_JS_FILE || echo "user_pref(\"$1\",$2);" >> $USER_JS_FILE
}
set_ff_flag gnomeTheme.dragWindowHeaderbarButtons true
set_ff_flag gnomeTheme.bookmarksToolbarUnderTabs true
set_ff_flag gnomeTheme.hideSingleTab true