Window operation commands.
Lifecycle
Sizing and position
resize_window/3, move_window/3, set_min_size/3, set_max_size/3,
set_resize_increments/3, set_resizable/2
Window state
maximize_window/2, minimize_window/2, toggle_maximize/1,
set_window_mode/2, toggle_decorations/1, set_window_level/2
Focus and interaction
focus_window/1, drag_window/1, drag_resize_window/2,
request_attention/2, show_system_menu/1
Input
enable_mouse_passthrough/1, disable_mouse_passthrough/1
Visuals
Summary
Functions
Close the window identified by window_id.
Disable mouse passthrough on a window.
Start drag-resizing the window from the given edge/corner direction.
Start dragging the window.
Enable mouse passthrough on a window (clicks pass through to windows below).
Give focus to a window, bringing it to the front.
Maximize or restore a window.
Minimize or restore a window.
Move a window to the given position.
Request user attention for a window. Urgency can be :informational or :critical.
Resize a window to the given dimensions.
Take a screenshot of a window. Result arrives as a tagged event.
Sets the window icon from raw RGBA pixel data.
Set the maximum size of a window.
Set the minimum size of a window.
Set whether a window is resizable.
Sets the resize increment size for a window.
Set window stacking level (:normal, :always_on_top, :always_on_bottom).
Set window mode (windowed, fullscreen, etc.).
Show the system menu for a window.
Toggle window decorations (title bar, borders).
Toggle window maximized state.
Functions
@spec close_window(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()
Close the window identified by window_id.
@spec disable_mouse_passthrough(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()
Disable mouse passthrough on a window.
@spec drag_resize_window( window_id :: Plushie.Command.window_id(), direction :: atom() | String.t() ) :: Plushie.Command.t()
Start drag-resizing the window from the given edge/corner direction.
@spec drag_window(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()
Start dragging the window.
@spec enable_mouse_passthrough(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()
Enable mouse passthrough on a window (clicks pass through to windows below).
@spec focus_window(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()
Give focus to a window, bringing it to the front.
@spec maximize_window( window_id :: Plushie.Command.window_id(), maximized :: boolean() ) :: Plushie.Command.t()
Maximize or restore a window.
@spec minimize_window( window_id :: Plushie.Command.window_id(), minimized :: boolean() ) :: Plushie.Command.t()
Minimize or restore a window.
@spec move_window( window_id :: Plushie.Command.window_id(), x :: number(), y :: number() ) :: Plushie.Command.t()
Move a window to the given position.
@spec request_attention( window_id :: Plushie.Command.window_id(), urgency :: atom() | nil ) :: Plushie.Command.t()
Request user attention for a window. Urgency can be :informational or :critical.
@spec resize_window( window_id :: Plushie.Command.window_id(), width :: number(), height :: number() ) :: Plushie.Command.t()
Resize a window to the given dimensions.
@spec screenshot( window_id :: Plushie.Command.window_id(), tag :: Plushie.Command.event_tag() ) :: Plushie.Command.t()
Take a screenshot of a window. Result arrives as a tagged event.
@spec set_icon( window_id :: Plushie.Command.window_id(), rgba_data :: binary(), width :: pos_integer(), height :: pos_integer() ) :: Plushie.Command.t()
Sets the window icon from raw RGBA pixel data.
The rgba_data must be a binary of width * height * 4 bytes (one byte
each for R, G, B, A per pixel, row-major). The raw binary is stored as-is
in the command payload. The protocol layer handles format-specific encoding
(native binary for msgpack via Msgpax.Bin, base64 for JSON).
Example
icon_data = File.read!("icon_32x32.rgba")
Plushie.Command.set_icon("main", icon_data, 32, 32)
@spec set_max_size( window_id :: Plushie.Command.window_id(), width :: number(), height :: number() ) :: Plushie.Command.t()
Set the maximum size of a window.
@spec set_min_size( window_id :: Plushie.Command.window_id(), width :: number(), height :: number() ) :: Plushie.Command.t()
Set the minimum size of a window.
@spec set_resizable(window_id :: Plushie.Command.window_id(), resizable :: boolean()) :: Plushie.Command.t()
Set whether a window is resizable.
@spec set_resize_increments( window_id :: Plushie.Command.window_id(), width :: number() | nil, height :: number() | nil ) :: Plushie.Command.t()
Sets the resize increment size for a window.
When set, the window will only resize in multiples of the given width and
height. Pass nil for both to clear the constraint. Useful for terminal
emulators and grid-aligned apps.
@spec set_window_level( window_id :: Plushie.Command.window_id(), level :: atom() | String.t() ) :: Plushie.Command.t()
Set window stacking level (:normal, :always_on_top, :always_on_bottom).
On Wayland, window stacking is compositor-controlled and this command may be silently ignored.
@spec set_window_mode( window_id :: Plushie.Command.window_id(), mode :: atom() | String.t() ) :: Plushie.Command.t()
Set window mode (windowed, fullscreen, etc.).
@spec toggle_decorations(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()
Toggle window decorations (title bar, borders).
@spec toggle_maximize(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()
Toggle window maximized state.