-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmonitor.rb
More file actions
32 lines (26 loc) · 855 Bytes
/
Copy pathmonitor.rb
File metadata and controls
32 lines (26 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Monitor class to represent physical display monitors
module WM
class Monitor
attr_reader :id, :width, :height, :xoffset, :yoffset, :geometry
# The monitor is the single source of truth for which desktop it shows;
# Desktop#monitor is derived from this (see desktop.rb).
attr_accessor :active_desktop
def initialize(id, width:, height:, xoffset:, yoffset:)
@id = id
@active_desktop = nil
@width = width
@height = height
@xoffset = xoffset
@yoffset = yoffset
@geometry = X11::Form::Geometry.new.tap do |g|
g.x = xoffset
g.y = yoffset
g.width = width
g.height = height
end.freeze
end
def inspect
"<WM::Monitor id=#{@id} active_desktop=#{@active_desktop&.id} geometry=#{@geometry.inspect}>"
end
end
end