LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 10-04-2019, 04:20 AM   #1
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,237

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
Prefix-aware menuing system to launch WINE games


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 its menu after I've already set them up.

No, I don't use the game installation scripts provided by Lutris' community. Is my way the best way? 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 came up with a menuing system to launch these games after you've set up their prefixes.

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. We also have the path to the prefix and the path to the executable.

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

Code:
#!/usr/bin/env bash

set -e

GAME=$(jq -r 'keys[]' ~/.config/wine_games.json | dmenu)

if [[ "$GAME" == "" ]]; then
  exit
fi

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, rofi, or even FZF) and jq. Note also the use of "wine start /unix", which properly sets the Windows program's working directory.

You just execute the script, select the game from the menu, and launch it.

This is actually my third project to work with WINE prefixes, after wine_env and Wine Bottler, so I do have some experience with this.

Last edited by dugan; 10-10-2019 at 07:09 PM.
 
Old 10-04-2019, 07:31 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,237

Original Poster
Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
As above, I have a prefix for running GOG Galaxy. All I did in it was "winetricks corefonts", because Galaxy needs it, and I'm too proud to install those fonts system-wide.

I used GOG Galaxy to install Blasphemous. I also expect GOG Galaxy to keep it updated.

I set up a separate prefix with DXVK and Media Foundation, because that's what I need to run Blasphemous.

Note that Proton similarly decouples the WINE prefixes from the game installations, and it also keeps the two in separate directory trees.

Now ~/.config/wine_games.json looks like this:
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"
  },
  "Blasphemous": {
    "exe": "/home/dugan/.local/share/wineprefixes/galaxy/drive_c/Program Files (x86)/GOG Galaxy/Games/Blasphemous/blasphemous.exe",
    "prefix": "/home/dugan/.local/share/wineprefixes/dxvk_mf"
  }
}
And my menu has two entries.

Last edited by dugan; 10-04-2019 at 09:49 AM.
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wine x64 w/ 32-bit prefix “page fault on read access to 0xffffffff in 16-bit code” rcx11 Linux - Virtualization and Cloud 0 12-27-2018 04:48 PM
configure: error: expected an absolute directory name for --prefix: -prefix=/home/jeo Nownuri Linux - Newbie 2 03-28-2015 07:40 AM
wide-dhcpv6 - trying to obtain /60 prefix, "invalid prefix" psycroptic Linux - Server 3 05-26-2014 08:31 AM
difference b/w AF_ prefix and PF_ prefix related to socket Ashok_mittal Linux - Newbie 1 03-20-2008 04:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 09:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration