diff --git a/lib/uh/wm/manager.rb b/lib/uh/wm/manager.rb index f710f2a..393f7f8 100644 --- a/lib/uh/wm/manager.rb +++ b/lib/uh/wm/manager.rb @@ -78,6 +78,12 @@ module Uh @events.emit :unmanage, args: client end + def update_properties window + return unless client = client_for(window) + client.update_window_properties + @events.emit :change, args: client + end + def handle_next_event handle @display.next_event end diff --git a/spec/uh/wm/manager_spec.rb b/spec/uh/wm/manager_spec.rb index 0098f3b..d664d8a 100644 --- a/spec/uh/wm/manager_spec.rb +++ b/spec/uh/wm/manager_spec.rb @@ -248,6 +248,30 @@ module Uh end end + describe '#update_properties' do + context 'with known window' do + before { manager.clients << client } + + it 'tells the client to update its window properties' do + expect(client).to receive :update_window_properties + manager.update_properties window + end + + it 'emits :change event with the client' do + events.on :change, &block + expect(block).to receive(:call).with client + manager.update_properties window + end + end + + context 'with unknown window' do + it 'does not emit any event' do + expect(events).not_to receive :emit + manager.update_properties window + end + end + end + describe '#handle_next_event' do it 'handles the next available event on display' do event = double 'event'