rubywm/desktop.rb

17 lines
525 B
Ruby
Raw Normal View History

2024-01-03 06:12:18 +01:00
2024-01-23 18:56:53 +01:00
2024-01-03 06:12:18 +01:00
class Desktop
attr_accessor :name, :id, :wm, :layout, :window
def initialize(wm, id, name) = (@wm, @id, @name = wm, id, name)
def active? = (@wm.current_desktop_id == self.id)
def children = @wm.windows.values.find_all{_1.desktop==self}
2024-01-14 22:09:00 +01:00
def mapped_regular_children = children.find_all{_1.mapped && !_1.special?}
2024-01-03 06:12:18 +01:00
def show = children.each(&:show)
def hide = children.each(&:hide)
def inspect = "<Desktop id=#{id} window=#{@window}>"
2024-01-23 18:56:53 +01:00
def update_layout = (layout&.call(@wm.focus) if active?)
2024-01-03 06:12:18 +01:00
end