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-11-04 14:54:08 +01:00
|
|
|
load_config () {
|
|
|
|
. $HOME/.config/dmenu/config
|
|
|
|
}
|
2022-07-17 11:03:13 +02:00
|
|
|
|
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-11-04 14:54:08 +01:00
|
|
|
menu () {
|
|
|
|
while [ -z "$game" ]
|
|
|
|
do
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
[ -z "$game" ] && get_category
|
|
|
|
done
|
|
|
|
}
|
2022-05-22 19:36:32 +02:00
|
|
|
|
2022-11-04 14:54:08 +01:00
|
|
|
launch_game () {
|
|
|
|
if game-run launch "$game"; then
|
|
|
|
quick-notify "Game run" "Launching $game"
|
2022-05-27 17:32:44 +02:00
|
|
|
else
|
2022-11-04 14:54:08 +01:00
|
|
|
quick-notify "Game run" "Failed to launch $game"
|
2022-05-27 17:32:44 +02:00
|
|
|
fi
|
2022-11-04 14:54:08 +01:00
|
|
|
}
|
2022-05-22 19:36:32 +02:00
|
|
|
|
2022-11-04 14:54:08 +01:00
|
|
|
main () {
|
|
|
|
load_config
|
|
|
|
|
|
|
|
get_category
|
|
|
|
|
|
|
|
menu
|
|
|
|
|
|
|
|
launch_game
|
|
|
|
}
|
2022-05-27 17:32:44 +02:00
|
|
|
|
2022-11-04 14:54:08 +01:00
|
|
|
main $@
|