fix to linux xdg token

This commit is contained in:
Peterino2 2026-10-11 12:34:43 -07:00
parent 29fd33965f
commit 8c99ac7912
2 changed files with 13 additions and 2 deletions

View File

@ -9,6 +9,7 @@ pkgs.mkShell {
pkgs.clang-tools
pkgs.rustc
pkgs.cargo
pkgs.libpulseaudio
];
# NixOS does not put desktop libraries in the conventional loader search path.
# This affects running an unwrapped development executable, not compilation.
@ -18,4 +19,6 @@ pkgs.mkShell {
pkgs.libxkbcommon
pkgs.dbus.lib
];
UHA_PULSE_LIBRARY = "${pkgs.libpulseaudio}/lib/libpulse.so.0";
}

View File

@ -59,11 +59,19 @@ fn iconDone(_: ?*anyopaque, _: ?*c.struct_xdg_toplevel_icon_manager_v1) callconv
const icon_listener: c.struct_xdg_toplevel_icon_manager_v1_listener = .{ .icon_size = iconSize, .done = iconDone };
fn format(_: ?*anyopaque, _: ?*c.struct_wl_shm, _: u32) callconv(.c) void {}
const shm_listener: c.struct_wl_shm_listener = .{ .format = format };
var launch_token_read = false;
pub fn initialize() void {
if (launch_token_read) return;
launch_token_read = true;
const token = c.getenv("XDG_ACTIVATION_TOKEN");
if (token != null and token[0] != 0) {
desktopState().launch = backend().app.gpa.dupeSentinel(u8, std.mem.span(token), 0) catch null;
_ = c.unsetenv("XDG_ACTIVATION_TOKEN");
desktopState().launch = backend().app.gpa.dupeSentinel(
u8,
std.mem.span(token),
0,
) catch null;
}
}