Create symlink instead of copying directory

This commit is contained in:
Rokosun 2023-10-15 10:48:52 +02:00
parent dd6743836e
commit a6dfcff64f

View File

@ -162,8 +162,8 @@ sync_theme() {
[ "$current_window_scaling" -eq '2' ] && use_hdpi_theme_variant 'disable_notification'
fi
# Cleanup flatpak_themes_dir and ~/.config/gtk-4.0
rm -rf "${flatpak_themes_dir:?}"/{*,.*} "$config_dir/gtk-4.0"/{*,.*}
# Cleanup flatpak_themes_dir and remove ~/.config/gtk-4.0
rm -rf "${flatpak_themes_dir:?}"/{*,.*} "$config_dir/gtk-4.0"
# Find the directory where the current theme is stored
local -r current_theme_dir=$(xdg_directory_lookup "themes/$current_theme")
@ -171,10 +171,8 @@ sync_theme() {
if [ -d "$current_theme_dir" ]; then
# Copy/sync current_theme_dir to flatpak_themes_dir
rsync -av --delete --progress "$current_theme_dir" "$flatpak_themes_dir"
local -r current_theme_gtk4_dir="$current_theme_dir/gtk-4.0"
[ -d "$current_theme_gtk4_dir" ] &&
# Copy/sync current_theme_gtk4_dir to config_dir
rsync -av --delete --progress "$current_theme_gtk4_dir" "$config_dir"
# Create symlink for gtk-4.0 directory
ln -s "$current_theme_dir/gtk-4.0" "$config_dir"
fi
}