Allow worker configuration with run control file

This commit is contained in:
Thibault Jouan 2015-04-17 20:20:18 +00:00
parent 9ea43ee69a
commit 5ab463cde5
3 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,9 @@
Feature: `worker' run control keyword
Scenario: configures the modifier key
Given a run control file with:
"""
worker :mux
"""
And I start uhwm
Then the output must match /work.+event.+mux/i

View File

@ -32,6 +32,10 @@ module Uh
@env.keybinds[translate_keysym keysym] = block @env.keybinds[translate_keysym keysym] = block
end end
def worker type, **options
@env.worker = [type, options]
end
private private

View File

@ -80,6 +80,18 @@ module Uh
expect(env.keybinds.keys).to include %i[f shift] expect(env.keybinds.keys).to include %i[f shift]
end end
end end
describe '#worker' do
it 'sets the worker type in the env' do
rc.worker :some_worker
expect(env.worker[0]).to eq :some_worker
end
it 'sets the worker options in the env' do
rc.worker :some_worker, some: :option
expect(env.worker[1]).to eq({ some: :option })
end
end
end end
end end
end end