r/linux • u/AinzTheSupremeOne • 23m ago
Software Release A GTK4 alternative to xdg-desktop-portal-gtk
Hey everyone!
I've been working on xdg-desktop-portal-gtk4, a GTK4-based implementation of the XDG Desktop Portal infrastructure, written in Rust.
GitHub: https://github.com/JohnRTitor/xdg-desktop-portal-gtk4
The project is primarily aimed at users who want to move away from the traditional GTK3-based xdg-desktop-portal-gtk and use GTK4 for their portal dialogs and integrations.
WHAT DOES IT SUPPORT?
The original project by mahkoh (https://github.com/mahkoh/xdg-desktop-portal-gtk4) primarily implemented GTK4 FileChooser support. I've extended that codebase with additional portal interfaces and functionality.
Currently, it implements:
• Access
• Account
• AppChooser
• Clipboard
• DynamicLauncher
• FileChooser (including thumbnail support)
• Inhibit
• Lockdown (currently a stub)
• Notification
• Settings
• USB
I've tested it myself on Hyprland running on NixOS, and I'm particularly interested in getting feedback from other desktop (mainly WM) users.
The intention isn't to replace xdg-desktop-portal-wlr or -hyprland. Compositor-specific functionality such as screen sharing, screenshots and remote desktop should continue to be handled by the appropriate compositor portal.
Instead, you can use this backend for supported interfaces such as FileChooser while retaining Hyprland's portal for compositor-specific functionality.
UNDER THE HOOD
• Written in Rust using GTK4, GLib, Tokio and zbus.
• GTK operations run on the GTK main thread, with D-Bus requests handled by a dedicated asynchronous runtime.
• Automated unit and D-Bus integration tests.
• Compile-time feature selection for individual portals.
• Internationalization and structured logging.
• Conditional GTK patching for a file chooser thumbnail regression affecting GTK 4.22.0–4.22.4.
The project is also being packaged on Arch Linux through the AUR:
https://aur.archlinux.org/packages/xdg-desktop-portal-gtk4-git
A NOTE ABOUT THE PROJECT'S ORIGINS
This project builds upon the original work by mahkoh.
The initial GTK3-to-GTK4 port/rewrite, particularly the Rust implementation, made substantial use of AI coding assistants, under my supervision, with human review, debugging, integration work and extensive testing.
It initially started as a personal project to address my own requirements, but I eventually realised that it could be useful to other Linux desktop users as well.
Bug reports, suggestions and contributions are welcome!
