-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.sh
More file actions
executable file
·36 lines (30 loc) · 839 Bytes
/
Copy pathscript.sh
File metadata and controls
executable file
·36 lines (30 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -euo pipefail
cd ~/fastfetch-spotify-canvas && bun dist/index.cjs > /dev/null 2>&1 && cd
MEDIA_DIR="$HOME/images/fastfetch/media"
shopt -s nullglob
files=("$MEDIA_DIR"/*)
if [ "${#files[@]}" -eq 0 ]; then
echo "No media file found in $MEDIA_DIR" >&2
exit 1
fi
if [ "${#files[@]}" -gt 1 ]; then
file=$(ls -1t "$MEDIA_DIR"/* | head -n1)
else
file="${files[0]}"
fi
#(case-insensitive)
ext="${file##*.}"
ext="${ext,,}" # lowercase
case "$ext" in
jpg|jpeg)
kitten icat -n --place 45x45@0x6 --scale-up --align left "$file" | fastfetch --logo-width 45 --raw -
;;
gif)
kitten icat -n --place 30x30@0x6 --scale-up --align left "$file" | fastfetch --logo-width 30 --raw -
;;
*)
echo "Unsupported media type: .$ext" >&2
exit 2
;;
esac