Skip to content

Instantly share code, notes, and snippets.

@maotovisk
Last active March 2, 2024 23:06
Show Gist options
  • Save maotovisk/1bf3a7c9054890f91b9234c3663c03a2 to your computer and use it in GitHub Desktop.
Save maotovisk/1bf3a7c9054890f91b9234c3663c03a2 to your computer and use it in GitHub Desktop.
Integrating native file explorer on wine with linux.

Integrating native file explorer on wine with linux.

This is mostly aimed at osu! mappers/storyboarders who need an easy way to access osu! beatmap folders through wine.

Introduction

This is a quick tutorial on how you can edit some wine registry files to make wine open the native linux file explorer when clicking the Open folder menu on whatever application uses it, since the explorer.exe application doesn't integrate that well with the linux environment.

The main use-case for this workaround is the case of those who need to work with a high bandwidth of files being moved around and shared/edited/whatever it's needed to do with it. eg. osu!mappers

Doing it...

1. Getting the useful info

First of all, you need to locate the path to your osu! prefix:

  • for people using the osu-wine script, by default it's located at ~/.local/share/osu-wine/WINE.win32;
  • for people using lutris, it is asked to the user at the beginning of the installation process the path they wanted to install osu to;
  • if you have a custom prefix, you may know its path.

IMPORTANT: Custom wine builds

Many osu! players use custom wine builds to achieve better audio latency, if you happen to do so, please get the path of the custom wine build.

2. Creating the linux winepath wrapper

IMPORTANT: Remember to make sure ~/.local/bin/ is in your PATH envvar.

We will create a shell script on ~/.local/bin/ named run_as_linux:

#!/bin/sh
truepath="${2%?}"
unixpath="$(printf '%s\n' "$truepath" | sed -e 's/\\/\//g' -e 's/^.://'; echo x)"
unixpath="${unixpath%?x}"
exec "$1" "$unixpath"

IMPORTANT:

  • Remember to replace /path/to/custom/wine/ with your custom wine path. If you're using the system wine, replace it with just wine;
  • After finishing saving the file, remember to set its permissions correctly chmod +x ~/.local/bin/run_as_linux.

3. Editing Wine Registry

Now we need to set up the wine prefix to call the wrapper from the application running inside it, to do that, we will create a new registry entry for the Open folder command.

After opening wine registry (regedit) with WINEPREFIX=/path/to/osu/prefix wine regedit, we will do the following steps to create the association with the wrapper:

IMPORTANT: Remember to replace /path/to/osu/prefix with the path of your osu! installation wineprefix.

  1. Create a command key inside HKEY_CLASSES_ROOT\folder\shell\open;
  2. Delete the ddeexec key in HKEY_CLASSES_ROOT\folder\shell\open;
  3. Set the (Default) value to /bin/sh run_as_linux NATIVE_FILE_MANAGER "%1";

IMPORTANT: Remember to replace NATIVE_FILE_MANAGER with your native file manager binary (eg. nautilus, dolphin, thunar, etc.) or xdg-open.

Done

Now you're able to open your beatmap folder (or every other folder) into your native file explorer from osu!

References

Integrando explorador de arquivos nativos sobre wine com linux.

Isto se destina principalmente a osu! mappers/storyboarders que precisam de uma maneira fácil de acessar as pastas de um mapa de osu! através do wine.

Introdução

Este é um tutorial rápido sobre como você pode editar alguns arquivos de registro de vinho para fazer o vinho abrir o explorador de arquivos nativo do linux ao clicar no menu "Abrir pasta" em qualquer aplicativo que o utilize, uma vez que o aplicativo "explorer.exe" não se integra tão bem com o ambiente do linux.

O principal caso de uso para esta solução é o caso daqueles que precisam trabalhar com uma grande largura de banda de arquivos sendo movimentados e compartilhados/editados/alguma coisa que seja necessária para fazer com ele. eg. osu!mappers

Fazendo o trabalho...

1. Obtendo as informações úteis

Antes de tudo, você precisa localizar o caminho para o seu prefixo osu!

  • para pessoas que utilizam o script 'osu-wine', por padrão ele está localizado em ~/.local/share/osu-wine/WINE.win32;
  • para pessoas que utilizam lutris, é solicitado ao usuário no início do processo de instalação o caminho para o qual eles queriam instalar o osu.
  • se você tiver um prefixo personalizado, você pode conhecer seu caminho.

IMPORTANTE: Builds customizadas do wine

Muitos osu! jogadores usam builds personalizadas do wine para alcançar uma melhor latência de áudio, se por acaso você fizer isso, por favor, obtenha o path da build customizada do wine.

2. Criando o wrapper do winepath no linux

IMPORTANTE: Lembre-se de ter certeza que ~/.local/bin/ está no seu PATH.

Criaremos um script shell em ~/.local/bin/ chamado run_as_linux:

#!/bin/sh
truepath="${2%?}"
unixpath="$(printf '%s\n' "$truepath" | sed -e 's/\\/\//g' -e 's/^.://'; echo x)"
unixpath="${unixpath%?x}"
exec "$1" "$unixpath"

IMPORTANTE:

  • Lembre-se de substituir /path/para/o/wine/customizado por seu caminho do wine personalizado. Se você estiver utilizando o wine do sistema, substitua-o por apenas "wine".
  • Após terminar de salvar o arquivo, lembre-se de definir corretamente suas permissões chmod +x ~/.local/bin/run_as_linux.

3. Editando o registro do WINE

Agora precisamos chamar o wrapper do winepath, para fazer isso, criaremos uma nova entrada de registro para o comando Open folder.

Após abrir o registro do wine (regedit) com WINEPREFIX=/path/para/o/prefixo/do/osu/ wine regedit, faremos os seguintes passos para criar a associação com o wrapper:

IMPORTANTE: Lembre-se de substituir /path/para/o/prefixo/do/osu/ pelo caminho para seu prefixo da instalação do osu! .

  1. Crie uma chave "command" dentro da pasta HKEY_CLASSES_ROOT\folder\shell\open;
  2. Apague a chave ddeexec em HKEY_CLASSES_ROOT\folder\shell\open;
  3. Defina o valor (Padrão) para /bin/sh run_as_linux NATIVE_FILE_MANAGER "%1". IMPORTANTE: Lembre-se de substituir NATIVE_FILE_MANAGER pelo binário de seu gerenciador de arquivos nativo (por exemplo: nautilus, dolphin, thunar, etc.).

Pronto

Agora você pode abrir sua pasta de beatmap (ou qualquer outra pasta) em seu explorador de arquivos nativo do osu!

Referências

Traduzido com a versão gratuita do tradutor - www.DeepL.com/Translator - adaptado e revisado por maot.

@Roadhog360
Copy link

Roadhog360 commented Mar 2, 2024

Doesn't work on Ubuntu 20.04 with Wine 9.2, still uses Wine's default file explorer even after completing all of the steps to the letter.
I put Z:\home\roadhog360\.local\bin in my path and everything else the guide asked, but no dice, this simply did nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment