Windows Calculator on Linux via Uno Platform

We’ve done it again. We’ve ported the open-source Windows Calculator to yet another platform: Linux! With all the rumors of a Microsoft browser – Edge – coming to Linux soon, we thought it would be good to show that the open source community can be effective in bringing a piece of Windows to Linux.

If you’ve been following Uno Platform, you’ll know that we’ve already ported the open source Windows Calculator, parts of its codebase dating to the 1990s, to iOS, Android, macOS and Web/WebAssembly as a proof point of the multi-platform reach Uno Platform gives you as a C# and Windows developer. Partnering with the Canonical team, we created and published it to the Ubuntu Snap Store so you can easily download and install it. Thanks a lot Ubuntu team for assisting us in this process, as well as blogging about Uno calculator at Ubuntu blogs.

In addition to Ubuntu, Uno Calculator is now running on Red Hat Enterprise Linux, Linux Mint, Debian, Fedora, openSUSE, Manjaro, Kubuntu, KDE Neon, elementary OS, CentOS and Arch Linux, which means you can run it on anything from a Linux desktop, to a Raspberry Pi.

Some rough stats, extracted from SatCounter Market Share, tell us that the Windows Calculator initially ran on about 1.5 billion Windows devices. Thanks to all the iOS, Android, macOS and Linux ports we did, it can now run now natively on an additional 6 billion devices. And of course, anywhere a modern web browser runs, like in a Tesla.

For those new to Uno Platform – it allows for the creation of pixel-perfect, single-source C# and XAML apps which run natively on Windows, iOS, Android, macOS, Linux and Web via WebAssembly. Uno Platform is Open Source (Apache 2.0) and available on GitHub.

The calculator is available in preview for x64, with more architectures to come. It’s built using the latest .NET 5 RC1 and self-contained publishing for an easy installation.

Uno Platform support for Linux

At UnoConf 2020, we unveiled preview of Uno Platform support for Linux by means of a Skia backend, , with general availability to come as part of our upcoming 3.1 release. As the Uno platform is about reusing your code across platforms, porting the Calculator was mostly about compiling the 1990’s C++ portion of the calculator using GCC, and adding a new .NET 5 “project head”. This new head uses the rest of Calculator source tree which contains all the C# and XAML code that is already running for the other platforms.

The Uno Platform support for Linux comes with the combination of Skia, SkiaSharp, and GtkSharp, which also makes it a target for Windows (7 and 10) and macOS. The development of the Uno Calculator happened primarily on Windows, with additional testing on Linux machines and devices.
We still have work to do on our Skia backend, and we’re actively working on updates that will come regularly to provide performance improvements and enhanced fidelity, such as dark theme support, full keyboard support, etc. You should ‘star’ Uno Platform on GitHub to stay up to date on our Linux support.

Installing Uno Calculator. What is the Snap Store?

For easy distribution of Uno Calculator we decided to publish it to Ubuntu Snap Store. As most of our audience is Microsoft-developer centric, you may be wondering what the Ubuntu Snap store is. The easiest way to explain it is a reference to other app stores – it is like Google Play, but for the Linux world. Snaps work across many Linux distributions so it makes it easy for you as a developer to bundle your dependencies and assets, simplifying installs to a single command.

Publishing to the Snap Store

If you are a C# developer like us, publishing to the snap store is likely not very familiar to you. In the coming weeks we will publish a detailed blog on our experience with working with the Snap store. But for now – it is quite easy and intuitive and here is our Uno Calculator experience.

Using the self-contained publishing feature of .NET 5, and updates for the last RC1, the Uno Calculator is published with the safe “Strict” confinement which allows users to install apps with confidence. The app is also integrated into the desktop’s search features, and can be looked up as “Uno Calculator”.

The snap is also built in the CI for every PR using Azure Devop’s hosted macOS agents and the Snapcraft CLI tools, which makes for a good development and testing pipeline.

You can view the snap YAML file here.

Next Steps

In addition to trying the Windows Calculator on your favorite Linux distribution, we’d appreciate if you give Uno Platform a try – it takes less than 3 minutes to have your first multi-platform app going. Uno Platform enables you to you create pixel-perfect, single-source C# and XAML apps which run natively on Windows, iOS, Android, macOS, Linux and Web via WebAssembly. Uno Platform is Open Source (Apache 2.0) and available on GitHub and our other non-Windows calculator implementations are open-sourced there.

Jerome Laban, CTO , Uno Platform

Share this post: