From ee1fbf72cc717456e40dba774f27a473b100eb43 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 29 Oct 2025 22:06:53 +0100 Subject: [PATCH] vscode theming with Material Code extension (#2146) --- .../colors/code/material-code-set-color.sh | 16 ++++++++++++++++ .../quickshell/ii/scripts/colors/switchwall.sh | 12 +----------- 2 files changed, 17 insertions(+), 11 deletions(-) create mode 100755 dots/.config/quickshell/ii/scripts/colors/code/material-code-set-color.sh diff --git a/dots/.config/quickshell/ii/scripts/colors/code/material-code-set-color.sh b/dots/.config/quickshell/ii/scripts/colors/code/material-code-set-color.sh new file mode 100755 index 000000000..df622d592 --- /dev/null +++ b/dots/.config/quickshell/ii/scripts/colors/code/material-code-set-color.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +COLOR_FILE_PATH="${XDG_STATE_HOME:-$HOME/.local/state}/quickshell/user/generated/color.txt" +CODE_SETTINGS_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/Code/User/settings.json" + +new_color=$(cat "$COLOR_FILE_PATH") + +# Try to update the key if it exists +if grep -q '"material-code.primaryColor"' "$CODE_SETTINGS_PATH"; then + sed -i -E \ + "s/(\"material-code.primaryColor\"\s*:\s*\")[^\"]*(\")/\1${new_color}\2/" \ + "$CODE_SETTINGS_PATH" +else # If the key is not already there, add it + sed -i '$ s/}/,\n "material-code.primaryColor": "'${new_color}'"\n}/' "$CODE_SETTINGS_PATH" + sed -i '$ s/,\n,/,/' "$CODE_SETTINGS_PATH" +fi + diff --git a/dots/.config/quickshell/ii/scripts/colors/switchwall.sh b/dots/.config/quickshell/ii/scripts/colors/switchwall.sh index 5d1a57c7a..31f260760 100755 --- a/dots/.config/quickshell/ii/scripts/colors/switchwall.sh +++ b/dots/.config/quickshell/ii/scripts/colors/switchwall.sh @@ -55,18 +55,8 @@ post_process() { local screen_height="$2" local wallpaper_path="$3" - handle_kde_material_you_colors & - - # Determine the largest region on the wallpaper that's sufficiently un-busy to put widgets in - # if [ ! -f "$MATUGEN_DIR/scripts/least_busy_region.py" ]; then - # echo "Error: least_busy_region.py script not found in $MATUGEN_DIR/scripts/" - # else - # "$MATUGEN_DIR/scripts/least_busy_region.py" \ - # --screen-width "$screen_width" --screen-height "$screen_height" \ - # --width 300 --height 200 \ - # "$wallpaper_path" > "$STATE_DIR"/user/generated/wallpaper/least_busy_region.json - # fi + "$SCRIPT_DIR/code/material-code-set-color.sh" & } check_and_prompt_upscale() {