Implement `layout' run control keyword

Allow configuration of the layout by specifying either a class or an
instance.
This commit is contained in:
Thibault Jouan
2015-04-26 00:59:24 +00:00
parent 7c06b52664
commit bf6f08e848
5 changed files with 69 additions and 10 deletions

View File

@@ -21,8 +21,8 @@ module Uh
def_delegators :@output, :print, :puts
attr_reader :output, :keybinds
attr_accessor :verbose, :debug, :rc_path, :layout_class, :modifier,
:worker
attr_accessor :verbose, :debug, :rc_path, :modifier, :worker,
:layout, :layout_class
def initialize output
@output = output

View File

@@ -32,6 +32,14 @@ module Uh
@env.keybinds[translate_keysym *keysyms] = block
end
def layout obj
if obj.is_a? Class
@env.layout_class = obj
else
@env.layout = obj
end
end
def worker type, **options
@env.worker = [type, options]
end