-
Notifications
You must be signed in to change notification settings - Fork 6
/
gnome_appearance.sh
executable file
·109 lines (92 loc) · 2.9 KB
/
gnome_appearance.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Script to configure the theme in gnome.
# Originally developed in Gnome Shell 3.38.1.
# MIT License - Copyright (c) 2021 Nicolás Castellán <[email protected]>
# SPDX License identifier: MIT
# THE SOFTWARE IS PROVIDED "AS IS"
# Read the included LICENSE file for more information
# TODO: Configure your theme
# Add this folder structure to the root of this repository to auto-configure your theme.
# There can only be one file in each subfolder of 'themes'
# script's location
# └── themes
# ├── background
# │ └── image.png
# ├── cursor
# │ └── cursor.tar.gz
# ├── icons
# │ └── icons.tar.gz
# └── theme
# └── theme.tar.gz
# Git will ignore the themes folder.
# The script assumes the archives' basenames (before '.tar.{xz,gz}') are the names of the themes.
cd "$(dirname "$0")"
location="$(pwd)"
if [ ! -d "$location/themes" ]; then
exit 1
fi
echo "Decompressing user themes..."
pushd . >/dev/null
cursor_name=""
if [ -d "$location/themes/cursor" ]; then
cd "$location/themes/cursor"
f="$(ls)"
mkdir -p ~/.local/share/icons
tar -C ~/.local/share/icons -xf "$f"
cursor_name="${f/.tar.*/}"
fi
unset f
icons_name=""
if [ -d "$location/themes/icons" ]; then
cd "$location/themes/icons"
f="$(ls)"
mkdir -p ~/.local/share/icons
tar -C ~/.local/share/icons -xf "$f"
icons_name="${f/.tar.*/}"
fi
unset f
theme_name=""
if [ -d "$location/themes/theme" ]; then
cd "$location/themes/theme"
f="$(ls)"
mkdir -p ~/.local/share/themes
tar -C ~/.local/share/themes -xf "$f"
theme_name="${f/.tar.*/}"
fi
unset f
popd >/dev/null
# Enable user-themes extensions.
echo "Enabling user themes..."
EXT=$(gnome-extensions list | grep user-theme)
gnome-extensions enable $EXT
if [ "$theme_name" ]; then
# Enabling shell theme.
echo "Configuring shell theme..."
gsettings set org.gnome.shell.extensions.user-theme name "$theme_name"
# Enabling application theme.
echo "Configuring application theme..."
gsettings set org.gnome.desktop.wm.preferences theme "$theme_name"
gsettings set org.gnome.desktop.interface gtk-theme "$theme_name"
fi
if [ "$cursor_name" ]; then
# Setting cursor theme.
echo "Configuring cursor theme..."
gsettings set org.gnome.desktop.interface cursor-theme "$cursor_name"
fi
if [ "$icons_name" ]; then
# Setting icons theme.
echo "Configuring icons theme..."
gsettings set org.gnome.desktop.interface icon-theme "$icons_name"
fi
# Configuring background
bk="$(ls "$location/themes/background" | grep -e '\.png$' -e '\.jpg$')"
if [ "$bk" ]; then
destination="$HOME/.local/share/backgrounds"
echo "Configuring background..."
DATE="$(date +"%Y-%m-%d-%H-%M-%S")"
mkdir -p "$destination"
cp "$location/themes/background/$bk" "$destination/$DATE-$bk"
gsettings set org.gnome.desktop.background picture-uri "file://$destination/$DATE-$bk"
unset destination
fi
# Thanks for downloading, and enjoy!