From 3dca8cb2a042317a73491bd07da997ef1b619c78 Mon Sep 17 00:00:00 2001
From: Tio TROM <tio@trom.tf>
Date: Mon, 7 Aug 2023 22:13:04 +0200
Subject: [PATCH] added support for HDPI

---
 theme-switcher | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/theme-switcher b/theme-switcher
index fa543b3..adf8fac 100644
--- a/theme-switcher
+++ b/theme-switcher
@@ -21,6 +21,7 @@ disable_dark_panels() {
 set_theme() {
 	local theme="Colloid-$1"
 
+	# Set the icon theme and panel color according to the chosen theme
 	case "$theme" in
 		*'-Dark-Gruvbox'|*'-Dark'|*'-Dark-Nord')
 			set_icon_theme 'zafiro-dark'
@@ -38,7 +39,15 @@ set_theme() {
 
 	# Change the main theme to the chosen one
 	xfconf-query -c xsettings -p /Net/ThemeName -n -t string -s "$theme"
-	xfconf-query -c xfwm4 -p /general/theme -n -t string -s "$theme"
+
+	if [ "$(xfconf-query -c xsettings -p /Gdk/WindowScalingFactor)" = '2' ]; then
+		# Use the highDPI themes for XFWM if highDPI is enabled in XFCE
+		xfconf-query -c xfwm4 -p /general/theme -n -t string -s "$theme-xhdpi"
+	else
+		xfconf-query -c xfwm4 -p /general/theme -n -t string -s "$theme"
+	fi
+
+	# Send notification about the theme change
 	notify-send "$theme theme$panel_notification was enabled"
 }