1
opensuse-setup/scripts/themer

59 lines
2.1 KiB
Plaintext
Raw Normal View History

2023-05-30 22:07:01 +00:00
#!/bin/bash
################################################################################
#
# themer
# Installs/updates unofficial libadwaita themes for various programs
#
################################################################################
########################################
# Install adw-gtk3 for legacy GTK3 applications
2023-06-01 15:03:10 +00:00
echo
echo "*** Installing adw-gtk3 theme for GTK3 applications... ***"
echo
2023-05-30 22:07:01 +00:00
# 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
2023-06-02 12:50:30 +00:00
mkdir -p ${HOME}/.local/share/themes
tar xf /tmp/adw-gtk3.tar -C ${HOME}/.local/share/themes/
2023-05-30 22:07:01 +00:00
# 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"
2023-05-30 22:07:01 +00:00
# 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
2023-06-01 15:03:10 +00:00
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
)
2023-05-30 22:07:01 +00:00
# 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