Method: XDo::XWindow#resize

Defined in:
lib/xdo/xwindow.rb

#resize(width, height, use_hints = false, sync = true) ⇒ Object

Set the size of a window.

Parameters

width

The new width, usually in pixels.

height

The new height, usually in pixels.

use_hints

(false) If true, window sizing hints are used if they’re available. This is usually done when resizing terminal windows to a specific number of rows and columns.

sync

(true) If true, this method blocks until the window has finished resizing.

Return value

Undefined.

Raises

XError

Error executing xdotool.

Example

#Resize a window to 400x300px
xwin.resize(400, 300)
#Resize a terminal window to 100 rows and 100 columns
xtermwin.resize(100, 100, true)

Remarks

This has no effect on maximized winwows.



588
589
590
591
592
593
594
595
# File 'lib/xdo/xwindow.rb', line 588

def resize(width, height, use_hints = false, sync = true)
  err = ""
  opts = []
  opts << "--usehints" if use_hints
  opts << "--sync" if sync
  Open3.popen3("#{XDo::XDOTOOL} windowsize #{opts.join(" ")} #{@id} #{width} #{height}"){|stdin, stdout, stderr| err << stderr.read}
  Kernel.raise(XDo::XError, err) unless err.empty?
end