forked from Shinonome/dots-hyprland
add forced theming mode for terminal
This commit is contained in:
@@ -8,6 +8,7 @@ CONFIG_DIR="$XDG_CONFIG_HOME/quickshell/$QUICKSHELL_CONFIG_NAME"
|
|||||||
CACHE_DIR="$XDG_CACHE_HOME/quickshell"
|
CACHE_DIR="$XDG_CACHE_HOME/quickshell"
|
||||||
STATE_DIR="$XDG_STATE_HOME/quickshell"
|
STATE_DIR="$XDG_STATE_HOME/quickshell"
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
SHELL_CONFIG_FILE="$XDG_CONFIG_HOME/illogical-impulse/config.json"
|
||||||
|
|
||||||
term_alpha=100 #Set this to < 100 make all your terminals transparent
|
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
|
# sleep 0 # idk i wanted some delay or colors dont get applied properly
|
||||||
@@ -23,11 +24,19 @@ colorvalues=()
|
|||||||
|
|
||||||
colornames=$(cat $STATE_DIR/user/generated/material_colors.scss | cut -d: -f1)
|
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)
|
colorstrings=$(cat $STATE_DIR/user/generated/material_colors.scss | cut -d: -f2 | cut -d ' ' -f2 | cut -d ";" -f1)
|
||||||
|
colorstrings_dark=$(cat $STATE_DIR/user/generated/material_colors_dark.scss | cut -d: -f2 | cut -d ' ' -f2 | cut -d ";" -f1)
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
colorlist=($colornames) # Array of color names
|
colorlist=($colornames) # Array of color names
|
||||||
colorvalues=($colorstrings) # Array of color values
|
colorvalues=($colorstrings) # Array of color values
|
||||||
|
colorvalues_dark=($colorstrings_dark) # Array of color values (dark mode)
|
||||||
|
|
||||||
apply_term() {
|
apply_term() {
|
||||||
|
local applied_colorvalues=("${colorvalues[@]}")
|
||||||
|
local terminal_force_dark_theme="jq -r '.appearance.wallpaperTheming.forceTerminalDarkMode' $SHELL_CONFIG_FILE"
|
||||||
|
if [[ $(eval "$terminal_force_dark_theme") == "true" ]]; then
|
||||||
|
applied_colorvalues=("${colorvalues_dark[@]}")
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if terminal escape sequence template exists
|
# Check if terminal escape sequence template exists
|
||||||
if [ ! -f "$SCRIPT_DIR/terminal/sequences.txt" ]; then
|
if [ ! -f "$SCRIPT_DIR/terminal/sequences.txt" ]; then
|
||||||
echo "Template file not found for Terminal. Skipping that."
|
echo "Template file not found for Terminal. Skipping that."
|
||||||
@@ -38,7 +47,7 @@ apply_term() {
|
|||||||
cp "$SCRIPT_DIR/terminal/sequences.txt" "$STATE_DIR"/user/generated/terminal/sequences.txt
|
cp "$SCRIPT_DIR/terminal/sequences.txt" "$STATE_DIR"/user/generated/terminal/sequences.txt
|
||||||
# Apply colors
|
# Apply colors
|
||||||
for i in "${!colorlist[@]}"; do
|
for i in "${!colorlist[@]}"; do
|
||||||
sed -i "s/${colorlist[$i]} #/${colorvalues[$i]#\#}/g" "$STATE_DIR"/user/generated/terminal/sequences.txt
|
sed -i "s/${colorlist[$i]} #/${applied_colorvalues[$i]#\#}/g" "$STATE_DIR"/user/generated/terminal/sequences.txt
|
||||||
done
|
done
|
||||||
|
|
||||||
sed -i "s/\$alpha/$term_alpha/g" "$STATE_DIR/user/generated/terminal/sequences.txt"
|
sed -i "s/\$alpha/$term_alpha/g" "$STATE_DIR/user/generated/terminal/sequences.txt"
|
||||||
@@ -58,14 +67,13 @@ apply_qt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check if terminal theming is enabled in config
|
# Check if terminal theming is enabled in config
|
||||||
CONFIG_FILE="$XDG_CONFIG_HOME/illogical-impulse/config.json"
|
if [ -f "$SHELL_CONFIG_FILE" ]; then
|
||||||
if [ -f "$CONFIG_FILE" ]; then
|
enable_terminal=$(jq -r '.appearance.wallpaperTheming.enableTerminal' "$SHELL_CONFIG_FILE")
|
||||||
enable_terminal=$(jq -r '.appearance.wallpaperTheming.enableTerminal' "$CONFIG_FILE")
|
|
||||||
if [ "$enable_terminal" = "true" ]; then
|
if [ "$enable_terminal" = "true" ]; then
|
||||||
apply_term &
|
apply_term &
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Config file not found at $CONFIG_FILE. Applying terminal theming by default."
|
echo "Config file not found at $SHELL_CONFIG_FILE. Applying terminal theming by default."
|
||||||
apply_term &
|
apply_term &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -264,11 +264,15 @@ switch() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -n "$mode_flag" ]] && matugen_args+=(--mode "$mode_flag") && generate_colors_material_args+=(--mode "$mode_flag")
|
|
||||||
[[ -n "$type_flag" ]] && matugen_args+=(--type "$type_flag") && generate_colors_material_args+=(--scheme "$type_flag")
|
[[ -n "$type_flag" ]] && matugen_args+=(--type "$type_flag") && generate_colors_material_args+=(--scheme "$type_flag")
|
||||||
generate_colors_material_args+=(--termscheme "$terminalscheme" --blend_bg_fg)
|
generate_colors_material_args+=(--termscheme "$terminalscheme" --blend_bg_fg)
|
||||||
generate_colors_material_args+=(--cache "$STATE_DIR/user/generated/color.txt")
|
generate_colors_material_args+=(--cache "$STATE_DIR/user/generated/color.txt")
|
||||||
|
|
||||||
|
generate_colors_material_dark_args=("${generate_colors_material_args[@]}")
|
||||||
|
generate_colors_material_dark_args+=(--mode "dark")
|
||||||
|
[[ -n "$mode_flag" ]] && matugen_args+=(--mode "$mode_flag") && generate_colors_material_args+=(--mode "$mode_flag")
|
||||||
|
|
||||||
|
|
||||||
pre_process "$mode_flag"
|
pre_process "$mode_flag"
|
||||||
|
|
||||||
# Check if app and shell theming is enabled in config
|
# Check if app and shell theming is enabled in config
|
||||||
@@ -284,6 +288,8 @@ switch() {
|
|||||||
source "$(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate"
|
source "$(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate"
|
||||||
python3 "$SCRIPT_DIR/generate_colors_material.py" "${generate_colors_material_args[@]}" \
|
python3 "$SCRIPT_DIR/generate_colors_material.py" "${generate_colors_material_args[@]}" \
|
||||||
> "$STATE_DIR"/user/generated/material_colors.scss
|
> "$STATE_DIR"/user/generated/material_colors.scss
|
||||||
|
python3 "$SCRIPT_DIR/generate_colors_material.py" "${generate_colors_material_dark_args[@]}" \
|
||||||
|
> "$STATE_DIR"/user/generated/material_colors_dark.scss
|
||||||
"$SCRIPT_DIR"/applycolor.sh
|
"$SCRIPT_DIR"/applycolor.sh
|
||||||
deactivate
|
deactivate
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user