Module: Plushie::Command::Window

Defined in:
lib/plushie/command/window.rb

Overview

Window operation commands.

== Lifecycle close_window

== Sizing and position resize_window, move_window, set_min_size, set_max_size, set_resize_increments, set_resizable

== Window state maximize_window, minimize_window, toggle_maximize, set_window_mode, toggle_decorations, set_window_level

== Focus and interaction focus_window, drag_window, drag_resize_window, request_attention, show_system_menu

== Input enable_mouse_passthrough, disable_mouse_passthrough

== Visuals set_icon, screenshot

Class Method Summary collapse

Class Method Details

.allow_automatic_tabbing(enabled) ⇒ Cmd

Parameters:

  • enabled (Boolean)

Returns:



143
# File 'lib/plushie/command/window.rb', line 143

def allow_automatic_tabbing(enabled) = Cmd.new(type: :system_op, payload: {op: "allow_automatic_tabbing", enabled:})

.close_window(window_id) ⇒ Cmd

Parameters:

  • window_id (String)

Returns:



33
# File 'lib/plushie/command/window.rb', line 33

def close_window(window_id) = Cmd.new(type: :window_op, payload: {op: "close", window_id:})

.disable_mouse_passthrough(window_id) ⇒ Cmd

Parameters:

  • window_id (String)

Returns:



122
# File 'lib/plushie/command/window.rb', line 122

def disable_mouse_passthrough(window_id) = Cmd.new(type: :window_op, payload: {op: "mouse_passthrough", window_id:, enabled: false})

.drag_resize_window(window_id, direction) ⇒ Cmd

Parameters:

  • window_id (String)
  • direction (Symbol)

Returns:



87
# File 'lib/plushie/command/window.rb', line 87

def drag_resize_window(window_id, direction) = Cmd.new(type: :window_op, payload: {op: "drag_resize", window_id:, direction: direction.to_s})

.drag_window(window_id) ⇒ Cmd

Parameters:

  • window_id (String)

Returns:



82
# File 'lib/plushie/command/window.rb', line 82

def drag_window(window_id) = Cmd.new(type: :window_op, payload: {op: "drag", window_id:})

.enable_mouse_passthrough(window_id) ⇒ Cmd

Parameters:

  • window_id (String)

Returns:



118
# File 'lib/plushie/command/window.rb', line 118

def enable_mouse_passthrough(window_id) = Cmd.new(type: :window_op, payload: {op: "mouse_passthrough", window_id:, enabled: true})

.focus_window(window_id) ⇒ Cmd

Bring window to front and give it focus.

Parameters:

  • window_id (String)

Returns:



73
# File 'lib/plushie/command/window.rb', line 73

def focus_window(window_id) = Cmd.new(type: :window_op, payload: {op: "gain_focus", window_id:})

.maximize_window(window_id, maximized = true) ⇒ Cmd

Parameters:

  • window_id (String)
  • maximized (Boolean) (defaults to: true)

Returns:



50
# File 'lib/plushie/command/window.rb', line 50

def maximize_window(window_id, maximized = true) = Cmd.new(type: :window_op, payload: {op: "maximize", window_id:, maximized:})

.minimize_window(window_id, minimized = true) ⇒ Cmd

Parameters:

  • window_id (String)
  • minimized (Boolean) (defaults to: true)

Returns:



55
# File 'lib/plushie/command/window.rb', line 55

def minimize_window(window_id, minimized = true) = Cmd.new(type: :window_op, payload: {op: "minimize", window_id:, minimized:})

.move_window(window_id, x, y) ⇒ Cmd

Parameters:

  • window_id (String)
  • x (Integer)
  • y (Integer)

Returns:



45
# File 'lib/plushie/command/window.rb', line 45

def move_window(window_id, x, y) = Cmd.new(type: :window_op, payload: {op: "move", window_id:, x:, y:})

.request_attention(window_id, urgency) ⇒ Cmd

Parameters:

  • window_id (String)
  • urgency (Symbol)

    :informational, :critical

Returns:



92
# File 'lib/plushie/command/window.rb', line 92

def request_attention(window_id, urgency) = Cmd.new(type: :window_op, payload: {op: "request_attention", window_id:, urgency: urgency&.to_s})

