dmenu-scripts/dmenu-games

35 lines
727 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-07-17 11:03:13 +02:00
source $HOME/.config/dmenu/config
2022-05-27 17:32:44 +02:00
get_category () {
2022-07-17 11:03:13 +02:00
category=$( game-run list | $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
2022-07-17 11:03:13 +02:00
game=$(game-run list $category | sed '/-18+/d' | $DMENU -p "Choose game to run:")
2022-05-27 17:32:44 +02:00
elif [ "$1" = "-a" ]; then
2022-07-17 11:03:13 +02:00
game=$(game-run list $category | $DMENU -p "Choose game to run:")
2022-05-27 17:32:44 +02:00
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
2022-07-01 17:24:08 +02:00
if game-run launch "$game"; then
2022-05-27 17:32:44 +02:00
quick-notify "Game run" "Launching $game"
else
quick-notify "Game run" "Failed to launch $game"
fi