forked from Shinonome/dots-hyprland
color generation
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
CONFIG_DIR="$XDG_CONFIG_HOME/quickshell"
|
||||
CACHE_DIR="$XDG_CACHE_HOME/quickshell"
|
||||
STATE_DIR="$XDG_STATE_HOME/quickshell"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
term_alpha=100 #Set this to < 100 make all your terminals transparent
|
||||
# sleep 0 # idk i wanted some delay or colors dont get applied properly
|
||||
if [ ! -d "$CACHE_DIR"/user/generated ]; then
|
||||
mkdir -p "$CACHE_DIR"/user/generated
|
||||
fi
|
||||
cd "$CONFIG_DIR" || exit
|
||||
|
||||
colornames=''
|
||||
colorstrings=''
|
||||
colorlist=()
|
||||
colorvalues=()
|
||||
|
||||
colornames=$(cat $STATE_DIR/user/generated/material_colors.scss | cut -d: -f1)
|
||||
colorstrings=$(cat $STATE_DIR/user/generated/material_colors.scss | cut -d: -f2 | cut -d ' ' -f2 | cut -d ";" -f1)
|
||||
IFS=$'\n'
|
||||
colorlist=($colornames) # Array of color names
|
||||
colorvalues=($colorstrings) # Array of color values
|
||||
|
||||
apply_term() {
|
||||
# Check if terminal escape sequence template exists
|
||||
if [ ! -f "$SCRIPT_DIR"/terminal/sequences.txt ]; then
|
||||
echo "Template file not found for Terminal. Skipping that."
|
||||
return
|
||||
fi
|
||||
# Copy template
|
||||
mkdir -p "$CACHE_DIR"/user/generated/terminal
|
||||
cp "$SCRIPT_DIR"/terminal/sequences.txt "$CACHE_DIR"/user/generated/terminal/sequences.txt
|
||||
# Apply colors
|
||||
for i in "${!colorlist[@]}"; do
|
||||
sed -i "s/${colorlist[$i]} #/${colorvalues[$i]#\#}/g" "$CACHE_DIR"/user/generated/terminal/sequences.txt
|
||||
done
|
||||
|
||||
sed -i "s/\$alpha/$term_alpha/g" "$CACHE_DIR/user/generated/terminal/sequences.txt"
|
||||
|
||||
for file in /dev/pts/*; do
|
||||
if [[ $file =~ ^/dev/pts/[0-9]+$ ]]; then
|
||||
cat "$CACHE_DIR"/user/generated/terminal/sequences.txt >"$file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
apply_qt() {
|
||||
sh "$CONFIG_DIR/scripts/kvantum/materialQT.sh" # generate kvantum theme
|
||||
python "$CONFIG_DIR/scripts/kvantum/changeAdwColors.py" # apply config colors
|
||||
}
|
||||
|
||||
apply_qt &
|
||||
apply_term &
|
||||
Reference in New Issue
Block a user