Add link gtk4.0 theme to config folder for libadwaita as a option

pull/202/head
vinceliuice 4 years ago
parent 6995a97ea0
commit b644a3560a

@ -28,32 +28,53 @@ Run the following commands in the terminal:
```
OPTIONS:
-d, --dest DIR Specify destination directory (Default: $HOME/.themes)
-d, --dest DIR Specify destination directory (Default: /home/vince/.themes)
-n, --name NAME Specify theme name (Default: Orchis)
-t, --theme VARIANT Specify theme color variant(s) [default|purple|pink|red|orange|yellow|green|grey|all] (Default: blue)
-c, --color VARIANT... Specify color variant(s) [standard|light|dark] (Default: All variants)s)
-c, --color VARIANT Specify color variant(s) [standard|light|dark] (Default: All variants)s)
-s, --size VARIANT Specify size variant [standard|compact] (Default: All variants)
-l, --libadwaita Link installed Orchis gtk-4.0 theme to config folder for all libadwaita app use Orchis theme
-r, --remove,
-u, --uninstall Uninstall/Remove installed themes
--tweaks Specify versions for tweaks [solid|compact|black|primary] (Options can mix)
1. solid: no transparency panel variant
2. compact: no floating panel variant
3. black: full black variant
4. primary: Change radio icon checked color to primary theme color (Default is Green)
--shell install gnome-shell version [38|40|42]
1. 38: gnome-shell version < 40.0
2. 40: gnome-shell version = 40.0
3. 42: gnome-shell version = 42.0
-h, --help Show help
```
> For more information, run: `./install.sh --help`
> For more information, run: `./install.sh -h`
![1](images/tweaks-view.png?raw=true)
### Flatpak Installation
Automatically install your host GTK+ theme as a Flatpak. Use this:
Automatically install your host GTK+ 3.0 theme as a Flatpak. Use this:
- [stylepak](https://github.com/refi64/stylepak)
- [pakitheme](https://github.com/refi64/pakitheme)
Also if you want to use this theme on a GTK+ 4.0 flatpak app, you can give the permission to access this file
local:
```
flatpak override --user --filesystem=xdg-config/gtk-4.0
```
global:
```
flatpak override --filesystem=xdg-config/gtk-4.0
```
### On Snapcraft

@ -24,8 +24,10 @@ clean() {
local THEME_DIR="$dest/$name$theme$color$size"
if [[ -d ${THEME_DIR} ]]; then
rm -rf ${THEME_DIR}
if [[ "${theme}" == '' && "${color}" == '' && "${size}" == '' ]]; then
todo='nothing'
elif [[ -d "${THEME_DIR}" ]]; then
rm -rf "${THEME_DIR}"
echo -e "Find: ${THEME_DIR} ! removing it ..."
fi
}

@ -145,6 +145,24 @@ install() {
cp -r "$SRC_DIR/plank/dock.theme" "$THEME_DIR/plank"
}
uninstall() {
local dest="$1"
local name="$2"
local theme="$3"
local color="$4"
local size="$5"
local THEME_DIR="$dest/$name$theme$color$size"
[[ -d "$THEME_DIR" ]] && rm -rf "$THEME_DIR" && echo -e "Uninstalling "$THEME_DIR" ..."
}
uninstall_link() {
[[ -L "${HOME}/.config/gtk-4.0/assets" ]] && rm -rf "${HOME}/.config/gtk-4.0/assets" && echo -e "Removing ${HOME}/.config/gtk-4.0/assets"
[[ -L "${HOME}/.config/gtk-4.0/gtk.css" ]] && rm -rf "${HOME}/.config/gtk-4.0/gtk.css" && echo -e "Removing ${HOME}/.config/gtk-4.0/gtk.css"
[[ -L "${HOME}/.config/gtk-4.0/gtk-dark.css" ]] && rm -rf "${HOME}/.config/gtk-4.0/gtk-dark.css" && echo -e "Removing ${HOME}/.config/gtk-4.0/gtk-dark.css"
}
link_libadwaita() {
local dest="$1"
local name="$2"
@ -154,7 +172,8 @@ link_libadwaita() {
local THEME_DIR="$dest/$name$theme$color$size"
# link gtk4.0 for libadwaita
echo -e "\nLink '$THEME_DIR/gtk-4.0' to '${HOME}/.config/gtk-4.0' for libadwaita..."
mkdir -p "${HOME}/.config/gtk-4.0"
rm -rf "${HOME}/.config/gtk-4.0/"{assets,gtk.css,gtk-dark.css}
ln -sf "${THEME_DIR}/gtk-4.0/assets" "${HOME}/.config/gtk-4.0/assets"
@ -240,7 +259,7 @@ install_theme_color() {
theme_tweaks() {
install_package; tweaks_temp
if [[ "$panel" = "compact" || "$opacity" == 'solid' || "$blackness" == "true" || "$accent" == "true" || "$primary" == "true" ]]; then
if [[ "$panel" == "compact" || "$opacity" == 'solid' || "$blackness" == "true" || "$accent" == "true" || "$primary" == "true" ]]; then
tweaks='true'
fi
@ -299,9 +318,19 @@ install_theme() {
done
}
uninstall_theme() {
for theme in "${THEME_VARIANTS[@]}"; do
for color in "${colors[@]}"; do
for size in "${sizes[@]}"; do
uninstall "${dest:-$DEST_DIR}" "${_name:-$THEME_NAME}" "$theme" "$color" "$size"
done
done
done
}
link_theme() {
for theme in "${themes[@]}"; do
for color in "${colors[@]}"; do
for color in "${COLOR_VARIANTS[2]}"; do
for size in "${SIZE_VARIANTS[0]}"; do
link_libadwaita "${dest:-$DEST_DIR}" "${_name:-$THEME_NAME}" "$theme" "$color" "$size"
done

@ -10,18 +10,27 @@ Usage: $0 [OPTION]...
OPTIONS:
-d, --dest DIR Specify destination directory (Default: $DEST_DIR)
-n, --name NAME Specify theme name (Default: $THEME_NAME)
-t, --theme VARIANT Specify theme color variant(s) [default|purple|pink|red|orange|yellow|green|grey|all] (Default: blue)
-c, --color VARIANT... Specify color variant(s) [standard|light|dark] (Default: All variants)s)
-c, --color VARIANT Specify color variant(s) [standard|light|dark] (Default: All variants)s)
-s, --size VARIANT Specify size variant [standard|compact] (Default: All variants)
-l, --libadwaita Link installed Orchis gtk-4.0 theme to config folder for all libadwaita app use Orchis theme
-r, --remove,
-u, --uninstall Uninstall/Remove installed themes
--tweaks Specify versions for tweaks [solid|compact|black|primary] (Options can mix)
1. solid: no transparency panel variant
2. compact: no floating panel variant
3. black: full black variant
4. primary: Change radio icon checked color to primary theme color (Default is Green)
--shell install gnome-shell version [38|40|42]
1. 38: gnome-shell version < 40.0
2. 40: gnome-shell version = 40.0
3. 42: gnome-shell version = 42.0
-h, --help Show help
EOF
}
@ -41,6 +50,14 @@ while [[ "$#" -gt 0 ]]; do
_name="$2"
shift 2
;;
-r|-u|--remove|--uninstall)
remove="true"
shift
;;
-l|--libadwaita)
libadwaita="true"
shift
;;
--shell)
shift
for variant in $@; do
@ -227,7 +244,21 @@ fi
./clean-old-theme.sh
install_theme && link_theme
if [[ ${remove} == 'true' ]]; then
if [[ "$libadwaita" == 'true' ]]; then
uninstall_link
elif [[ "$all" == 'true' ]]; then
uninstall_theme && uninstall_link
else
uninstall_theme
fi
else
install_theme
if [[ "$libadwaita" == 'true' ]]; then
link_theme
fi
fi
echo
echo "Done."

Loading…
Cancel
Save