install.fairie/home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.sh.tmpl

82 lines
4 KiB
Cheetah
Raw Normal View History

{{- if (eq .host.distro.family "linux") -}}
#!/usr/bin/env bash
Update 55 files - /home/dot_config/rclone/system/s3-docker.service.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_13-post-install-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-warp.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-keybase.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-gnome-extension-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_20-font.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_70-misc-bug-fixes.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_06-bin-symlink.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_40-firefox.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_40-chrome.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_28-privoxy.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_27-tor.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_24-vpn-linux.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_26-system-vscode-node-modules.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_26-vscode-extensions.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_07-docker-plugins.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_05-log-config.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_04-environment-profile.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-warp.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-timeshift.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-keybase.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_14-install-aqua-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_12-install-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_15-install-asdf-packages.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_18-install-sdkman.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-gnome-extension-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_20-font.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_50-crontab.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_57-netdata.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_59-connect-tailscale.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_80-bash-completions.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_70-misc-bug-fixes.sh.tmpl
2023-04-11 20:26:25 -07:00
# @file Linux GNOME / KDE Theme
# @brief Installs the Sweet-based theme for GNOME / KDE.
# @description
# This script applies various themes to Linux systems that use GNOME or KDE.
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Ensure /usr/local/bin/squash-symlink is present
if [ ! -f /usr/local/bin/squash-symlink ] && [ -f "$HOME/.local/bin/squash-symlink" ]; then
logg info 'Copying ~/.local/bin/squash-symlink to /usr/local/bin/squash-symlink'
sudo cp -f "$HOME/.local/bin/squash-symlink" /usr/local/bin/squash-symlink
fi
### Clean up system theme settings
for ITEM_TO_BE_REMOVED in "/usr/share/backgrounds/images" "/usr/share/backgrounds/f32" "/usr/share/backgrounds/qubes" "/usr/share/wallpapers"; do
if [ -d "$ITEM_TO_BE_REMOVED" ] || [ -f "$ITEM_TO_BE_REMOVED" ]; then
sudo rm -rf "$ITEM_TO_BE_REMOVED"
logg success "Removed $ITEM_TO_BE_REMOVED"
fi
done
### Ensure /usr/local/share exists
if [ ! -d /usr/local/share ]; then
sudo mkdir -p /usr/local/share
logg success 'Created /usr/local/share'
fi
### Copy theme files over to /usr/local/share
if [ -d "$HOME/.local/src/{{ .theme | lower }}/share" ]; then
logg info 'Copying ~/.local/src/{{ .theme | lower }}/share to /usr/local/share'
2023-08-01 00:05:52 -07:00
sudo rsync --chown=root:root --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r -artvu --inplace "${XDG_DATA_HOME:-$HOME/.local/share}/betelgeuse/share/" "/usr/local/share/" > /dev/null
else
2023-08-01 00:05:52 -07:00
logg warn '~/.local/share/betelgeuse/share is missing'
fi
### Flatten GRUB theme files (i.e. convert symlinks to regular files)
if command -v squash-symlink > /dev/null; then
logg info 'Converting /usr/local/share/grub symlinks to equivalent regular files'
sudo find /usr/local/share/grub -type l -exec squash-symlink {} +
else
logg warn '`squash-symlink` is not a script in the PATH'
fi
### Ensure /usr/share/backgrounds/default.png is deleted
if [ -f /usr/share/backgrounds/default.png ]; then
sudo rm -f /usr/share/backgrounds/default.png
fi
### Add the default image symlink based on the OS
if [ '{{ .host.distro.id }}' == 'archlinux' ]; then
sudo ln -s /usr/local/share/wallpapers/Betelgeuse-Archlinux/contents/source.png /usr/share/backgrounds/default.png
elif [ '{{ .host.distro.id }}' == 'centos' ]; then
sudo ln -s /usr/local/share/wallpapers/Betelgeuse-CentOS/contents/source.png /usr/share/backgrounds/default.png
elif [ '{{ .host.distro.id }}' == 'darwin' ]; then
sudo ln -s /usr/local/share/wallpapers/Betelgeuse-macOS/contents/source.png /usr/share/backgrounds/default.png
elif [ '{{ .host.distro.id }}' == 'debian' ]; then
sudo ln -s /usr/local/share/wallpapers/Betelgeuse-Debian/contents/source.png /usr/share/backgrounds/default.png
elif [ '{{ .host.distro.id }}' == 'fedora' ]; then
sudo ln -s /usr/local/share/wallpapers/Betelgeuse-Fedora/contents/source.png /usr/share/backgrounds/default.png
elif [ '{{ .host.distro.id }}' == 'ubuntu' ]; then
sudo ln -s /usr/local/share/wallpapers/Betelgeuse-Ubuntu/contents/source.png /usr/share/backgrounds/default.png
elif [ '{{ .host.distro.id }}' == 'windows' ]; then
sudo ln -s /usr/local/share/wallpapers/Betelgeuse-Windows/contents/source.png /usr/share/backgrounds/default.png
else
sudo ln -s /usr/local/share/wallpapers/Betelgeuse/contents/source.png /usr/share/backgrounds/default.png
fi
### Note: ubuntu-default-greyscale-wallpaper.png symlink to whiteish gray background
### Set appropriate platform-specific icon in plymouth theme
if [ -f '/usr/local/share/plymouth/themes/{{ .theme }}/icons/{{ .host.distro.id }}.png' ]; then
sudo cp -f '/usr/local/share/plymouth/themes/{{ .theme }}/icons/{{ .host.distro.id }}.png' '/usr/local/share/plymouth/themes/{{ .theme }}/icon.png'
logg success 'Added platform-specific icon to {{ .theme }} Plymouth theme'
else
logg warn 'The `{{ .host.distro.id }}.png` icon is not available in the icons folder insider the {{ .theme }} Plymouth theme'
fi
{{ end -}}