diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 17:05:59 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-13 17:05:59 +0300 |
| commit | d4d13e616cb15ef22479d9cb97922af93317a01a (patch) | |
| tree | 17f812ae15c239ce7d6c2a50a292ebd91375db8e /src/platform/freedesktop/dbus.h | |
| parent | 305a341022c8119b89b32420445bb38154073fc4 (diff) | |
Add desktop services: open URI, notify, appearance, bell, and paths
wsap_term keeps per-platform code for opening links, notifications, the
bell, high-contrast detection, the executable and bundle paths, and the
default locale. These now live behind <yasl/desktop.h>.
On Linux, src/platform/freedesktop serves both backends. Opening a URI
runs xdg-open from PATH through a double fork, so the opener gets default
signal dispositions, an empty mask, a new session, and none of the
application's descriptors. Notifications and the Settings portal use the
session bus through libdbus-1, an optional dependency behind -Ddbus.
Appearance falls back to GTK_THEME without a portal. The bell uses
xdg-system-bell on Wayland and the XKB bell on X11.
Cocoa implements the same calls with NSWorkspace, UserNotifications, the
effective appearance, NSBeep, the bundle, and CFLocale. That code is not
built or run here; it needs a macOS check.
The desktop test runs under dbus-run-session against a fake notification
server and portal, and uses a fake xdg-open to check argument passing,
signal state, and descriptor inheritance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/platform/freedesktop/dbus.h')
| -rw-r--r-- | src/platform/freedesktop/dbus.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/platform/freedesktop/dbus.h b/src/platform/freedesktop/dbus.h new file mode 100644 index 0000000..3b1662b --- /dev/null +++ b/src/platform/freedesktop/dbus.h @@ -0,0 +1,16 @@ +#ifndef YASL_FREEDESKTOP_DBUS_H +#define YASL_FREEDESKTOP_DBUS_H + +#include <stdbool.h> +#include <stdint.h> + +/* Session-bus helpers. The first call opens a private connection that later + * calls reuse. Each returns false when YASL is built without libdbus-1 or no + * session bus is reachable. Call from one thread at a time. */ + +/* Send org.freedesktop.Notifications.Notify without waiting for a reply. */ +bool bus_notify(const char *app, const char *title, const char *body); +/* Read an integer setting through the XDG Settings portal, waiting briefly. */ +bool portal_read_int(const char *ns, const char *key, int64_t *out); + +#endif |
