Plushie.Command.WindowQuery (Plushie v0.7.0)

Copy Markdown View Source

Window query commands. Results arrive as %Plushie.Event.SystemEvent{} in update/2.

Summary

Functions

Query whether a window is maximized.

Query whether a window is minimized.

Query the monitor size for the display containing a window.

Query the raw platform window ID (e.g. X11 window ID, HWND).

Query the window's current scale factor (DPI scaling).

Query the current window mode (windowed, fullscreen, hidden).

Query the position of a window.

Query the size of a window.

Functions

is_maximized(window_id, tag)

@spec is_maximized(
  window_id :: Plushie.Command.window_id(),
  tag :: Plushie.Command.event_tag()
) ::
  Plushie.Command.t()

Query whether a window is maximized.

Result arrives as %Plushie.Event.SystemEvent{tag: tag, value: boolean}.

is_minimized(window_id, tag)

@spec is_minimized(
  window_id :: Plushie.Command.window_id(),
  tag :: Plushie.Command.event_tag()
) ::
  Plushie.Command.t()

Query whether a window is minimized.

Result arrives as %Plushie.Event.SystemEvent{tag: tag, value: boolean}.

monitor_size(window_id, tag)

@spec monitor_size(
  window_id :: Plushie.Command.window_id(),
  tag :: Plushie.Command.event_tag()
) ::
  Plushie.Command.t()

Query the monitor size for the display containing a window.

Result arrives as %Plushie.Event.SystemEvent{tag: tag, value: data} where data is %{width: width, height: height} or nil if the monitor cannot be determined.

raw_id(window_id, tag)

@spec raw_id(
  window_id :: Plushie.Command.window_id(),
  tag :: Plushie.Command.event_tag()
) ::
  Plushie.Command.t()

Query the raw platform window ID (e.g. X11 window ID, HWND).

Result arrives as %Plushie.Event.SystemEvent{tag: tag, value: platform_id}.

scale_factor(window_id, tag)

@spec scale_factor(
  window_id :: Plushie.Command.window_id(),
  tag :: Plushie.Command.event_tag()
) ::
  Plushie.Command.t()

Query the window's current scale factor (DPI scaling).

Result arrives as %Plushie.Event.SystemEvent{tag: tag, value: factor}.

window_mode(window_id, tag)

@spec window_mode(
  window_id :: Plushie.Command.window_id(),
  tag :: Plushie.Command.event_tag()
) ::
  Plushie.Command.t()

Query the current window mode (windowed, fullscreen, hidden).

Result arrives as %Plushie.Event.SystemEvent{tag: tag, value: mode}.

window_position(window_id, tag)

@spec window_position(
  window_id :: Plushie.Command.window_id(),
  tag :: Plushie.Command.event_tag()
) ::
  Plushie.Command.t()

Query the position of a window.

Result arrives as %Plushie.Event.SystemEvent{tag: tag, value: data} where data is %{x: x, y: y} or nil if unavailable.

window_size(window_id, tag)

@spec window_size(
  window_id :: Plushie.Command.window_id(),
  tag :: Plushie.Command.event_tag()
) ::
  Plushie.Command.t()

Query the size of a window.

Result arrives as %Plushie.Event.SystemEvent{tag: tag, value: data} where data is %{width: width, height: height}.