https://github.com/avaloniaui/avalonia.dbus
A managed D-Bus client and service library built with Avalonia in mind.
https://github.com/avaloniaui/avalonia.dbus
avalonia dbus freedeskto gtk kde libdbus linux macos roslyn-generator sourcegenerator
Last synced: 3 days ago
JSON representation
A managed D-Bus client and service library built with Avalonia in mind.
- Host: GitHub
- URL: https://github.com/avaloniaui/avalonia.dbus
- Owner: AvaloniaUI
- License: mit
- Created: 2026-01-21T11:57:34.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-02-23T17:51:21.000Z (4 days ago)
- Last Synced: 2026-02-24T00:55:05.685Z (4 days ago)
- Topics: avalonia, dbus, freedeskto, gtk, kde, libdbus, linux, macos, roslyn-generator, sourcegenerator
- Language: C#
- Homepage: https://avaloniaui.net
- Size: 718 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Avalonia.DBus
A managed D-Bus client and service library for .NET 8+, with an integrated Roslyn source generator for strongly-typed proxies and handlers.
Built for [Avalonia](https://avaloniaui.net/) but usable from any .NET application. Runs on Linux and macOS.
## Features
- Async/await API for method calls, signal subscriptions, and object registration
- Source generator that produces typed proxies and handler base classes from D-Bus XML interface definitions
- Full D-Bus type system support: variants, structs, dictionaries, arrays, object paths, signatures
- Bus-side methods integration (name ownership, introspection, name watching)
## Quick Start
```csharp
await using var connection = await DBusConnection.ConnectSessionAsync();
// Call a method
var reply = await connection.CallMethodAsync(
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"ListNames");
// Subscribe to signals
using var sub = await connection.SubscribeAsync(
sender: null,
path: "/org/freedesktop/Notifications",
iface: "org.freedesktop.Notifications",
member: "NotificationClosed",
handler: async msg =>
{
var id = (uint)msg.Body[0];
Console.WriteLine($"Notification {id} closed");
});
```
## Source Generator
Add D-Bus XML interface files to your project and set the `DBusGeneratorMode` item metadata to `Proxy` or `Handler`. The source generator emits strongly-typed classes so you can call D-Bus methods and implement interfaces without manual message construction.
See the `samples/` directory for working examples, including an AT-SPI2 accessibility service implementation.
## Requirements
- .NET 8.0 or later
- `libdbus` installed on the host system
## License
MIT -- see [LICENSE.md](LICENSE.md).