Skip to content

Commit 87db462

Browse files
committed
feat: Add new scripts, enhance WMs, and refactor configs
This commit introduces a wide range of new utility scripts, enhances Hyprland and Niri configurations with new features like shaders and animations, and introduces initial support for River WM. Key changes include: - New scripts for clipboard management (_tool_clip), system monitoring (cpu.sh, swap.sh ), file downloads (dl), Nix store editing (editnix), GIF processing (gif-to-atlas.sh), and a Spotify CLI (spotify.sh). - Major refactor of wallpaper (bg.sh) and album art (album_art.sh) scripts. - Hyprland: Added hyprshade, hypridle, improved animations & binds, and new shaders. - Niri: Added animation shaders (open.glsl, close.glsl, resize.glsl ) and updated window rules. - Rofi & Zellij: Theming updates and integration with stylix . - Plymouth: New custom video theme. - Nix Flakes: Updated inputs (flake.lock ) and refactored module configurations (flake.nix ). - General code cleanup, bug fixes, and theming polish across various modules.
1 parent 5943c90 commit 87db462

73 files changed

Lines changed: 4827 additions & 1680 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bin/_tool_clip

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/usr/bin/env bash
2+
3+
# --- Image clipboard check ---
4+
clip_is_image() {
5+
if [[ $XDG_SESSION_TYPE == "x11" ]]; then
6+
xclip -selection clipboard -t image/png -o &>/dev/null
7+
else
8+
wl-paste --list-types | grep -q "image/png"
9+
fi
10+
}
11+
12+
# --- Show menu with clipboard preview ---
13+
show_menu() {
14+
if clip_is_image; then
15+
tmpimg=$(mktemp --suffix=.png)
16+
if [[ $XDG_SESSION_TYPE == "x11" ]]; then
17+
xclip -selection clipboard -t image/png -o > "$tmpimg"
18+
else
19+
wl-paste --type image/png > "$tmpimg"
20+
fi
21+
preview_opt="-theme-str 'window { background-image: url(\"$tmpimg\"); }'"
22+
else
23+
clip_preview=$(cso | head -c 500 | tr '\n' ' ')
24+
preview_opt="-mesg \"Clipboard: $clip_preview\""
25+
fi
26+
eval "printf '%s\n' \"\${actions[@]}\" | rofi -dmenu -p 'Clipboard Action:' $preview_opt"
27+
}
28+
29+
# --- Translation submenu ---
30+
translate_menu() {
31+
from=$(printf "auto\nen\nes\nde\nja" | rofi -dmenu -p "Translate FROM:")
32+
[[ -z "$from" ]] && exit
33+
to=$(printf "en\nes\nde\nja" | rofi -dmenu -p "Translate TO:")
34+
[[ -z "$to" ]] && exit
35+
new_clip=$(cso | trans -brief -s "$from" -t "$to")
36+
printf "%s" "$new_clip" | cs
37+
notify-send "Translated ($from$to)" "$new_clip"
38+
exit 0
39+
}
40+
41+
# --- Actions List ---
42+
actions=(
43+
"Uppercase"
44+
"Lowercase"
45+
"Trim whitespace"
46+
"Reverse text"
47+
"Remove newlines"
48+
"Base64 encode"
49+
"Base64 decode"
50+
"QR Encode"
51+
"QR Decode"
52+
"Image OCR → Text"
53+
"Translate (sub menu)"
54+
"Cancel"
55+
)
56+
57+
choice=$(show_menu)
58+
[[ "$choice" == "Cancel" || -z "$choice" ]] && exit
59+
60+
clip=$(cso)
61+
62+
# --- Action handlers ---
63+
case "$choice" in
64+
"Uppercase") new_clip=$(printf "%s" "$clip" | tr '[:lower:]' '[:upper:]') ;;
65+
"Lowercase") new_clip=$(printf "%s" "$clip" | tr '[:upper:]' '[:lower:]') ;;
66+
"Trim whitespace") new_clip=$(printf "%s" "$clip" | sed 's/^[ \t]*//;s/[ \t]*$//') ;;
67+
"Reverse text") new_clip=$(printf "%s" "$clip" | rev) ;;
68+
"Remove newlines") new_clip=$(printf "%s" "$clip" | tr -d '\n') ;;
69+
"Base64 encode") new_clip=$(printf "%s" "$clip" | base64) ;;
70+
"Base64 decode") new_clip=$(printf "%s" "$clip" | base64 --decode 2>/dev/null) ;;
71+
"QR Encode")
72+
tmpqr=$(mktemp --suffix=.png)
73+
printf "%s" "$clip" | qrencode -o "$tmpqr"
74+
if [[ $XDG_SESSION_TYPE == "x11" ]]; then
75+
xclip -selection clipboard -t image/png -i "$tmpqr"
76+
else
77+
wl-copy --type image/png < "$tmpqr"
78+
fi
79+
notify-send "Clipboard Updated" "QR code copied as image"
80+
exit 0
81+
;;
82+
"QR Decode")
83+
tmpimg=$(mktemp --suffix=.png)
84+
if [[ $XDG_SESSION_TYPE == "x11" ]]; then
85+
xclip -selection clipboard -t image/png -o > "$tmpimg"
86+
else
87+
wl-paste --type image/png > "$tmpimg"
88+
fi
89+
new_clip=$(zbarimg --quiet --raw "$tmpimg" 2>/dev/null)
90+
;;
91+
"Image OCR → Text")
92+
tmpimg=$(mktemp --suffix=.png)
93+
if [[ $XDG_SESSION_TYPE == "x11" ]]; then
94+
xclip -selection clipboard -t image/png -o > "$tmpimg"
95+
else
96+
wl-paste --type image/png > "$tmpimg"
97+
fi
98+
new_clip=$(tesseract "$tmpimg" - -l eng 2>/dev/null)
99+
;;
100+
"Translate (sub menu)") translate_menu ;;
101+
*) exit 1 ;;
102+
esac
103+
104+
# --- Update clipboard ---
105+
printf "%s" "$new_clip" | cs
106+
notify-send "Clipboard Updated" "$choice applied"

