diff --git a/.config/hypr/scripts/rofi/game_launcher b/.config/hypr/scripts/rofi/game_launcher new file mode 100755 index 00000000..45bf04b1 --- /dev/null +++ b/.config/hypr/scripts/rofi/game_launcher @@ -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 diff --git a/.config/rofi/config.rasi b/.config/rofi/config.rasi index 486cacbf..a345ff23 100644 --- a/.config/rofi/config.rasi +++ b/.config/rofi/config.rasi @@ -2,9 +2,9 @@ configuration { /*---------- General setting ----------*/ modi: "drun,run,file-browser-extended"; case-sensitive: false; - cycle: true; + cycle: false; filter: ""; - scroll-method: 0; + scroll-method: 1; normalize-match: true; show-icons: true; icon-theme: "Catppuccin-SE"; @@ -68,7 +68,6 @@ configuration { /*---------- Misc setting ----------*/ terminal: "rofi-sensible-terminal"; - font: "Mono 12"; sort: false; threads: 0; click-to-exit: true;