Something went wrong. Try again.
A GPU terminal emulator for Wayland and Windows on libghostty-vt, drawing with Vulkan, running a program on a pty or a serial port.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
//! The application ID Windows knows harrier's windows by, its//! AppUserModelID: which taskbar button they are on, which jump list that//! shows, and which pin in Start is theirs. Without one of its own a//! program is known by its path, so a harrier pinned from its Start Menu//! shortcut, which says `dev.jcollie.harrier`, would be a button apart//! from its own windows.//!//! An elevated harrier is `dev.jcollie.harrier.elevated`: its windows,//! whose programs run as administrator, are on a button of their own,//! not among the others. Toasts are `dev.jcollie.harrier`'s either way//! (see `Portal.zig`).
const std = @import("std");const win32 = @import("win32").everything;
const req = @import("../request.zig");const elevation = @import("elevation.zig");
const log = std.log.scoped(.app_user_model);
const L = std.unicode.utf8ToUtf16LeStringLiteral;
pub const id = L(req.app_id);pub const elevated_id = L(req.app_id ++ ".elevated");
/// This harrier's ID.pub fn current() [:0]const u16 { return if (elevation.elevated()) elevated_id else id;}
/// Gives this process its ID: before it has a window or a jump list, which/// take the ID the process has when they are made.pub fn set() void { const result = win32.SetCurrentProcessExplicitAppUserModelID(current()); if (result.failed) log.warn("Windows would not take harrier's application ID ({f})", .{result});}
test "the process takes harrier's ID" { set(); var got: ?[*:0]u16 = null; try std.testing.expect(!win32.GetCurrentProcessExplicitAppUserModelID(&got).failed); defer win32.CoTaskMemFree(got); try std.testing.expectEqualSlices(u16, current(), std.mem.span(got.?));}