bin/album_art.sh

Lines changed: 62 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,75 @@
11
#!/usr/bin/env bash
22

3-
album_art=$(playerctl -p spotify metadata mpris:artUrl 2>/dev/null)
43

5-
set() {
6-
echo "$1"
7-
cp "$1" /tmp/cover.jpg
4+
fetch_art() {
5+
local player=$1
6+
local status
7+
status=$(playerctl -p "$player" status 2>/dev/null)
8+
9+
if [[ "$status" == "Playing" || "$status" == "Paused" ]]; then
10+
album_art=$(playerctl -p "$player" metadata mpris:artUrl 2>/dev/null)
11+
if [[ -n "$album_art" ]]; then
12+
echo "$status|$player|$album_art"
13+
fi
14+
fi
815
}
916

10-
if [[ -z $album_art ]]; then
11-
album_art=$(playerctl -p spotify_player metadata mpris:artUrl 2>/dev/null)
12-
13-
if [[ -z $album_art ]]; then
14-
album_art=$(playerctl -p chromium metadata mpris:artUrl 2>/dev/null)
15-
16-
if [[ -z $album_art ]]; then
17-
album_art=$(playerctl -p firefox metadata mpris:artUrl 2>/dev/null)
18-
if [[ -z $album_art ]]; then
19-
exit
20-
else
21-
set $(echo "$album_art" | sed "s/file...//")
22-
exit
23-
fi
24-
25-
exit
26-
else
27-
set $(echo "$album_art" | sed "s/file...//")
28-
exit
29-
fi
30-
fi
31-
fi
17+
declare -A player_art
18+
players=($(playerctl -l 2>/dev/null))
3219

33-
CAD=~/.cache/spotifyPictureCache
20+
# Check each available player
21+
for p in "${players[@]}"; do
22+
result=$(fetch_art "$p")
23+
if [[ -n "$result" ]]; then
24+
status="${result%%|*}"
25+
rest="${result#*|}"
26+
player="${rest%%|*}"
27+
art="${rest#*|}"
28+
player_art["$player"]="$status|$art"
29+
fi
30+
done
31+
32+
# Prioritize 'Playing' first
33+
chosen_art=""
34+
for p in "${players[@]}"; do
35+
data=${player_art["$p"]}
36+
if [[ $data == Playing* ]]; then
37+
chosen_art="${data#*|}"
38+
break
39+
fi
40+
done
3441

35-
if [[ ! -d "$CAD" ]]; then
36-
mkdir $CAD
42+
# Fallback to 'Paused' if no 'Playing'
43+
if [[ -z $chosen_art ]]; then
44+
for p in "${players[@]}"; do
45+
data=${player_art["$p"]}
46+
if [[ $data == Paused* ]]; then
47+
chosen_art="${data#*|}"
48+
break
49+
fi
50+
done
3751
fi
3852

39-
cd $CAD || exit
53+
# Exit if still empty
54+
if [[ -z $chosen_art ]]; then
55+
exit
56+
fi
57+
58+
# Local file (e.g., from browsers)
59+
if [[ "$chosen_art" == file://* ]]; then
60+
path="${chosen_art/file:\/\//}"
61+
set_cover "$path"
62+
exit
63+
fi
4064

41-
file=$(echo "$album_art" | sed 's|.*/||')
65+
# Remote art cache
66+
CAD=~/.cache/spotifyPictureCache
67+
mkdir -p "$CAD"
68+
cd "$CAD" || exit
4269

43-
if ! [ -f "$file" ]; then
44-
wget -c "${album_art}" -q
70+
filename=$(basename "$chosen_art")
71+
if [[ ! -f "$filename" ]]; then
72+
wget -c "$chosen_art" -q
4573
fi
4674

47-
set "$CAD/$file"
75+
echo "$CAD/$filename"

0 commit comments

Comments
 (0)