From a6dfcff64fcc1a53c802d73387f7424a5d913bf1 Mon Sep 17 00:00:00 2001
From: rokosun <rokosun@noreply.git.trom.tf>
Date: Sun, 15 Oct 2023 10:48:52 +0200
Subject: [PATCH] Create symlink instead of copying directory

---
 bin/periodic/fix-theming | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/bin/periodic/fix-theming b/bin/periodic/fix-theming
index bd64c56..ee8f389 100755
--- a/bin/periodic/fix-theming
+++ b/bin/periodic/fix-theming
@@ -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
 }
 
-- 
2.39.5