install.fairie/home/.chezmoiscripts/universal/run_onchange_after_21-dconf-settings.sh.tmpl

56 lines
2.6 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 DConf Settings
# @brief Applies repository-housed `dconf` settings.
# @description
# This script allows you to apply `dconf` settings that you can store in your fork of Install Doctor. By default,
# it makes a handful of `dconf` settings optimizations.
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Update background to be OS-specific
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings/org.gnome.desktop.background" ]; then
logg info 'Checking for presence of /usr/local/share/wallpapers/Betelgeuse-{{ title .host.distro.id }}/contents/source.jpg'
if [ -f /usr/local/share/wallpapers/Betelgeuse-{{ title .host.distro.id }}/contents/source.jpg ]; then
logg info "Updating ${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings/org.gnome.desktop.background to point to OS-specific background"
TMP="$(mktemp)"
sed 's/Betelgeuse/Betelgeuse-{{ title .host.distro.id }}/g' < "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings/org.gnome.desktop.background" > "$TMP"
mv "$TMP" "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings/org.gnome.desktop.background"
else
logg info 'OS-specific background not found'
fi
fi
### Backup system settings
DCONF_TMP="$(mktemp)"
dconf dump / > "$DCONF_TMP"
logg info 'Backed up system dconf settings to '"$DCONF_TMP"
### Reset system settings / load saved configurations from ~/.config/dconf/settings
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" ]; then
find "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" -mindepth 1 -maxdepth 1 -type f | while read DCONF_CONFIG_FILE; do
if [ "$DEBUG_MODE" == 'true' ]; then
logg info 'Dconf configuration file:'
echo "$DCONF_CONFIG_FILE"
fi
DCONF_SETTINGS_ID="/$(basename "$DCONF_CONFIG_FILE" | sed 's/\./\//g')/"
if [ "$DEBUG_MODE" == 'true' ]; then
logg info 'Dconf settings ID:'
echo "$DCONF_SETTINGS_ID"
fi
# Reset dconf settings if environment variable RESET_DCONF is set to true
if [ "$RESET_DCONF" == 'true' ]; then
logg info 'Resetting dconf settings for `'"$DCONF_SETTINGS_ID"'`'
dconf reset -f "$DCONF_SETTINGS_ID"
fi
logg info 'Loading versioned dconf settings for `'"$DCONF_SETTINGS_ID"'`'
dconf load "$DCONF_SETTINGS_ID" < "$DCONF_CONFIG_FILE"
logg success 'Finished applying dconf settings for `'"$DCONF_SETTINGS_ID"'`'
done
else
logg warn '~/.config/dconf/settings does not exist!'
fi
{{ end -}}