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

close_window(window_id)

@spec close_window(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()

Close the window identified by window_id.

disable_mouse_passthrough(window_id)

@spec disable_mouse_passthrough(window_id :: Plushie.Command.window_id()) ::
  Plushie.Command.t()

Disable mouse passthrough on a window.

drag_resize_window(window_id, direction)

@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.

drag_window(window_id)

@spec drag_window(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()

Start dragging the window.

enable_mouse_passthrough(window_id)

@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).

focus_window(window_id)

@spec focus_window(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()

Give focus to a window, bringing it to the front.

maximize_window(window_id, maximized \\ true)

@spec maximize_window(
  window_id :: Plushie.Command.window_id(),
  maximized :: boolean()
) ::
  Plushie.Command.t()

Maximize or restore a window.

minimize_window(window_id, minimized \\ true)

@spec minimize_window(
  window_id :: Plushie.Command.window_id(),
  minimized :: boolean()
) ::
  Plushie.Command.t()

Minimize or restore a window.

move_window(window_id, x, y)

@spec move_window(
  window_id :: Plushie.Command.window_id(),
  x :: number(),
  y :: number()
) ::
  Plushie.Command.t()

Move a window to the given position.

request_attention(window_id, urgency \\ nil)

@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.

resize_window(window_id, width, height)

@spec resize_window(
  window_id :: Plushie.Command.window_id(),
  width :: number(),
  height :: number()
) ::
  Plushie.Command.t()

Resize a window to the given dimensions.

screenshot(window_id, tag)

@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.

set_icon(window_id, rgba_data, width, height)

@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)

set_max_size(window_id, width, height)

@spec set_max_size(
  window_id :: Plushie.Command.window_id(),
  width :: number(),
  height :: number()
) ::
  Plushie.Command.t()

Set the maximum size of a window.

set_min_size(window_id, width, height)

@spec set_min_size(
  window_id :: Plushie.Command.window_id(),
  width :: number(),
  height :: number()
) ::
  Plushie.Command.t()

Set the minimum size of a window.

set_resizable(window_id, resizable)

@spec set_resizable(window_id :: Plushie.Command.window_id(), resizable :: boolean()) ::
  Plushie.Command.t()

Set whether a window is resizable.

set_resize_increments(window_id, width, height)

@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.

set_window_level(window_id, level)

@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.

set_window_mode(window_id, mode)

@spec set_window_mode(
  window_id :: Plushie.Command.window_id(),
  mode :: atom() | String.t()
) ::
  Plushie.Command.t()

Set window mode (windowed, fullscreen, etc.).

show_system_menu(window_id)

@spec show_system_menu(window_id :: Plushie.Command.window_id()) ::
  Plushie.Command.t()

Show the system menu for a window.

toggle_decorations(window_id)

@spec toggle_decorations(window_id :: Plushie.Command.window_id()) ::
  Plushie.Command.t()

Toggle window decorations (title bar, borders).

toggle_maximize(window_id)

@spec toggle_maximize(window_id :: Plushie.Command.window_id()) :: Plushie.Command.t()

Toggle window maximized state.