From 8e77da043f209901b9f56d651621bfe689ce4513 Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Mon, 7 Jul 2025 13:32:13 +0000 Subject: [PATCH] feat: rewrite WSL theme changer for windows 11 + windows terminal :sparkles: --- bashscripts/wsl_theme.sh | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/bashscripts/wsl_theme.sh b/bashscripts/wsl_theme.sh index 51eba02..bb9cefa 100644 --- a/bashscripts/wsl_theme.sh +++ b/bashscripts/wsl_theme.sh @@ -11,10 +11,13 @@ else echo $color_scheme > $nvim_color_theme_path fi +# cp $dark_mode_config_path $windows_terminal_settings_path # check that all relevant files exist windows_username=$(powershell.exe '$env:UserName' | tr -d '\r\n') -dark_mode_config_path=~/python-projects/24_alacritty_windows_setup/gruvbox_material_medium_dark.toml -light_mode_config_path=~/python-projects/24_alacritty_windows_setup/gruvbox_material_medium_light.toml +windows_terminal_settings_path="/mnt/c/Users/${windows_username}/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json" +dark_mode_config_path=~/dotfiles/assets/windows_terminal/dark.settings.json +light_mode_config_path=~/dotfiles/assets/windows_terminal/light.settings.json + if [ ! -f $light_mode_config_path ]; then echo "error: light_mode_config_path missing" echo "expected: $light_mode_config_path" @@ -27,26 +30,24 @@ if [ ! -f $dark_mode_config_path ]; then exit 1 fi -windows_alacritty_config_path="/mnt/c/Users/${windows_username}/AppData/Roaming/alacritty/alacritty.toml" -echo 'overwriting windows alacritty config' +if [ ! -f $dark_mode_config_path ]; then + echo "error: windows terminal settings path missing" + echo "expected: $windows_terminal_settings_path" + exit 1 +fi if [ $color_scheme = 'dark' ]; then - echo "going dark" - cp $dark_mode_config_path $windows_alacritty_config_path - - # explorer, browser etc - powershell.exe -Command "Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0" - # taskbar and start menu - powershell.exe -Command "Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 0" + cp $dark_mode_config_path $windows_terminal_settings_path + echo "going dark - opening settings" + powershell.exe -Command "start C:\Windows\Resources\Themes\dark.theme" + powershell.exe "timeout /t 3; taskkill /im systemsettings.exe /f" fi if [ $color_scheme = 'light' ]; then - echo "going light" - cp $light_mode_config_path $windows_alacritty_config_path - - # explorer, browser etc - powershell.exe -Command "Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 1" - # taskbar and start menu - powershell.exe -Command "Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -Value 1" + cp $light_mode_config_path $windows_terminal_settings_path + echo "going light - opening settings" + powershell.exe -Command "start C:\Windows\Resources\Themes\aero.theme" + echo "closing settigns" + powershell.exe "timeout /t 3; taskkill /im systemsettings.exe /f" fi