![]() |
VOOZH | about |
dotnet add package Microsoft.Maui.Platforms.Linux.Gtk4.Essentials --version 0.1.0-preview.11.26317.2
NuGet\Install-Package Microsoft.Maui.Platforms.Linux.Gtk4.Essentials -Version 0.1.0-preview.11.26317.2
<PackageReference Include="Microsoft.Maui.Platforms.Linux.Gtk4.Essentials" Version="0.1.0-preview.11.26317.2" />
<PackageVersion Include="Microsoft.Maui.Platforms.Linux.Gtk4.Essentials" Version="0.1.0-preview.11.26317.2" />Directory.Packages.props
<PackageReference Include="Microsoft.Maui.Platforms.Linux.Gtk4.Essentials" />Project file
paket add Microsoft.Maui.Platforms.Linux.Gtk4.Essentials --version 0.1.0-preview.11.26317.2
#r "nuget: Microsoft.Maui.Platforms.Linux.Gtk4.Essentials, 0.1.0-preview.11.26317.2"
#:package Microsoft.Maui.Platforms.Linux.Gtk4.Essentials@0.1.0-preview.11.26317.2
#addin nuget:?package=Microsoft.Maui.Platforms.Linux.Gtk4.Essentials&version=0.1.0-preview.11.26317.2&prereleaseInstall as a Cake Addin
#tool nuget:?package=Microsoft.Maui.Platforms.Linux.Gtk4.Essentials&version=0.1.0-preview.11.26317.2&prereleaseInstall as a Cake Tool
A .NET MAUI backend for Linux, powered by GTK4. Run your .NET MAUI applications natively on Linux desktops with GTK4 rendering via GirCore bindings.
Status: Early / experimental — contributions and feedback are welcome!
https://github.com/user-attachments/assets/70f2a910-94b3-437c-945a-6b71223c5cd3
<table> <tr> <td><img src="docs/screenshots/home.png" alt="Home" width="400"/><br/><b>Home & Sidebar Navigation</b></td> <td><img src="docs/screenshots/controls.png" alt="Controls" width="400"/><br/><b>Interactive Controls</b></td> </tr> <tr> <td><img src="docs/screenshots/collectionview.png" alt="CollectionView" width="400"/><br/><b>CollectionView (Virtualized)</b></td> <td><img src="docs/screenshots/fontawesome.png" alt="FontAwesome Icons" width="400"/><br/><b>FontAwesome Icons</b></td> </tr> <tr> <td><img src="docs/screenshots/shapes.png" alt="Shapes" width="400"/><br/><b>Shapes & Graphics</b></td> <td><img src="docs/screenshots/layouts.png" alt="Layouts" width="400"/><br/><b>Layouts</b></td> </tr> <tr> <td><img src="docs/screenshots/controltemplate.png" alt="ControlTemplate" width="400"/><br/><b>ControlTemplate & ContentPresenter</b></td> <td><img src="docs/screenshots/pickers.png" alt="Pickers" width="400"/><br/><b>Pickers & Search</b></td> </tr> <tr> <td><img src="docs/screenshots/formattedtext.png" alt="FormattedText" width="400"/><br/><b>FormattedText & Spans</b></td> <td><img src="docs/screenshots/transforms.png" alt="Transforms" width="400"/><br/><b>Transforms & Effects</b></td> </tr> <tr> <td colspan="2"><img src="docs/screenshots/graphics.png" alt="Graphics" width="400"/><br/><b>GraphicsView (Cairo)</b></td> </tr> </table>
| Category | Controls |
|---|---|
| Basic Controls | Label, Button, Entry, Editor, CheckBox, Switch, Slider, Stepper, ProgressBar, ActivityIndicator, Image, ImageButton, BoxView, RadioButton |
| Input & Selection | Picker, DatePicker, TimePicker, SearchBar |
| Collections | CollectionView (virtualized Gtk.ListView), ListView, TableView, CarouselView, SwipeView, RefreshView, IndicatorView |
| Layouts | StackLayout, Grid, FlexLayout, AbsoluteLayout, ScrollView, ContentView, Border, Frame |
| Pages & Navigation | ContentPage, NavigationPage, TabbedPage, FlyoutPage, Shell (flyout, tabs, route navigation) |
| Shapes | Rectangle, Ellipse, Line, Path, Polygon, Polyline — Cairo-rendered with fill, stroke, dash patterns |
| Other | GraphicsView (Cairo), WebView (WebKitGTK) |
Layout architecture: StackLayout, Grid, FlexLayout, and AbsoluteLayout all share a single
LayoutHandler— the MAUILayoutbase class is mapped once, and all concrete layout types resolve through it.
TranslateTo, FadeTo, ScaleTo, RotateTo via GtkPlatformTicker + Gsk.Transform at ~60fps.Gsk.Transform; Shadow (CSS box-shadow), Clip, ZIndex.IContentView handler mapping.DisplayAlert, DisplayActionSheet, DisplayPromptAsync via native GTK4 modal windows.PushModalAsync presents pages as native GTK4 dialog windows by default, with attached properties for custom sizing, content-fit sizing, and inline (legacy) presentation via GtkPage.MenuBarItem / MenuFlyoutItem via Gtk.PopoverMenuBar, integrated into Window and NavigationPage handlers via GtkMenuBarManager (not a standalone handler).ToolTipProperties.Text and ContextFlyout via Gtk.PopoverMenu.GtkThemeManager.ConfigureLifecycleEvents().AddGtk() hooks for OnWindowCreated and OnMauiApplicationCreated..desktop file generation, MauiImage/MauiFont/MauiAsset resource processing.| Status | Services |
|---|---|
| ✅ Done (21) | AppInfo, AppActions, Battery (UPower), Browser (xdg-open), Clipboard (Gdk.Clipboard), Connectivity (NetworkManager), DeviceDisplay, DeviceInfo, Email (xdg-open mailto:), FilePicker (Gtk.FileDialog), FileSystem (XDG dirs), Launcher, Map, MediaPicker, Preferences (JSON), Screenshot, SecureStorage, SemanticScreenReader (AT-SPI), Share (XDG Portal), TextToSpeech (espeak-ng), VersionTracking |
| ⚠️ Partial (2) | Geolocation (GeoClue — basic location only), WebAuthenticator (basic OAuth via system browser) |
| ❌ Stub (13) | Accelerometer, Barometer, Compass, Contacts, Flashlight, Geocoding, Gyroscope, HapticFeedback, Magnetometer, OrientationSensor, PhoneDialer, SMS, Vibration — sensors and phone-specific APIs not applicable to desktop Linux |
| Category | Coverage | Notes |
|---|---|---|
| Core Infrastructure | 100% | Dispatcher, handler factory, rendering pipeline |
| Pages | 100% | ContentPage, NavigationPage, TabbedPage, FlyoutPage, Shell |
| Layouts | 100% | All layout types including FlexLayout and AbsoluteLayout |
| Basic Controls | 100% | All 14 standard controls |
| Input Controls | 100% | Picker, DatePicker, TimePicker, SearchBar |
| Collection Controls | 100% | Virtualized CollectionView, ListView, TableView, CarouselView, SwipeView |
| Navigation & Routing | 100% | Push/pop, Shell routes, query parameters |
| Alerts & Dialogs | 100% | All three dialog types + native modal dialog windows |
| Gesture Recognizers | 100% | All 5 gesture types |
| Graphics & Shapes | 100% | GraphicsView + all 6 shape types |
| Font Management | 100% | Registrar, manager, FontImageSource, named sizes |
| WebView | 100% | URL, HTML, JavaScript, navigation events |
| Animations | 100% | All animation types via GtkPlatformTicker |
| VisualStateManager | 100% | All visual states + triggers + behaviors |
| ControlTemplate | 100% | ContentPresenter, TemplatedView |
| Base View Properties | 100% | Opacity, visibility, transforms, shadow, clip, automation |
| FormattedText | 100% | All Span properties via Pango markup |
| MenuBar | 100% | MenuBarItem, MenuFlyoutItem, popover menus — integrated into Window and NavigationPage handlers |
| Essentials | 64% | 21 done + 2 partial of 36 total; 13 stubs (sensors/phone N/A on desktop) |
| Requirement | Version |
|---|---|
| .NET SDK | 10.0+ |
| GTK 4 libraries | 4.x (system package) |
| WebKitGTK (Blazor only) | 6.x (system package) |
sudo apt install libgtk-4-dev libwebkitgtk-6.0-dev \
gobject-introspection libgirepository1.0-dev \
gir1.2-gtk-4.0 gir1.2-webkit-6.0 pkg-config
Note: Fedora package names below are unverified. Please open an issue if they need correction.
sudo dnf install gtk4-devel webkitgtk6.0-devel \
gobject-introspection-devel pkg-config
On Fedora versions where these package names apply,
gtk4-develandwebkitgtk6.0-develtypically include the GObject Introspection typelibs, so separategir1.2-*packages are usually not needed.
# Install the template
dotnet new install Microsoft.Maui.Platforms.Linux.Gtk4.Templates --prerelease
# Create a new Linux MAUI app
dotnet new maui-linux-gtk4 -n MyApp.Linux
cd MyApp.Linux
dotnet run
Add the NuGet package:
dotnet add package Microsoft.Maui.Platforms.Linux.Gtk4 --prerelease
dotnet add package Microsoft.Maui.Platforms.Linux.Gtk4.Essentials --prerelease # optional
Then set up your entry point:
Program.cs
using Microsoft.Maui.Platforms.Linux.Gtk4.Platform;
using Microsoft.Maui.Hosting;
public class Program : GtkMauiApplication
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
public static void Main(string[] args)
{
var app = new Program();
app.Run(args);
}
}
MauiProgram.cs
using Microsoft.Maui.Platforms.Linux.Gtk4.Hosting;
using Microsoft.Maui.Hosting;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp
.CreateBuilder()
.UseMauiAppLinuxGtk4<App>();
return builder.Build();
}
}
Microsoft.Maui.Platforms.Linux.Gtk4 relies on MAUI's normal transitive build assets for XAML.
In Linux head projects, *.xaml files are still collected as MauiXaml and compiled by MAUI's XAML build pipeline without extra package-specific overrides.
Linux head projects can use MAUI resource item groups for common Resources/* paths:
MauiImage from Resources/Images/**MauiFont from Resources/Fonts/**MauiAsset from Resources/Raw/** (with LogicalName defaulting to %(RecursiveDir)%(Filename)%(Extension))MauiIcon from explicit items, or default Resources/AppIcon/appicon.{svg|png|ico}These are copied into build/publish output so image/file lookups can resolve at runtime.
When MauiIcon is present, Linux builds emit hicolor icon-theme files in output and runtime sets the GTK window default icon name from that icon.
Since there is no official -linux TFM (Target Framework Moniker) from Microsoft, MAUI projects can't conditionally include the Linux backend via TargetFrameworks the way they do for Android/iOS/Windows. Instead, use the "Linux head project" pattern:
MyApp/ ← Your existing multi-targeted MAUI project
├── MyApp.csproj (net10.0-android;net10.0-ios;...)
├── App.cs
├── MainPage.xaml
├── ViewModels/
├── Services/
└── Platforms/
├── Android/
├── iOS/
└── ...
MyApp.Linux/ ← New Linux-specific project
├── MyApp.Linux.csproj (net10.0, references Microsoft.Maui.Platforms.Linux.Gtk4)
├── Program.cs (GtkMauiApplication entry point)
└── MauiProgram.cs (builder.UseMauiAppLinuxGtk4<App>())
dotnet new maui-linux-gtk4 -n MyApp.Linux
MyApp.Linux.csproj to your MAUI project (or a shared class library):
<ItemGroup>
<ProjectReference Include="../MyApp/MyApp.csproj" />
</ItemGroup>
dotnet run --project MyApp.Linux
The platform-specific TFMs (net10.0-android, net10.0-ios, etc.) are powered by .NET workloads that Microsoft ships. Creating a custom net10.0-linux TFM would require building and distributing a full .NET workload — complex infrastructure that's unnecessary for most use cases.
The separate project approach works with standard dotnet build/dotnet run, is NuGet-distributable, and keeps your existing MAUI project unchanged.
The GTK4 backend supports for AI-assisted UI inspection, automation, and debugging, including the Blazor CDP bridge. To enable it, set EnableMauiDevFlow=true in Directory.Build.props (or pass it as an MSBuild property):
<PropertyGroup>
<EnableMauiDevFlow>true</EnableMauiDevFlow>
</PropertyGroup>
When enabled, the sample project (samples/Linux.Gtk4.Sample) conditionally references the DevFlow agent and Blazor projects:
<ItemGroup Condition="'$(EnableMauiDevFlow)' == 'true'">
<ProjectReference Include="..\..\..\..\src\DevFlow\Microsoft.Maui.DevFlow.Agent.Gtk\Microsoft.Maui.DevFlow.Agent.Gtk.csproj" />
<ProjectReference Include="..\..\..\..\src\DevFlow\Microsoft.Maui.DevFlow.Blazor.Gtk\Microsoft.Maui.DevFlow.Blazor.Gtk.csproj" />
</ItemGroup>
git clone https://github.com/dotnet/maui-labs.git
cd maui-labs/platforms/Linux.Gtk4
dotnet restore
dotnet build
# Sample app (includes native controls, Blazor Hybrid, essentials, and more)
dotnet run --project samples/Linux.Gtk4.Sample
Linux.Gtk4.slnx # Platform-local solution file
├── src/
│ ├── Linux.Gtk4/ # Core MAUI backend
│ │ ├── Handlers/ # GTK4 handler implementations
│ │ ├── Hosting/ # AppHostBuilderExtensions (UseMauiAppLinuxGtk4)
│ │ └── Platform/ # GTK application, context, layout, theming
│ ├── Linux.Gtk4.Essentials/ # MAUI Essentials for Linux (clipboard, etc.)
│ └── Linux.Gtk4.BlazorWebView/ # BlazorWebView support via WebKitGTK
├── samples/
│ └── Linux.Gtk4.Sample/ # Sample app (controls, Blazor, essentials)
├── templates/ # dotnet new templates
└── docs/ # Documentation
| Package | Purpose |
|---|---|
Microsoft.Maui.Platforms.Linux.Gtk4 |
Core GTK4 backend — handlers, hosting, platform services |
Microsoft.Maui.Platforms.Linux.Gtk4.Essentials |
MAUI Essentials (clipboard, preferences, device info, etc.) |
Microsoft.Maui.Platforms.Linux.Gtk4.BlazorWebView |
Blazor Hybrid support via WebKitGTK |
Microsoft.Maui.Platforms.Linux.Gtk4.Templates |
dotnet new project templates |
| Package | Purpose |
|---|---|
GirCore.Gtk-4.0 |
GObject introspection bindings for GTK4 |
GirCore.WebKit-6.0 |
WebKitGTK bindings (Blazor support) |
Microsoft.Maui.Controls |
.NET MAUI framework |
Tmds.DBus.Protocol |
D-Bus client for Linux platform services |
This project is licensed under the .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
Showing the top 1 popular GitHub repositories that depend on Microsoft.Maui.Platforms.Linux.Gtk4.Essentials:
| Repository | Stars |
|---|---|
|
Redth/MAUI.Sherpa
Let MAUI Sherpa guide you through all your .NET MAUI dev environment needs!
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.11.26317.2 | 38 | 6/17/2026 |
| 0.1.0-preview.10.26274.3 | 116 | 5/24/2026 |
| 0.1.0-preview.9.26258.5 | 100 | 5/11/2026 |
| 0.1.0-preview.8.26256.5 | 60 | 5/6/2026 |
| 0.1.0-preview.7.26229.11 | 64 | 4/29/2026 |
| 0.1.0-preview.6.26229.7 | 63 | 4/29/2026 |