Update dotfiles (2026-05-08 15:35:43)

This commit is contained in:
2026-05-08 15:35:43 +02:00
parent 362e7e51a5
commit afd1b5bd53
77 changed files with 127 additions and 347 deletions
@@ -0,0 +1,8 @@
#!/bin/zsh
dir="/home/inorishio/Pictures/Backgrounds/"
output_file="/tmp/random_images.list"
images=10
# Generate random images
find "$dir" -type f | shuf -n $images > "$output_file"
+33
View File
@@ -0,0 +1,33 @@
#!/bin/zsh
export XDG_RUNTIME_DIR="/run/user/1000"
output_file="/tmp/random_images.list"
scheme_dir="/home/inorishio/.cache/wal/schemes/"
background_dir="/home/inorishio/Pictures/Backgrounds/"
random_images=("${(@f)$(< "$output_file")}")
populate_random_schemes() {
substract0=("${random_images[@]/$background_dir/$scheme_dir}")
substract1=("${substract0[@]/.png/}")
random_schemes=("${substract1[@]/.jpg/}")
}
populate_random_schemes
wal_ran_for_ws=0
handle_terminal_workspace() {
if [[ "$1" =~ workspace* ]]; then
local ws="${1##*>>}"
if [[ "$ws" == "1" && "$wal_ran_for_ws" -eq 0 ]]; then
wal -f "${random_schemes[1]}"
wal_ran_for_ws=1
fi
fi
}
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock |
while read -r line; do
handle_terminal_workspace "$line"
done
+45
View File
@@ -0,0 +1,45 @@
#!/bin/zsh
export XDG_RUNTIME_DIR="/run/user/1000"
output_file="/tmp/random_images.list"
scheme_dir="/home/inorishio/.cache/wal/schemes/"
background_dir="/home/inorishio/Pictures/Backgrounds/"
# Load list of random images
random_images=("${(@f)$(< "$output_file")}")
populate_random_schemes() {
local tmp=()
for img in "${random_images[@]}"; do
img_name="${img##*/}" # get filename
img_name="${img_name%.*}" # remove extension
tmp+=("$scheme_dir/$img_name.json")
done
random_schemes=("${tmp[@]}")
}
populate_random_schemes
current_workspace=""
handle_workspace_event() {
if [[ "$1" == *"workspace>>"* ]]; then
ws="${1##*>>}"
current_workspace="$ws"
# Map workspace number to array index (Zsh arrays start at 1)
if (( ws <= ${#random_schemes[@]} )); then
wal -f "${random_schemes[$ws]}"
echo "Applied ${random_schemes[$ws]} for workspace $ws"
else
echo "No theme assigned for workspace $ws"
fi
fi
}
# Listen for events from Hyprland
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock |
while read -r line; do
handle_workspace_event "$line"
done
+65
View File
@@ -0,0 +1,65 @@
#!/bin/zsh
export XDG_RUNTIME_DIR="/run/user/1000"
output_file="/tmp/random_images.list"
scheme_dir="/home/inorishio/.cache/wal/schemes/"
background_dir="/home/inorishio/Pictures/Backgrounds/"
# Load list of random images
random_images=("${(@f)$(< "$output_file")}")
populate_random_schemes() {
local tmp=()
for img in "${random_images[@]}"; do
img_name="${img##*/}" # get filename
img_name="${img_name%.*}" # remove extension
tmp+=("$scheme_dir/$img_name.json")
done
random_schemes=("${tmp[@]}")
}
populate_random_schemes
current_workspace=""
handle_workspace_event() {
if [[ "$1" == *"workspace>>"* ]]; then
ws="${1##*>>}"
current_workspace="$ws"
if (( ws <= ${#random_schemes[@]} )); then
wal -f "${random_schemes[$ws]}"
echo "Applied ${random_schemes[$ws]} for workspace $ws"
else
echo "No theme assigned for workspace $ws"
fi
fi
}
# 📦 Poll terminal workspace assignment in background
track_terminal_workspace() {
local last_ws=""
while true; do
terminal_ws=$(hyprctl clients -j | jq -r '.[] | select(.class == "foot") | .workspace.id' | head -n1)
if [[ "$terminal_ws" != "$last_ws" && "$terminal_ws" != "null" ]]; then
if (( terminal_ws <= ${#random_schemes[@]} )); then
wal -f "${random_schemes[$terminal_ws]}"
echo "Applied ${random_schemes[$terminal_ws]} for foot terminal on workspace $terminal_ws"
fi
last_ws="$terminal_ws"
fi
sleep 0.5
done
}
# Start the terminal workspace watcher in background
track_terminal_workspace &
# Listen for Hyprland events in foreground
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock |
while read -r line; do
handle_workspace_event "$line"
done
+26
View File
@@ -0,0 +1,26 @@
#!/bin/zsh
export XDG_RUNTIME_DIR="/run/user/1000"
output_file="/tmp/random_images.list"
random_images=("${(@f)$(< "$output_file")}")
handle_background() {
case $1 in
"workspace>>1") swww img --transition-type none "${random_images[1]}" ;;
"workspace>>2") swww img --transition-type none "${random_images[2]}" ;;
"workspace>>3") swww img --transition-type none "${random_images[3]}" ;;
"workspace>>4") swww img --transition-type none "${random_images[4]}" ;;
"workspace>>5") swww img --transition-type none "${random_images[5]}" ;;
"workspace>>6") swww img --transition-type none "${random_images[6]}" ;;
"workspace>>7") swww img --transition-type none "${random_images[7]}" ;;
"workspace>>8") swww img --transition-type none "${random_images[8]}" ;;
"workspace>>9") swww img --transition-type none "${random_images[9]}" ;;
"workspace>>10") swww img --transition-type none "${random_images[10]}" ;;
esac
}
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock |
while read -r line; do
handle_background "$line"
done