Skip to content

Commit

Permalink
Remove OS-specific code
Browse files Browse the repository at this point in the history
  • Loading branch information
tliron committed Feb 8, 2018
1 parent 28fcbe6 commit 563c39f
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 91 deletions.
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>install-gnome-themes</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
85 changes: 62 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,87 @@
Install GNOME Themes
====================

This script installs the latest GitHub versions of some fine [GNOME](https://www.gnome.org/) themes into the current user's `.themes` folder. Run the script again whenever you want to get the latest theme updates! Many of themes are constantly being updated with bugfixes and enhancements.
This script installs the latest GitHub versions of some fine [GNOME](https://www.gnome.org/) themes into the current user's `.themes` folder. Run the script again whenever you want to get the latest theme updates. Many of these themes are updated frequently with bugfixes and enhancements.

It supports GNOME versions 3.18 to 3.24, and will install the correct version according to your system. So if, for example, you upgrade from GNOME 3.18 to GNOME 3.20, you would want to run the script again. (GNOME 3.20 completely overhauled the theming system, so older themes are incompatible.)
It supports GNOME versions 3.18 and above, and will install the correct version according to your system. So if, for example, you upgrade from GNOME 3.18 to GNOME 3.20, you would want to run the script again. (GNOME 3.20 completely overhauled the theming system, so older themes are incompatible.)

All of these themes provide at least GTK+ theming (for both GTK+3 and GTK+2) and many also provide a shell theme. You are free to mix and match GTK+ themes with shell themes! Some themes also provide application theming (Firefox, Chrome, etc.) though you will have to install that separately. For Firefox, note that there is also a generic [GNOME 3 theme](https://addons.mozilla.org/en-US/firefox/addon/adwaita/) that might improve its appearance for some themes, though your mileage will vary.

To change your theme, run the GNOME Tweak Tool and go to the Appearance tab. You must also have the [User Themes extension](https://extensions.gnome.org/extension/19/user-themes/) enabled: it's usually bundled in most GNOME-based operating systems, but might not be enabled by default.
Basic Usage
-----------

To avoid rebuilding themes if there was no change, the script caches identifiers in the file `.install-gnome-themes-cache` in the current user's `.themes` folder. Delete it to force rebuilding all themes.
Get it:

git clone https://github.com/tliron/install-gnome-themes ~/install-gnome-themes

If you already have themes of the same names installed in your `.themes` folder, they will be deleted, so backup the folder first if you want to keep them. Other themes will _not_ be touched.

Note that building the latest version of some themes is heavy work, and thus this script installs some big dependencies (for example, SASS is used to compile CSS and InkScape is used to render images). That's the price of living on the cutting edge.
Run it:

~/install-gnome-themes/install-gnome-themes

To avoid rebuilding themes if there was no change, the script caches identifiers in the file `.install-gnome-themes-cache` in the current user's `.themes` folder. Delete it to force rebuilding all themes.

To change your theme, run the GNOME Tweak Tool and go to the Appearance tab.

Instructions
To update this script to its latest version:

git -C ~/install-gnome-themes pull


Requirements
------------

Ubuntu:
Building some of the themes is heavy work for (example, SASS is used to compile CSS and InkScape is used to render images) and thus this script requires some big requirements. That's the price of living on the cutting edge.

sudo apt install git
git clone https://github.com/tliron/install-gnome-themes ~/install-gnome-themes
~/install-gnome-themes/install-gnome-themes
Note: some operating systems come with the Numix theme pre-installed. We will remove it to avoid conflict with our more up-to-date version.

Debian world:

To update this script to the latest version:
sudo apt remove numix-gtk-theme
sudo apt install \
git autoconf automake pkg-config parallel sassc \
ruby ruby-bundler ruby-dev \
inkscape \
libgtk-3-dev libgdk-pixbuf2.0-dev libglib2.0-dev libglib2.0-bin \
libxml2-utils librsvg2-dev \
gnome-themes-standard gtk2-engines-murrine gtk2-engines-pixbuf \
fonts-roboto-hinted fonts-noto-hinted

cd ~/install-gnome-themes
git pull
Fedora world:

sudo dnf remove numix-gtk-theme numix-icon-theme numix-icon-theme-circle
sudo dnf install \
git autoconf automake parallel sassc \
ruby ruby-devel rubygem-bundler libffi-devel gcc redhat-rpm-config \
inkscape \
gtk3-devel gdk-pixbuf2-xlib glib2-devel glib2 \
libxml2-devel librsvg2-devel \
gnome-themes-standard gtk-murrine-engine gtk2-engines \
google-roboto-fonts google-noto-sans-fonts google-noto-mono-fonts

And you'll need SASS:

gem install --user-install sass

In case your operating system doesn't have a `sassc` package, you can build it manually:

export WORK=/tmp/install-gnome-themes
rm --recursive --force "$WORK/libsass" "$WORK/sassc"
mkdir --parents "$WORK"
cd "$WORK"
git clone https://github.com/sass/libsass.git --depth 1 libsass
git clone https://github.com/sass/sassc.git --depth 1 sassc
cd "$WORK/sassc"
SASS_LIBSASS_PATH="$WORK/libsass" make --jobs="$(nproc)"
sudo cp "$WORK/sassc/bin/sassc" /usr/bin/
rm --recursive --force "$WORK/libsass" "$WORK/sassc"


Supported Themes
----------------

All of these themes provide at least GTK+ theming (for both GTK+3 and GTK+2) and many also provide a shell theme. You are free to mix and match GTK+ themes with shell themes! Some themes also provide application theming (Firefox, Chrome, etc.) though you will have to install that separately. For Firefox, note that there is also a generic [GNOME 3 theme](https://addons.mozilla.org/en-US/firefox/addon/adwaita/) that might improve its appearance for some themes, though your mileage will vary.

* [Adapta](https://github.com/tista500/Adapta)
* [Adwaita Tweaks](https://github.com/Jazqa/adwaita-tweaks)
* [Ant](https://github.com/EliverLara/Ant)
Expand Down Expand Up @@ -70,12 +118,3 @@ Supported Themes
* [Vimix](https://github.com/vinceliuice/vimix-gtk-themes)
* [Yosembiance](https://github.com/bsundman/Yosembiance) (GNOME 3.18 only)
* [Zuki](https://github.com/lassekongo83/zuki-themes)


TODO
----

Please contribute with pull requests! Especially needed:

* Currently designed for Ubuntu/Debian, but should be modified for other free operating systems.

73 changes: 5 additions & 68 deletions install-gnome-themes
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@

set -e

#
# To skip installation of requirements:
#
# REQUIREMENTS=0 ./install-gnome-themes
#
# Build output is supressed by default. If you want to see it, set the LOG environment var:
#
Expand All @@ -30,7 +26,6 @@ set -e

HERE=$(dirname "$(readlink -f "$0")")
LOG=${LOG:-/dev/null}
REQUIREMENTS=${REQUIREMENTS:-1}
THEMES=~/.themes
CACHE_FILE=${CACHE_FILE:-$THEMES/.install-gnome-themes-cache}
WORK=/tmp/install-gnome-themes
Expand All @@ -50,11 +45,12 @@ else
message "Detected GNOME $GNOME_VERSION, GTK $GTK_VERSION."
fi

if [ "$GTK_VERSION" != '3.24' ] &&
if [ "$GTK_VERSION" != '3.26' ] &&
[ "$GTK_VERSION" != '3.24' ] &&
[ "$GTK_VERSION" != '3.22' ] &&
[ "$GTK_VERSION" != '3.20' ] &&
[ "$GTK_VERSION" != '3.18' ]; then
message "This script only GTK version 3.18 up to 3.24."
message "This script only GTK version 3.18 up to 3.26."
exit 1
fi

Expand All @@ -68,68 +64,9 @@ OS=$(os-name)

message "Detected $OS operating system."

if [ "$REQUIREMENTS" == 1 ]; then
message "Verifying that build requirements are installed..."

if [ "$OS" == 'Debian' ] ||
[ "$OS" == 'Ubuntu' ] ||
[ "$OS" == 'LinuxMint' ] ||
[ "$OS" == 'SPERIX-OS' ]; then
# Ubuntu GNOME comes with Numix (for 3.18) preinstalled, we will remove it to avoid confusion
sudo apt remove numix-gtk-theme
# Install our build and usage requirements
sudo apt install \
git autoconf automake pkg-config parallel \
libgtk-3-dev libgdk-pixbuf2.0-dev libglib2.0-dev libglib2.0-bin \
libxml2-utils librsvg2-dev \
gnome-themes-standard gtk2-engines-murrine gtk2-engines-pixbuf \
ruby ruby-bundler ruby-dev \
inkscape \
fonts-roboto-hinted fonts-noto-hinted
elif [ "$OS" == 'Fedora' ]; then
THEMES=$HOME/.local/share/themes
CACHE_FILE=$THEMES/.install-gnome-themes-cache
# Fedora Workstation comes with Numix (for 3.18) preinstalled, we will remove it to avoid confusion
sudo dnf remove numix-gtk-theme numix-icon-theme numix-icon-theme-circle || true
# Install our build and usage requirements
sudo dnf install \
git autoconf automake parallel \
gtk3-devel gdk-pixbuf2-xlib glib2-devel glib2\
libxml2-devel librsvg2-devel \
gnome-themes-standard gtk-murrine-engine \
ruby rubygem-bundler\
inkscape \
gtk2-engines \
google-roboto-fonts google-noto-sans-fonts google-noto-mono-fonts
else
message "This script currently only supports Debian, Ubuntu, LinuxMint, Fedora, SPERIX-OS" "$RED"
exit 1
fi

# sass is used by many themes to generate CSS
gem install --user-install sass
export PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
# sass is used by many themes to generate CSS
export PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"

# sassc is used specifically by Adapta
if [ ! -f /usr/bin/sassc ]; then
if apt show sassc &>> /dev/null; then
sudo apt install sassc
else
# Older versions of Ubuntu do not have sassc
echo "Building and installing sassc..."
rm --recursive --force "$WORK/libsass" "$WORK/sassc"
mkdir --parents "$WORK"
cd "$WORK"
git clone https://github.com/sass/libsass.git --depth 1 libsass &>> "$LOG"
git clone https://github.com/sass/sassc.git --depth 1 sassc &>> "$LOG"
cd "$WORK/sassc"
SASS_LIBSASS_PATH="$WORK/libsass" make --jobs="$(nproc)" &>> "$LOG"
sudo cp "$WORK/sassc/bin/sassc" /usr/bin/
rm --recursive --force "$WORK/libsass" "$WORK/sassc"
fi
fi
fi

mkdir --parents "$THEMES"

#
Expand Down
12 changes: 12 additions & 0 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ function gtk-version()
if [ -z "$VERSION" ]; then
VERSION=$(dpkg-version libgtk2.0-0)
fi
if [ -z "$VERSION" ]; then
VERSION=$(rpm-version gtk3)
fi
if [ -z "$VERSION" ]; then
VERSION=$(rpm-version gtk2)
fi
echo "$VERSION"
}

Expand All @@ -70,6 +76,12 @@ function dpkg-version()
dpkg -s "$PKG" 2>/dev/null | grep '^Version' | cut --delimiter=' ' --fields=2- | cut --delimiter='.' --fields=1,2
}

function rpm-version()
{
local PKG=$1
rpm --query --queryformat %{VERSION} "$PKG" 2>/dev/null | cut --delimiter='.' --fields=1,2
}

#
# Git Repositories
#
Expand Down

0 comments on commit 563c39f

Please sign in to comment.