-
Notifications
You must be signed in to change notification settings - Fork 2
/
game.sh
executable file
·40 lines (33 loc) · 959 Bytes
/
game.sh
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
37
38
39
40
#!/bin/bash
# Launch steam games from /comfy/ dmenu/fzf/tofi
steam_libraries=(
~/.local/share/Steam
~/.disks/ssd/media/games/Steam
~/.disks/hdd/SteamLibrary
~/.disks/nvme/media/games/steam
)
acfs=()
for path in "${steam_libraries[@]}"; do
acfs+=("$path/steamapps/"*acf)
done
games="$(grep -Hn "name" "${acfs[@]}" |
sed -E 's|'"$HOME"'/?(.*)/[^/]+/steamapps/appmanifest_([0-9]+)\.acf.*"name".*"([^"]+)"|~/\1\t\2\t\3|g' |
sed 's/Counter.*/Dust II/' |
sed -r 's/[0-9]+\s//' |
grep -viE 'proton|redistributable|linux')"
name="$(echo "$games" |
column -ts$'\t' |
picker \
-i \
-l "$(echo "$games" | wc -l)" \
-p "dsteam" \
-nb "#2c323b" \
-nf "#c5cbd8" \
-sb "#3e4e69" \
-sf "#ffffff" |
cut -d' ' -f2- |
sed -E 's/^ +//;s/ +$//')"
[ -n "$name" ] || exit
echo "searching for $name"
game=$(echo "$games" | tee /dev/tty | grep "$name" | cut -d$'\t' -f2)
steam "steam://run/$game"