1 stable release
1.0.0 | Jan 25, 2024 |
---|
#956 in GUI
94KB
2K
SLoC
wayland-protocols-async
Wayland client protocols implemented in async as handlers using the Actor-model and tokio messaging
Foreign Toplevel Management List
Implements the zwlr-foreign-toplevel-management-unstable-v1 (ver: 3)
protocol. All toplevels active and open are recorded in a SlotMap
using a unique ToplevelKey
that you can retrieve using messages or receive in events.
Messages ToplevelMessage
List of messages supported are shown in the enum below
GetToplevels
- Returns all currently open toplevel keysGetToplevelMeta
- For a toplevel fetch its meta - title, app_id and stateActivate
- Set a toplevel to focus (using activate method)SetFullscreen
- Set a toplevel to full screenSetMaximize
- Set a toplevel to maximize (if your compositor supports)SetMinimize
- Set a toplevel to minimize (if your compositor supports)UnsetFullscreen
- Unset a toplevel from full screenUnsetMaximize
- Unset a toplevel from maximize (if your compositor supports)UnsetMinimize
- Unset a toplevel from minimize (if your compositor supports)Close
- Close a toplevel application
Events ToplevelEvent
List of events that can be received from the toplevel handler are
Created
- When a new toplevel is createdTitle
- When a toplevel'stitle
is updatedAppId
- When a toplevelapp_id
is updatedDone
- When all changes in the state are sentState
- When the toplevel's state is updated, the state is mapped base on this enumClosed
- When a toplevel is closedOutputEnter
- When a toplevel becomes visible on an outputOutputLeave
- When a toplevel stops becoming visible on an outputParent
- Whenever the parent of the toplevel changes.
Input Method
Implements the zwp-input-method-unstable-v2 (ver: 1)
protocol. Currently covers the input_method
events and requests. This protocol is helpful for triggering virtual keyboards or sending key inputs.
Messages InputMethodMessage
Currently below messages are implemented for this protocol.
CommitString
- Sends the commit string to the applicationSetPreeditString
- Sends the pre-edit string text to the client applicationDeleteSurroundingText
- Removes the surrounding textCommit
- Apply state changes based on above events
Events InputMethodMessage
List of events that can be received from the input method handler are
Activate
- When a text input is focused on the seat and requests the input method to be activated. You can use this to show the virtual keyboard.Deactivate
- When there are no active or focused text input. You can use this to hide the virtual keyboard.Done
- Triggered when all changes are applied.SurroundingText
- Returns the surrounding text with its cursor and selection anchor.TextChangeCause
- Tells the input method why the text surrounding is changedContentType
- Indicates the content type and hint for the input method based on the interface.Unavailable
- The input method is no longer available
Note - The GetInputPopupSurface
and GrabKeyboard
methods are not implemented and its related events.
Output Management
Implements the zwlr-output-management-unstable-v1 (ver: 4)
protocol. This protocol enables you to receive events and metada related to the output, its heads and modes. You can use this protocol to configure the output with methods such as enabling or disabling heads, setting custom modes.
Messages
GetHeads
- Returns all heads in the output along with their metadata, theid
in the response can be used in head related operationsGetHead
- Returns a particular head based on theid
GetMode
- Returns a particular mode based on theid
in the requestEnableHead
- Enables a head on the outputDisableHead
- Disables a head on the outputSetMode
- Sets a mode to the headSetCustomMode
- Sets a custom mode (height, width, refresh rate) for a headSetPosition
- Sets the position for the headSetTransform
- Sets the transform (rotation) for the headSetScale
- Sets the scale (zoom)SetAdaptiveSync
- Enable or disable adaptive sync (if your compositor supports it)
Events
Head
- When a new head appears or immediately when a new manager is boundDone
- When all changes or events have been set for the output manager after it is bound. This is when the output manager is ready to receive configuration eventsFinished
- When the compositor is finished with the manager and won't send any events or accept any configuration any more. The handler will need to be reinstantiated at this point or killed.HeadName
- Describes the head's nameHeadDescription
- Human-readable description of the headHeadPhysicalSize
- Physical size of the headHeadMode
- Introduces a new supported mode for the headHeadEnabled
- Emitted when a head is enabledHeadCurrentMode
- Describes the current mode used by head, only sent when output is enabledHeadPosition
- Describes position of the head in the compositor spaceHeadTransform
- Current transformation applied to the headHeadScale
- Scale value of the headHeadFinished
- Indicates that the head is no longer available. Clients should destroy any references to it.HeadMake
- Describe the manufacturer of the headHeadModel
- Describes the model of the headHeadSerialNumber
- Describes the serial number of the headHeadAdaptiveSync
- Returns status (enabled or disabled) for AdaptiveSyncModeSize
- Describes mode size in the physical hardware units of the output deviceModeRefresh
- Describes the mode's vertical refresh rateModePreferred
- Emitted when a mode is preferred by the output headModeFinished
- Indicates that the mode is no longer available. Clients should destroy any references to it.ConfigurationSucceeded
- Sent after a compositor has successfuly applied all changes sent in configuration requestConfigurationFailed
- Sent if a configuration has failed or the compositor has rejected themConfigurationCancelled
- Sent if the compositor cancels a configuration request due to any change in the output
Session Lock
Implements the ext-session-lock-v1 (ver: 1)
protocol. This protocol enables you to lock and unlock the session alongwith options to reconfigure the locked surface (updating).
Messages
Lock
- Locks the session and returns boolean. You can pass a customwl_surface
to the handler else the handler will create an empty surface.Unlock
- Unlocks the session and returns booleanAckConfigure
- Acknowledge the last configure event (useful for redrawing)
Events
Locked
- When the session is lockedFinished
- When the session lock is no longer available and needs to be destroyedConfigure
- Sent once the session is locked or if the output geometery changes
Examples
Check the examples for sample on how to use the protocols
Credits
wayland.rs
- This project depends extensively onsmithay/wayland.rs
for its implementation of all wayland (stable, unstable, wlr, misc) protocols in rust.
Dependencies
~7–17MB
~229K SLoC