This commit is contained in:
vinceliuice 2020-12-27 21:08:44 +08:00
parent cd4b47cecd
commit 1c26ca64e6
2 changed files with 50 additions and 57 deletions

View file

@ -46,9 +46,9 @@ Usage: `./install.sh` **[OPTIONS...]**
|-c, --color | Specify theme color variant(s) **[light/dark]** (Default: All variants)| |-c, --color | Specify theme color variant(s) **[light/dark]** (Default: All variants)|
|-o, --opacity | Specify theme opacity variant(s) **[standard/solid]** (Default: All variants)| |-o, --opacity | Specify theme opacity variant(s) **[standard/solid]** (Default: All variants)|
|-a, --alt | Specify titlebutton variant(s) **[standard/alt]** (Default: All variants)| |-a, --alt | Specify titlebutton variant(s) **[standard/alt]** (Default: All variants)|
|-t, --theme | Run a terminal dialog to change the theme accent color (Default: blue)| |-t, --theme | Change the theme color **[blue/purple/pink/red/orange/yellow/green/grey]** (Default: MacOS blue)|
|-p, --panel | Run a terminal dialog to change the panel transparency (Default: 85%)| |-p, --panel | Change the panel transparency **[80%/75%/70%/65%/60%/55%/50%/45%/40%/35%]** (Default: 85%)|
|-s, --size | Run a terminal dialog to change the nautilus sidebar width size (Default: 200px)| |-s, --size | Change the nautilus sidebar width size **[220px/240px/260px/280px]** (Default: 200px)|
|-i, --icon | Activities icon variant(s) **[standard/normal/gnome/ubuntu/arch/manjaro/fedora/debian/void]** (Default: standard variant)| |-i, --icon | Activities icon variant(s) **[standard/normal/gnome/ubuntu/arch/manjaro/fedora/debian/void]** (Default: standard variant)|
|-g, --gdm | Install GDM theme, you should run this with sudo!| |-g, --gdm | Install GDM theme, you should run this with sudo!|
|-r, --remove | Remove theme, this will remove all installed themes!| |-r, --remove | Remove theme, this will remove all installed themes!|
@ -56,9 +56,11 @@ Usage: `./install.sh` **[OPTIONS...]**
### <p align="center" > 1. Change theme accent color </p> ### <p align="center" > 1. Change theme accent color </p>
If you want to change theme accent! (Default color is blue) If you want to change theme accent! (Default color is blue)
then you can run: (`dialog` is required, install it first!) then you can run:
```bash ```bash
./install.sh -t ./install.sh -t # With no color options will run a terminal dialog to install it
./install.sh -t green # Install green accent color version
``` ```
![1](pictures/install-tip-01.png) ![1](pictures/install-tip-01.png)
@ -75,11 +77,13 @@ sudo ./install.sh -g -r # remove installed GDM theme
![2](pictures/install-tip-02.png) ![2](pictures/install-tip-02.png)
### <p align="center" > 3. Change nautilus sidebar width size </p> ### <p align="center" > 3. Change nautilus sidebar width size </p>
If you want to change nautilus sidebar width size! (Default size is 180px) If you want to change nautilus sidebar width size! (Default size is 200px)
(Nautilus cannot change the structure of the sidebar, so I added a picture as a background to achieve the effect of bigsur) (Nautilus cannot change the structure of the sidebar, so I added a picture as a background to achieve the effect of bigsur)
then you can run: (`dialog` is required, install it first!) then you can run:
```bash ```bash
./install.sh -s ./install.sh -s # With no size options will run a terminal dialog to install it
./install.sh -s 260px # Install 260px width version
``` ```
![3](pictures/install-tip-03.png) ![3](pictures/install-tip-03.png)

View file

@ -67,15 +67,15 @@ usage() {
printf "\n%s\n" "OPTIONS:" printf "\n%s\n" "OPTIONS:"
printf " %-25s%s\n" "-d, --dest DIR" "Specify theme destination directory (Default: ${DEST_DIR})" printf " %-25s%s\n" "-d, --dest DIR" "Specify theme destination directory (Default: ${DEST_DIR})"
printf " %-25s%s\n" "-n, --name NAME" "Specify theme name (Default: ${THEME_NAME})" printf " %-25s%s\n" "-n, --name NAME" "Specify theme name (Default: ${THEME_NAME})"
printf " %-25s%s\n" "-o, --opacity VARIANTS" "Specify theme opacity variant(s) [standard|solid] (Default: All variants)"
printf " %-25s%s\n" "-c, --color VARIANTS" "Specify theme color variant(s) [light|dark] (Default: All variants)"
printf " %-25s%s\n" "-t, --theme VARIANTS" "Run a dialog to change the theme color (Default: blue)"
printf " %-25s%s\n" "-a, --alt VARIANTS" "Specify theme titlebutton variant(s) [standard|alt] (Default: All variants)"
printf " %-25s%s\n" "-p, --panel VARIANTS" "Run a dialog to change the panel transparency (Default: 85%)"
printf " %-25s%s\n" "-s, --size VARIANTS" "Run a dialog to change the nautilus sidebar width size (Default: 200px)"
printf " %-25s%s\n" "-i, --icon VARIANTS" "Specify activities icon variant(s) for gnome-shell [standard|normal|gnome|ubuntu|arch|manjaro|fedora|debian|void] (Default: standard variant)"
printf " %-25s%s\n" "-g, --gdm" "Install GDM theme, this option needs root user authority! Please run this with sudo" printf " %-25s%s\n" "-g, --gdm" "Install GDM theme, this option needs root user authority! Please run this with sudo"
printf " %-25s%s\n" "-r, --remove" "Remove theme, remove all installed themes" printf " %-25s%s\n" "-r, --remove" "Remove theme, remove all installed themes"
printf " %-25s%s\n" "-o, --opacity VARIANTS" "Specify theme opacity variant(s) [standard|solid] (Default: All variants)"
printf " %-25s%s\n" "-c, --color VARIANTS" "Specify theme color variant(s) [light|dark] (Default: All variants)"
printf " %-25s%s\n" "-a, --alt VARIANTS" "Specify theme titlebutton variant(s) [standard|alt] (Default: All variants)"
printf " %-25s%s\n" "-t, --theme VARIANTS" "Change the theme color [blue|purple|pink|red|orange|yellow|green|grey] (Default: MacOS blue)"
printf " %-25s%s\n" "-p, --panel VARIANTS" "Change the panel transparency [80%|75%|70%|65%|60%|55%|50%|45%|40%|35%] (Default: 85%)"
printf " %-25s%s\n" "-s, --size VARIANTS" "Change the nautilus sidebar width size [220px|240px|260px|280px] (Default: 200px)"
printf " %-25s%s\n" "-i, --icon VARIANTS" "Change gnome-shell activities icon [standard|normal|gnome|ubuntu|arch|manjaro|fedora|debian|void] (Default: standard)"
printf " %-25s%s\n" "-h, --help" "Show this help" printf " %-25s%s\n" "-h, --help" "Show this help"
} }
@ -175,8 +175,30 @@ install() {
cp -r ${SRC_DIR}/other/plank/theme${color}/*.theme ${THEME_DIR}/plank cp -r ${SRC_DIR}/other/plank/theme${color}/*.theme ${THEME_DIR}/plank
} }
# Backup and install files related to GDM theme
install_theme() {
for color in "${colors[@]-${COLOR_VARIANTS[@]}}"; do
for opacity in "${opacities[@]-${OPACITY_VARIANTS[@]}}"; do
for alt in "${alts[@]-${ALT_VARIANTS[@]}}"; do
for icon in "${icons[@]-${ICON_VARIANTS[0]}}"; do
install "${dest:-${DEST_DIR}}" "${name:-${THEME_NAME}}" "${color}" "${opacity}" "${alt}" "${icon}"
done
done
done
done
}
remove_theme() {
for color in "${colors[@]-${COLOR_VARIANTS[@]}}"; do
for opacity in "${opacities[@]-${OPACITY_VARIANTS[@]}}"; do
for alt in "${alts[@]-${ALT_VARIANTS[@]}}"; do
[[ -d "${DEST_DIR}/${THEME_NAME}${color}${opacity}${alt}" ]] && rm -rf "${DEST_DIR}/${THEME_NAME}${color}${opacity}${alt}"
done
done
done
}
# Backup and install files related to GDM theme
GS_THEME_FILE="/usr/share/gnome-shell/gnome-shell-theme.gresource" GS_THEME_FILE="/usr/share/gnome-shell/gnome-shell-theme.gresource"
SHELL_THEME_FOLDER="/usr/share/gnome-shell/theme" SHELL_THEME_FOLDER="/usr/share/gnome-shell/theme"
ETC_THEME_FOLDER="/etc/alternatives" ETC_THEME_FOLDER="/etc/alternatives"
@ -234,36 +256,9 @@ install_gdm() {
[[ -d "$UBUNTU_MODES_FOLDER" ]] && cp -an "$UBUNTU_MODES_FOLDER" "$UBUNTU_MODES_FOLDER"-bak [[ -d "$UBUNTU_MODES_FOLDER" ]] && cp -an "$UBUNTU_MODES_FOLDER" "$UBUNTU_MODES_FOLDER"-bak
[[ -f "$UBUNTU_JSON_FILE" ]] && sed -i "s|Yaru/gnome-shell.css|gnome-shell.css|" "$UBUNTU_JSON_FILE" [[ -f "$UBUNTU_JSON_FILE" ]] && sed -i "s|Yaru/gnome-shell.css|gnome-shell.css|" "$UBUNTU_JSON_FILE"
[[ -f "$YURA_JSON_FILE" ]] && sed -i "s|Yaru/gnome-shell.css|gnome-shell.css|" "$YURA_JSON_FILE" [[ -f "$YURA_JSON_FILE" ]] && sed -i "s|Yaru/gnome-shell.css|gnome-shell.css|" "$YURA_JSON_FILE"
# cp -an "$ETC_NEW_THEME_FILE" "$ETC_NEW_THEME_FILE.bak"
# [[ -d "$SHELL_THEME_FOLDER/$THEME_NAME" ]] && rm -rf "$SHELL_THEME_FOLDER/$THEME_NAME" && mkdir -p "$SHELL_THEME_FOLDER/$THEME_NAME"
# cp -r "$GS_THEME_FILE" "$SHELL_THEME_FOLDER/$THEME_NAME"
# cd "$ETC_THEME_FOLDER"
# [[ -f "$ETC_NEW_THEME_FILE.bak" ]] && ln -sf "$SHELL_THEME_FOLDER/$THEME_NAME/gnome-shell-theme.gresource" gdm3-theme.gresource
fi fi
} }
install_theme() {
for color in "${colors[@]-${COLOR_VARIANTS[@]}}"; do
for opacity in "${opacities[@]-${OPACITY_VARIANTS[@]}}"; do
for alt in "${alts[@]-${ALT_VARIANTS[@]}}"; do
for icon in "${icons[@]-${ICON_VARIANTS[0]}}"; do
install "${dest:-${DEST_DIR}}" "${name:-${THEME_NAME}}" "${color}" "${opacity}" "${alt}" "${icon}"
done
done
done
done
}
remove_theme() {
for color in "${colors[@]-${COLOR_VARIANTS[@]}}"; do
for opacity in "${opacities[@]-${OPACITY_VARIANTS[@]}}"; do
for alt in "${alts[@]-${ALT_VARIANTS[@]}}"; do
[[ -d "${DEST_DIR}/${THEME_NAME}${color}${opacity}${alt}" ]] && rm -rf "${DEST_DIR}/${THEME_NAME}${color}${opacity}${alt}"
done
done
done
}
revert_gdm() { revert_gdm() {
if [[ -f "$GS_THEME_FILE.bak" ]]; then if [[ -f "$GS_THEME_FILE.bak" ]]; then
prompt -w "Reverting '$GS_THEME_FILE'..." prompt -w "Reverting '$GS_THEME_FILE'..."
@ -294,12 +289,6 @@ revert_gdm() {
fi fi
# > Ubuntu 20.04 # > Ubuntu 20.04
# if [[ -f "$ETC_NEW_THEME_FILE.bak" ]]; then
# prompt -w "reverting Ubuntu GDM theme..."
# rm -rf "$ETC_NEW_THEME_FILE"
# mv "$ETC_NEW_THEME_FILE.bak" "$ETC_NEW_THEME_FILE"
# [[ -d $SHELL_THEME_FOLDER/$THEME_NAME ]] && rm -rf $SHELL_THEME_FOLDER/$THEME_NAME
# fi
if [[ -f "$UBUNTU_YARU_THEME_FILE.bak" ]]; then if [[ -f "$UBUNTU_YARU_THEME_FILE.bak" ]]; then
prompt -w "reverting Ubuntu GDM theme..." prompt -w "reverting Ubuntu GDM theme..."
rm -rf "$UBUNTU_YARU_THEME_FILE" rm -rf "$UBUNTU_YARU_THEME_FILE"
@ -329,9 +318,9 @@ sidebar_dialog() {
if [[ -x /usr/bin/dialog ]]; then if [[ -x /usr/bin/dialog ]]; then
tui=$(dialog --backtitle "${THEME_NAME} gtk theme installer" \ tui=$(dialog --backtitle "${THEME_NAME} gtk theme installer" \
--radiolist "Choose your nautilus sidebar size (default is 200px width):" 15 40 5 \ --radiolist "Choose your nautilus sidebar size (default is 200px width):" 15 40 5 \
1 "220px" on \ 1 "220px" on \
2 "240px" off \ 2 "240px" off \
3 "260px" off \ 3 "260px" off \
4 "280px" off --output-fd 1 ) 4 "280px" off --output-fd 1 )
case "$tui" in case "$tui" in
1) sidebar_size="220px" ;; 1) sidebar_size="220px" ;;
@ -386,14 +375,14 @@ theme_dialog() {
if [[ -x /usr/bin/dialog ]]; then if [[ -x /usr/bin/dialog ]]; then
tui=$(dialog --backtitle "${THEME_NAME} gtk theme installer" \ tui=$(dialog --backtitle "${THEME_NAME} gtk theme installer" \
--radiolist "Choose your theme color (default is Mac Blue):" 20 50 10 \ --radiolist "Choose your theme color (default is Mac Blue):" 20 50 10 \
1 "Blue" on \ 1 "Blue" on \
2 "Purple" off \ 2 "Purple" off \
3 "Pink" off \ 3 "Pink" off \
4 "Red" off \ 4 "Red" off \
5 "Orange" off \ 5 "Orange" off \
6 "Yellow" off \ 6 "Yellow" off \
7 "Green" off \ 7 "Green" off \
8 "Grey" off --output-fd 1 ) 8 "Grey" off --output-fd 1 )
case "$tui" in case "$tui" in
1) theme_color="#2E7CF7" ;; 1) theme_color="#2E7CF7" ;;
2) theme_color="#9A57A3" ;; 2) theme_color="#9A57A3" ;;