Dynamically change all opened terminals colorscheme with wallpaper (#210)

This commit is contained in:
end-4
2024-01-29 11:47:31 +07:00
committed by GitHub
5 changed files with 41 additions and 15 deletions
@@ -99,6 +99,29 @@ apply_foot() {
cp "$HOME/.config/foot/foot_new.ini" "$HOME/.config/foot/foot.ini" cp "$HOME/.config/foot/foot_new.ini" "$HOME/.config/foot/foot.ini"
} }
apply_term() {
# Check if scripts/templates/foot/foot.ini exists
if [ ! -f "scripts/templates/terminal/sequences.material" ]; then
echo "Template file not found for Terminal. Skipping that."
return
fi
if [ ! -d $HOME/.cache/ags/user/colorschemes ]; then
mkdir -p $HOME/.cache/ags/user/colorschemes
fi
# Copy template
cp "scripts/templates/terminal/sequences.material" "$HOME/.cache/ags/user/colorschemes/sequences"
# Apply colors
for i in "${!colorlist[@]}"; do
sed -i "s/${colorlist[$i]} #/${colorvalues[$i]#\#}/g" "$HOME/.cache/ags/user/colorschemes/sequences"
done
for file in /dev/pts/*; do
if [[ $file =~ ^/dev/pts/[0-9]+$ ]]; then
cat "$HOME/.cache/ags/user/colorschemes/sequences" > $file
fi
done
}
apply_hyprland() { apply_hyprland() {
# Check if scripts/templates/hypr/colors.conf exists # Check if scripts/templates/hypr/colors.conf exists
if [ ! -f "scripts/templates/hypr/colors.conf" ]; then if [ ! -f "scripts/templates/hypr/colors.conf" ]; then
@@ -152,4 +175,4 @@ apply_hyprland &
apply_gtk & apply_gtk &
apply_gtklock & apply_gtklock &
apply_fuzzel & apply_fuzzel &
apply_foot apply_term
@@ -37,8 +37,8 @@ elif [ "$backend" = "material" ]; then
elif [ "$backend" = "pywal" ]; then elif [ "$backend" = "pywal" ]; then
# clear and generate # clear and generate
wal -c wal -c
echo wal -i "$1" -n -t -s -e "$lightdark" -q #echo wal -i "$1" -n -t -s -e "$lightdark" -q
wal -i "$1" -n -t -s -e $lightdark -q wal -i "$1" -n $lightdark -q
# copy scss # copy scss
cp "$HOME/.cache/wal/colors.scss" $HOME/.cache/ags/user/generated_colors.txt cp "$HOME/.cache/wal/colors.scss" $HOME/.cache/ags/user/generated_colors.txt
@@ -0,0 +1 @@
]4;0;#$background #\]4;1;#$error #\]4;2;#$inversePrimary #\]4;3;#$onPrimaryContainer #\]4;4;#$onPrimaryContainer #\]4;5;#$onSecondaryContainer #\]4;6;#$primary #\]4;7;#$onSurfaceVariant #\]4;8;#$background #\]4;9;#$error #\]4;10;#$inversePrimary #\]4;11;#$onPrimaryContainer #\]4;12;#$onPrimaryContainer #\]4;13;#$onSecondaryContainer #\]4;14;#$primary #\]4;15;#$onSurfaceVariant #\]10;#$onSurfaceVariant #\]11;#$background #\]12;#$onSurfaceVariant #\]13;#$onSurfaceVariant #\]17;#$onSurfaceVariant #\]19;#$background #\]4;232;#$background #\]4;256;#$onSurfaceVariant #\]708;#$background #\
@@ -0,0 +1 @@
]4;0;#regular0\]4;1;#regular1\]4;2;#regular2\]4;3;#regular3\]4;4;#regular4\]4;5;#regular5\]4;6;#regular6\]4;7;#regular7\]4;8;#bright0\]4;9;#bright1\]4;10;#bright2\]4;11;#bright3\]4;12;#bright4\]4;13;#bright5\]4;14;#bright6\]4;15;#bright7\]10;#regular7\]11;#regular0\]12;#regular7\]13;#regular7\]17;#regular7\]19;#regular0\]4;232;#regular0\]4;256;#regular7\]708;#regular0\
+1
View File
@@ -13,6 +13,7 @@ if status is-interactive
end end
starship init fish | source starship init fish | source
cat ~/.cache/ags/user/colorschemes/sequences
# function fish_prompt # function fish_prompt
# set_color cyan; echo (pwd) # set_color cyan; echo (pwd)