dmenu-scripts/dmenu-games

44 lines
780 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
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
menu () {
while [ -z "$game" ]
do
2023-02-22 19:24:09 +01:00
[ -z "$1" ] && game=$(game-run list "$category" | sed '/-18+/d' | $DMENU -p "Choose game to run:")
2023-02-22 19:24:09 +01:00
[ "$1" = "-a" ] && game=$(game-run list "$category" | $DMENU -p "Choose game to run:")
[ -z "$game" ] && get_category
done
}
2022-05-22 19:36:32 +02:00
launch_game () {
if game-run launch "$game"; then
quick-notify "Game run" "Launching $game"
2022-05-27 17:32:44 +02:00
else
quick-notify "Game run" "Failed to launch $game"
2022-05-27 17:32:44 +02:00
fi
}
2022-05-22 19:36:32 +02:00
main () {
load_config
get_category
menu
launch_game
}
2022-05-27 17:32:44 +02:00
main $@