Class: Swm::Window
- Inherits:
-
Object
- Object
- Swm::Window
- Defined in:
- lib/swm/window.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
- #height ⇒ Object
-
#initialize(id) ⇒ Window
constructor
A new instance of Window.
- #move(x, y) ⇒ Object
- #pos_x ⇒ Object
- #pos_y ⇒ Object
- #set(x, y, w, h) ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(id) ⇒ Window
Returns a new instance of Window.
10 11 12 |
# File 'lib/swm/window.rb', line 10 def initialize(id) @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/swm/window.rb', line 4 def id @id end |
Class Method Details
Instance Method Details
#height ⇒ Object
18 19 20 |
# File 'lib/swm/window.rb', line 18 def height xwininfo_integer_property "Height" end |
#move(x, y) ⇒ Object
30 31 32 33 34 |
# File 'lib/swm/window.rb', line 30 def move(x, y) x ||= pos_x y ||= pos_y set x, y, width, height end |
#pos_x ⇒ Object
22 23 24 |
# File 'lib/swm/window.rb', line 22 def pos_x xwininfo_integer_property "Absolute upper-left X" end |
#pos_y ⇒ Object
26 27 28 |
# File 'lib/swm/window.rb', line 26 def pos_y xwininfo_integer_property "Absolute upper-left Y" end |
#set(x, y, w, h) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/swm/window.rb', line 36 def set(x, y, w, h) x ||= pos_x y ||= pos_y w ||= width h ||= height command = "wmctrl -i -r #{@id} -e 0,#{x},#{y},#{w},#{h}" system command raise "Error running #{command}" unless $?.success? clear_cache end |
#width ⇒ Object
14 15 16 |
# File 'lib/swm/window.rb', line 14 def width xwininfo_integer_property "Width" end |