✨ feat(hypr): game launcher script
it is taken out from hyprdots
This commit is contained in:
parent
0a6826d865
commit
9dcaffad1a
2 changed files with 42 additions and 3 deletions
40
.config/hypr/scripts/rofi/game_launcher
Executable file
40
.config/hypr/scripts/rofi/game_launcher
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/bash
|
||||||
|
# Script taken out from here: https://github.com/prasanthrangan/hyprdots/blob/main/Configs/.config/hypr/scripts/gamelauncher.sh
|
||||||
|
|
||||||
|
STEAM_LIB="$XDG_DATA_HOME/Steam/config/libraryfolders.vdf"
|
||||||
|
STEAM_THUMB="$XDG_DATA_HOME/Steam/appcache/librarycache"
|
||||||
|
|
||||||
|
if [ ! -f $STEAM_LIB ] || [ ! -d $STEAM_THUMB ]; then
|
||||||
|
notify-send "Steam Library Not Found!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check steam mount paths
|
||||||
|
STEAM_PATHS=$(grep '"path"' "$STEAM_LIB" | awk -F '"' '{print $4}')
|
||||||
|
MANIFEST_LIST=$(fd -t f -e acf appmanifest_ $STEAM_PATHS/steamapps/ 2>/dev/null)
|
||||||
|
|
||||||
|
# Read intalled games
|
||||||
|
GAME_LIST=$(echo "$MANIFEST_LIST" | while read acf; do
|
||||||
|
appid=$(grep '"appid"' $acf | cut -d '"' -f 4)
|
||||||
|
if [ -f ${STEAM_THUMB}/${appid}_library_600x900.jpg ]; then
|
||||||
|
game=$(grep '"name"' $acf | cut -d '"' -f 4)
|
||||||
|
echo "$game|$appid"
|
||||||
|
else
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
done | sort)
|
||||||
|
|
||||||
|
echo "$GAME_LIST"
|
||||||
|
|
||||||
|
# Launch rofi menu
|
||||||
|
ROFI_SEL=$(echo "$GAME_LIST" | while read acf; do
|
||||||
|
appid=$(echo $acf | cut -d '|' -f 2)
|
||||||
|
game=$(echo $acf | cut -d '|' -f 1)
|
||||||
|
echo -en "$game\x00icon\x1f${STEAM_THUMB}/${appid}_library_600x900.jpg\n"
|
||||||
|
done | rofi -dmenu)
|
||||||
|
|
||||||
|
# Launch game
|
||||||
|
if [ ! -z "$ROFI_SEL" ]; then
|
||||||
|
LAUNCHID=$(echo "$GAME_LIST" | grep "$ROFI_SEL" | cut -d '|' -f 2)
|
||||||
|
steam -applaunch "${LAUNCHID}" &
|
||||||
|
notify-send "Launching ${ROFI_SEL}..." -i ${STEAM_THUMB}/${LAUNCHID}_library_600x900.jpg
|
||||||
|
fi
|
|
@ -2,9 +2,9 @@ configuration {
|
||||||
/*---------- General setting ----------*/
|
/*---------- General setting ----------*/
|
||||||
modi: "drun,run,file-browser-extended";
|
modi: "drun,run,file-browser-extended";
|
||||||
case-sensitive: false;
|
case-sensitive: false;
|
||||||
cycle: true;
|
cycle: false;
|
||||||
filter: "";
|
filter: "";
|
||||||
scroll-method: 0;
|
scroll-method: 1;
|
||||||
normalize-match: true;
|
normalize-match: true;
|
||||||
show-icons: true;
|
show-icons: true;
|
||||||
icon-theme: "Catppuccin-SE";
|
icon-theme: "Catppuccin-SE";
|
||||||
|
@ -68,7 +68,6 @@ configuration {
|
||||||
|
|
||||||
/*---------- Misc setting ----------*/
|
/*---------- Misc setting ----------*/
|
||||||
terminal: "rofi-sensible-terminal";
|
terminal: "rofi-sensible-terminal";
|
||||||
font: "Mono 12";
|
|
||||||
sort: false;
|
sort: false;
|
||||||
threads: 0;
|
threads: 0;
|
||||||
click-to-exit: true;
|
click-to-exit: true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue