Class: WMCtrl::Window
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
97
98
99
100
101
102
103
|
# File 'lib/wmctrl/wmctrl.rb', line 97
def [](key)
if key == :wm_class
self.wm_class
else
super(key)
end
end
|
#activate ⇒ Object
161
162
163
|
# File 'lib/wmctrl/wmctrl.rb', line 161
def activate
action(:activate)
end
|
#active? ⇒ Boolean
109
110
111
|
# File 'lib/wmctrl/wmctrl.rb', line 109
def active?
self[:active]
end
|
#change_state(*args) ⇒ Object
157
158
159
|
# File 'lib/wmctrl/wmctrl.rb', line 157
def change_state(*args)
action(:change_state, *args)
end
|
#close ⇒ Object
153
154
155
|
# File 'lib/wmctrl/wmctrl.rb', line 153
def close
action(:close)
end
|
#fullscreen? ⇒ Boolean
113
114
115
|
# File 'lib/wmctrl/wmctrl.rb', line 113
def fullscreen?
self[:state].include?("_NET_WM_STATE_FULLSCREEN")
end
|
#hidden? ⇒ Boolean
133
134
135
|
# File 'lib/wmctrl/wmctrl.rb', line 133
def hidden?
self[:state].include?("_NET_WM_STATE_HIDDEN")
end
|
#maximized_horizontally? ⇒ Boolean
125
126
127
|
# File 'lib/wmctrl/wmctrl.rb', line 125
def maximized_horizontally?
self[:state].include?("_NET_WM_STATE_MAXIMIZED_HORZ")
end
|
#maximized_vertically? ⇒ Boolean
121
122
123
|
# File 'lib/wmctrl/wmctrl.rb', line 121
def maximized_vertically?
self[:state].include?("_NET_WM_STATE_MAXIMIZED_VERT")
end
|
#modal? ⇒ Boolean
117
118
119
|
# File 'lib/wmctrl/wmctrl.rb', line 117
def modal?
self[:state].include?("_NET_WM_STATE_MODAL")
end
|
#place(opts = {}) ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# File 'lib/wmctrl/wmctrl.rb', line 174
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
gravity = opts[:gravity] || GRAVITY_DEFAULT
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, gravity, x + self[:frame_extents][0], y + self[:frame_extents][1], width - extent_horizontal, height - extent_vertical)
end
|
#position ⇒ Object
196
197
198
199
|
# File 'lib/wmctrl/wmctrl.rb', line 196
def position
a = self[:exterior_frame]
{ :x => a[0], :y => a[1], :width => a[2], :height => a[3] }
end
|
#shaded? ⇒ Boolean
129
130
131
|
# File 'lib/wmctrl/wmctrl.rb', line 129
def shaded?
self[:state].include?("_NET_WM_STATE_SHADED")
end
|
141
142
143
|
# File 'lib/wmctrl/wmctrl.rb', line 141
def
self[:state].include?("_NET_WM_STATE_SKIP_PAGER")
end
|
#skipped_by_taskbar? ⇒ Boolean
137
138
139
|
# File 'lib/wmctrl/wmctrl.rb', line 137
def skipped_by_taskbar?
self[:state].include?("_NET_WM_STATE_SKIP_TASKBAR")
end
|
#sticky? ⇒ Boolean
105
106
107
|
# File 'lib/wmctrl/wmctrl.rb', line 105
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.
90
91
92
|
# File 'lib/wmctrl/wmctrl.rb', line 90
def wm_class
self[:class]
end
|