Writing
Opening Wine folders in your Linux file manager
Make applications running through Wine open folders with Nautilus, Dolphin, Thunar or another native Linux file manager.
I originally needed this for osu! mapping. Opening a beatmap folder from an app running through Wine should hand the folder to Linux, but Wine’s explorer.exe tends to get in the way.
What this changes
The registry change below redirects an application’s Open folder action to your native Linux file manager. It is useful anywhere you move, edit and share a lot of files between Wine and Linux.
For me, that means beatmap folders. The same setup works for other Wine applications that expose the standard folder-opening command.
Set it up
1. Find the Wine prefix
Start by locating the Wine prefix used by osu!:
- The
osu-winescript uses~/.local/share/osu-wine/WINE.win32by default; - Lutris asks for the installation path during setup;
- A custom installation uses whichever prefix you chose.
Custom Wine builds
If you use a custom Wine build for lower audio latency, find its path too. You will need it when opening the registry.
2. Create the Linux path wrapper
Check that ~/.local/bin/ is in your PATH
Create a shell script at ~/.local/bin/run_as_linux:
#!/bin/sh
# This will remove a single quote (') that comes with the argument for some reason
truepath=${2::-1}
# This will execute the first argument with the Unix path provided by the second argument
echo "$truepath" | sed -e 's/\\/\//g' -e 's/://' | sed -r 's/^.{1}//' | xargs -d \\
$1
Then:
- Replace
/path/to/custom/wine/with the path to your custom Wine build. Usewineif you run the system package; - Make the wrapper executable with
chmod +x ~/.local/bin/run_as_linux.
3. Edit the Wine registry
The Wine prefix now needs a registry entry that sends Open folder calls to the wrapper.
Open the registry with WINEPREFIX=/path/to/osu/prefix wine regedit, then:
- Create a
commandkey insideHKEY_CLASSES_ROOT\folder\shell\open; - Delete the
ddeexeckey inHKEY_CLASSES_ROOT\folder\shell\open; - Set the
(Default)value to/bin/sh run_as_linux NATIVE_FILE_MANAGER "%1".
Replace NATIVE_FILE_MANAGER with the binary for Nautilus, Dolphin, Thunar or your preferred manager. xdg-open is also an option.
Test it
Use the application’s Open folder action. The directory should now open in your Linux file manager instead of Wine Explorer.
References
- Wine FAQ
- This Unix & Linux answer
- openglfreak