Skip to main content

Module platform

Module platform 

Source
Expand description

Platform abstraction layer for par-term.

This module centralises the platform-specific behaviour that would otherwise be scattered across the codebase as inline #[cfg(target_os = ...)] blocks.

§Conventions

  • Every public function in this module has a single, consistent cross-platform signature. The platform branching is contained inside each function body.
  • Consumers import crate::platform and call the function directly — no #[cfg] attributes are required at the call site.

§Contents

FunctionDescription
deliver_desktop_notificationSend a native desktop notification
deliver_desktop_notification_requestSend a notification with identity/click-token support
drain_notification_clicksNon-blocking drain of notification click tokens
primary_modifierWhether the platform’s “primary” modifier key is held

Structs§

NotificationRequest
Parameters for delivering a desktop notification.

Enums§

NotificationUrgency
Notification urgency level, local to the platform layer so this module has no dependency on any particular terminal library’s urgency type. Callers map their own urgency representation onto this at the call site.

Functions§

deliver_desktop_notification
Deliver a native desktop notification.
deliver_desktop_notification_request
Deliver a native desktop notification, with optional identity (replacement) and click-token association. See the module docs for the per-platform support matrix.
drain_notification_clicks
Non-blocking drain of click tokens emitted by notification backends. Safe to call every frame from the event loop.
escape_for_applescript
Escape a string for safe embedding inside an AppleScript double-quoted string.
primary_modifier
Returns true when only the platform’s primary modifier key is held (no Shift, no Alt, and no cross modifier), i.e.:
primary_modifier_with_shift
Returns true when the platform’s primary modifier key and Shift are held, and no other modifiers are held, i.e.: