Class: WMCtrl::Window
Constant Summary
collapse
- STATE_FULLSCREEN =
"_NET_WM_STATE_FULLSCREEN"
Instance Method Summary
collapse
Methods inherited from DataHash
#initialize, #method_missing
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class WMCtrl::DataHash
Instance Method Details
#[](key) ⇒ Object
72
73
74
75
76
77
78
|
# File 'lib/wmctrl/wmctrl.rb', line 72
def [](key)
if key == :wm_class
self.wm_class
else
super(key)
end
end
|
#activate ⇒ Object
109
110
111
|
# File 'lib/wmctrl/wmctrl.rb', line 109
def activate
action(:activate)
end
|
#active? ⇒ Boolean
84
85
86
|
# File 'lib/wmctrl/wmctrl.rb', line 84
def active?
self[:active]
end
|
#change_state(*args) ⇒ Object
105
106
107
|
# File 'lib/wmctrl/wmctrl.rb', line 105
def change_state(*args)
action(:change_state, *args)
end
|
#close ⇒ Object
101
102
103
|
# File 'lib/wmctrl/wmctrl.rb', line 101
def close
action(:close)
end
|
#fullscreen? ⇒ Boolean
90
91
92
|
# File 'lib/wmctrl/wmctrl.rb', line 90
def fullscreen?
self[:state].include?(STATE_FULLSCREEN)
end
|
#place(opts = {}) ⇒ Object
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/wmctrl/wmctrl.rb', line 119
def place(opts = {})
if opts[:desktop]
if opts[:desktop] == :current
action(:move_to_current)
elsif (opts[:desktop] != self[:desktop])
action(:move_to_desktop, opts[:desktop])
end
end
x = self[:exterior_frame][0]
y = self[:exterior_frame][1]
width = self[:exterior_frame][2]
height = self[:exterior_frame][3]
extent_horizontal = self[:frame_extents][0] + self[:frame_extents][1]
extent_vertical = self[:frame_extents][2] + self[:frame_extents][3]
width = opts[:width] if opts[:width] && (opts[:width] != width)
height = opts[:height] if opts[:height] && (opts[:height] != height)
x = opts[:x] if opts[:x] && (opts[:x] != x)
y = opts[:y] if opts[:y] && (opts[:y] != y)
action(:move_resize, 0, x + self[:frame_extents][0], y + self[:frame_extents][1], width - extent_horizontal, height - extent_vertical)
end
|
#position ⇒ Object
140
141
142
143
|
# File 'lib/wmctrl/wmctrl.rb', line 140
def position
a = self[:exterior_frame]
{ :x => a[0], :y => a[1], :width => a[2], :height => a[3] }
end
|
#sticky? ⇒ Boolean
80
81
82
|
# File 'lib/wmctrl/wmctrl.rb', line 80
def sticky?
self[:desktop] == -1
end
|
#wm_class ⇒ Object
Because method name "class" is a basic ruby method, we use "wm_class" to get window class.
65
66
67
|
# File 'lib/wmctrl/wmctrl.rb', line 65
def wm_class
self[:class]
end
|