Article 4RT1P Prefix-aware menuing system to launch WINE games

Prefix-aware menuing system to launch WINE games

by
dugan
from LinuxQuestions.org on (#4RT1P)
I've found that I tend to maintain WINE prefixes from the command line (winecfg, winetricks, DXVK/mf-cab/d9vk installers, environment variables, etc), and all I use Lutris for, is adding the games and their prefixes to the menu after I've already set them up.

No, I don't use the Lutris installers. Is this the best way to do it? Maybe not, but it's what I'm used to.

Anyway, if that's all I'm doing with Lutris then I don't need it. To replace it, I just banged out a menuing system to launch these games after the prefixes are set up.

The data for the menu is a JSON file, at ~/.config/wine_games.json. Here's an example with one entry:

Code:{
"GOG Galaxy": {
"exe": "/home/dugan/.local/share/wineprefixes/galaxy/drive_c/Program Files (x86)/GOG Galaxy/GalaxyClient.exe",
"prefix": "/home/dugan/.local/share/wineprefixes/galaxy"
}
}I assume it's self-explanatory and readable. "GOG Galaxy" is what appears in the menu.

Note that the paths do not contain tildes or variables. This is actually a technical limitation of the menuing script:

Code:#!/usr/bin/env bash

GAME=$(jq -r 'keys[]' ~/.config/wine_games.json | dmenu)
EXE="$(jq -r ".\"$GAME"\".\"exe\" ~/.config/wine_games.json)"
PREFIX="$(jq -r ".\"$GAME"\".\"prefix\" ~/.config/wine_games.json)"

if [ ! -d "$PREFIX" ]; then
echo Prefix not found
exit 1
fi

if [ ! -f "$EXE" ]; then
echo Executable not found
exit 1
fi

WINEDEBUG="-all" WINEPREFIX="$PREFIX" wine start /unix "$EXE"Note the use of dmenu (feel free to replace it with smenu or rofi) and jq. Note also the use of "wine start /unix", which sets the working directory properly.latest?d=yIl2AUoC8zA latest?i=vEvTGmpfwnE:HfFCXlpOCbE:F7zBnMy latest?i=vEvTGmpfwnE:HfFCXlpOCbE:V_sGLiP latest?d=qj6IDK7rITs latest?i=vEvTGmpfwnE:HfFCXlpOCbE:gIN9vFwvEvTGmpfwnE
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments