Class: KDE::Window
- Inherits:
-
Object
- Object
- KDE::Window
- Defined in:
- lib/scite/window.rb
Overview
Basic operations over windows in KDE.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#position ⇒ Object
Returns the value of attribute position.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title: nil, pid: nil, wid: nil) ⇒ Window
constructor
A new instance of Window.
- #move(frames: 20, duration: 400.0, **coords) ⇒ Object
- #wait ⇒ Object
- #wid ⇒ Object
Constructor Details
#initialize(title: nil, pid: nil, wid: nil) ⇒ Window
Returns a new instance of Window.
20 21 22 23 |
# File 'lib/scite/window.rb', line 20 def initialize(title: nil, pid: nil, wid: nil) @title, @pid, @wid = title, pid, wid @threads = [] end |
Instance Attribute Details
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
9 10 11 |
# File 'lib/scite/window.rb', line 9 def pid @pid end |
#position ⇒ Object
Returns the value of attribute position.
9 10 11 |
# File 'lib/scite/window.rb', line 9 def position @position end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/scite/window.rb', line 9 def title @title end |
Class Method Details
.find(title: nil) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/scite/window.rb', line 12 def self.find(title: nil) if title if info = `wmctrl -l -p`[/^(0x\w+) +-?\d+ (\d+) .+ #{title}$/] new title: title, pid: $2.to_i, wid: $1 end end end |
Instance Method Details
#move(frames: 20, duration: 400.0, **coords) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/scite/window.rb', line 53 def move(frames: 20, duration: 400.0, **coords) coords.reverse_merge! position #$log << [position, coords, {frames: frames, duration: duration}] Animation.perform(position, coords, frames: frames, duration: duration) {|coords| self.position = coords } end |
#wait ⇒ Object
25 26 27 28 29 |
# File 'lib/scite/window.rb', line 25 def wait @threads.joins @threads = [] self end |
#wid ⇒ Object
31 32 33 |
# File 'lib/scite/window.rb', line 31 def wid @wid ||= `wmctrl -l -p | grep " #@pid "`[/0x\w+/] end |