.resize_window(window_id, width, height) ⇒ Cmd

Parameters:

  • window_id (String)
  • width (Integer)
  • height (Integer)

Returns:



39
# File 'lib/plushie/command/window.rb', line 39

def resize_window(window_id, width, height) = Cmd.new(type: :window_op, payload: {op: "resize", window_id:, width:, height:})

.screenshot(window_id, tag) ⇒ Cmd

Parameters:

  • window_id (String)
  • tag (Symbol)

Returns:



97
# File 'lib/plushie/command/window.rb', line 97

def screenshot(window_id, tag) = Cmd.new(type: :window_query, payload: {op: "screenshot", window_id:, tag: tag.to_s})

.set_icon(window_id, rgba_data, width, height) ⇒ Cmd

Parameters:

  • window_id (String)
  • rgba_data (String)

    raw RGBA pixel data

  • width (Integer)
  • height (Integer)

Returns:



133
# File 'lib/plushie/command/window.rb', line 133

def set_icon(window_id, rgba_data, width, height) = Cmd.new(type: :window_op, payload: {op: "set_icon", window_id:, icon_data: rgba_data, width:, height:})

.set_max_size(window_id, width, height) ⇒ Cmd

Parameters:

  • window_id (String)
  • width (Integer)
  • height (Integer)

Returns:



114
# File 'lib/plushie/command/window.rb', line 114

def set_max_size(window_id, width, height) = Cmd.new(type: :window_op, payload: {op: "set_max_size", window_id:, width:, height:})

.set_min_size(window_id, width, height) ⇒ Cmd

Parameters:

  • window_id (String)
  • width (Integer)
  • height (Integer)

Returns:



108
# File 'lib/plushie/command/window.rb', line 108

def set_min_size(window_id, width, height) = Cmd.new(type: :window_op, payload: {op: "set_min_size", window_id:, width:, height:})

.set_resizable(window_id, resizable) ⇒ Cmd

Parameters:

  • window_id (String)
  • resizable (Boolean)

Returns:



102
# File 'lib/plushie/command/window.rb', line 102

def set_resizable(window_id, resizable) = Cmd.new(type: :window_op, payload: {op: "set_resizable", window_id:, resizable:})

.set_resize_increments(window_id, width, height) ⇒ Cmd

Parameters:

  • window_id (String)
  • width (Integer)
  • height (Integer)

Returns:



139
# File 'lib/plushie/command/window.rb', line 139

def set_resize_increments(window_id, width, height) = Cmd.new(type: :window_op, payload: {op: "set_resize_increments", window_id:, width:, height:})

.set_window_level(window_id, level) ⇒ Cmd

Parameters:

  • window_id (String)
  • level (Symbol)

    :normal, :always_on_top, :always_on_bottom

Returns:



78
# File 'lib/plushie/command/window.rb', line 78

def set_window_level(window_id, level) = Cmd.new(type: :window_op, payload: {op: "set_level", window_id:, level: level.to_s})

.set_window_mode(window_id, mode) ⇒ Cmd

Parameters:

  • window_id (String)
  • mode (Symbol)

    :fullscreen, :windowed, :hidden

Returns:



60
# File 'lib/plushie/command/window.rb', line 60

def set_window_mode(window_id, mode) = Cmd.new(type: :window_op, payload: {op: "set_mode", window_id:, mode: mode.to_s})

.show_system_menu(window_id) ⇒ Cmd

Parameters:

  • window_id (String)

Returns:



126
# File 'lib/plushie/command/window.rb', line 126

def show_system_menu(window_id) = Cmd.new(type: :window_op, payload: {op: "show_system_menu", window_id:})

.toggle_decorations(window_id) ⇒ Cmd

Parameters:

  • window_id (String)

Returns:



68
# File 'lib/plushie/command/window.rb', line 68

def toggle_decorations(window_id) = Cmd.new(type: :window_op, payload: {op: "toggle_decorations", window_id:})

.toggle_maximize(window_id) ⇒ Cmd

Parameters:

  • window_id (String)

Returns:



64
# File 'lib/plushie/command/window.rb', line 64

def toggle_maximize(window_id) = Cmd.new(type: :window_op, payload: {op: "toggle_maximize", window_id:})