dmenu-scripts/dmenu-games

33 lines
699 B
Plaintext
Raw Normal View History

2022-04-22 12:48:51 +02:00
#!/bin/sh
2021-05-01 09:12:33 +02:00
2022-04-22 12:48:51 +02:00
# dmenu script to open up my games
2022-04-05 16:59:13 +02:00
2022-05-27 17:32:44 +02:00
get_category () {
category=$( game-run --list categories | dmenu -p "Choose game category:")
2021-05-01 09:12:33 +02:00
2022-05-27 17:32:44 +02:00
[ -z "$category" ] && exit 0
}
2022-05-22 19:36:32 +02:00
2022-05-27 17:32:44 +02:00
get_category
while [ -z "$game" ]
do
2022-05-22 19:36:32 +02:00
2022-05-27 17:32:44 +02:00
if [ -z "$1" ]; then
game=$(game-run --list $category | sed '/-18+/d' | dmenu -p "Choose game to run:")
elif [ "$1" = "-a" ]; then
game=$(game-run --list $category | dmenu -p "Choose game to run:")
else
printf '%s\n' "Option $1 doesn't exit!!"
exit 1
fi
2022-05-22 19:36:32 +02:00
2022-05-27 17:32:44 +02:00
[ -z "$game" ] && get_category
done
if game-run "$game"; then
quick-notify "Game run" "Launching $game"
else
quick-notify "Game run" "Failed to launch $game"
fi