Wine Bar
A Wine prefix manager for Linux with explicit support for Apple silicon Macs (think Asahi Linux).
It works on regular x86_64 Linux systems as well, though this configuration receives less testing. Support for generic non-Apple arm64 systems is currently missing, though it shouldn't be hard to add - PRs are welcome!
This project is mainly written in Dart / Flutter, with some C and C++ code for auxilliary tools.
The project was inspired by another project written in Flutter / Dart called Wine Prefix Manager, though no code from that project was used in this one.
Why have I created something from scratch rather than contribute to the above mentioned project? I had two goals:
- To be able to run Windows software on my Linux-running Macbook Air M2, which is my daily driver. I didn't want to use Steam, yet I wanted a user-friendly solution.
- To learn Dart / Flutter. Normally I am a C++ guy.
I concluded that creating something from scratch was a better way to achive the 2nd goal.
Demo Video
WineBarDemo.mp4
Limitations
The only serious limitation of Wine Bar is how it handles running multiple apps simultaneously in the same Wine prefix. Perhaps I shouldn't have allowed that in the first place, but for those rare cases where you really need that, I made that possible. When you launch more than one executable in the same prefix, you'll notice some or all of the following symptoms:
- Wine Bar will think your executable is still running when it has actually exited.
- Force-stopping a running executable may do nothing or it may terminate all executables running in a prefix, not just the one you want to stop.
On Apple silicon Macs, these symptoms appear even when running executables in different Wine prefixes simultaneously.
The complexity here comes from the fact that the wine process starts the windows executable it was asked to run and then exits immediately without waiting for that windows executable to finish. That's not terribly hard to workaround with a single windows executable running, but very hard for more than one executable. Currently, I don't have plans to tackle this limitation.
Running
On regular x86_64 Linux systems, you are good to go!
On Apple silicon Macs, you need to install a few dependencies first:
On Debian-based distros:
sudo apt install muvm fex-emu
On Fedora-based distros:
sudo dnf install muvm fex-emu
Running an AppImage
While AppImages can be run just by making them executable and double clicking them, pinning them to a taskbar doesn't work in most (all?) desktop environments. The suggested solution is to use an app called Gear Lever to open and run AppImages:
- Install
Gear Level. - Right click an
.AppImagefile and selectOpen with Gear Levelor similar. - Click
Move to the app menu. - Click
Launch.
An .AppImage file started that way can be pinned to a taskbar just fine. As a bonus, Gear Level can automatically update your AppImages. Use the following update settings:
| Parameter | Value |
|---|---|
| Source | Github |
| Repo URL | https://github.com/Tulon/WineBar |
| Release file name | WineBar*-x64.AppImage (or WineBar*-arm64.AppImage for Apple silicon Macs) |
| Allow pre-releases | off |
Another option is the AppImageLauncher app, which works similarly to Gear Level.
Building
First, install Flutter (which also installs Dart) by following the official instructions. In addition to the prerequisite packages listed in the installation instructions, I also had to install the following ones: cmake, ninja (ninja-build on Ubuntu), clang++, gtk3-devel (libgtk-3-dev on Ubuntu).
Don't install Flutter from Snap, see below why.
The Flutter from Snap
In general, using the Flutter from Snap to build Flutter software on Linux is a good idea, as that makes your app compatible with older distros. In practice though, the Flutter from Snap can't be used to build Wine Bar, as Wine Bar also builds some C and C++ helper tools (some of them cross-compiled to Win32) that have some special needs:
- They need a newer version of CMake than the one provided (and imposed on you) by the Flutter Snap.
- One of the helper tools uses the Vulkan API and so needs the
libvulkan-devpackage to be included as part of the Flutter Snap.
Therefore, for development, I suggest simply installing the upstream version of Flutter, as mentioned above. For distribution though, we do want compatibility with older distros, as provided by the Flutter from Snap. The solution adopted by Wine Bar is to fork the Flutter Snap and build and install it as part of the Wine Bar CI build process. See here for more details.
Another option would be doing a Docker build on an older distro or a regular build on an older Github Actions runner. Unfortunately, that option is also problematic, as our cross-compiled Win32 helper tools happen to use C++23, which is simply not available on older distros.
Additional Dependencies
The helper tools we build require some additional dependencies:
On Debian-based distros:
sudo apt-get install mingw-w64-i686-dev g++-mingw-w64-i686 binutils-mingw-w64-i686 libvulkan-dev
On Fedora-based distros:
sudo dnf install mingw32-gcc-c++ mingw32-binutils vulkan-loader-devel
Making a Build
Now, we are ready to build Wine Bar:
cd <project_folder> flutter pub get flutter build linux --release
The build will go to <project_folder>/build/linux/$arch/release/bundle.
Building an AppImage
cd <project_folder> ./packaging/scripts/build_appimage.sh <x64|arm64>
The AppImage will end up in <project_folder>/build/linux/$arch/release.
Regenerating the Generated Files
cd <project_folder> dart pub global activate rps dart pub global activate dbus
Now, we have to add $HOME/.pub-cache/bin to PATH. The way to do that depends on the shell you are running. For Bash, the following will do the trick:
echo 'export PATH=$PATH:$HOME/.pub-cache/bin' >> ~/.bashrc source ~/.bashrc
Now, let's generate the generated files.
cd <project_folder> rps generate
About the Author
Checkout out my blog if you are interested!