diff --git a/README.md b/README.md index 70ce59d..c52b74c 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,14 @@ If you are not using a top-level `session` key, then the first key of your layou * `root` (the directory in which every split will be created) * `filters` (a hash of `before` and `after` commands to run for each split) * `splits` (an array of split items) +* `options` (a hash of tmux options, see `man tmux` for a list) #### Example windows: - name: my-first-window + options: + synchronize-panes: true root: ~/Projects/foo-www filters: before: diff --git a/lib/teamocil.rb b/lib/teamocil.rb index 88a3619..b8f8272 100644 --- a/lib/teamocil.rb +++ b/lib/teamocil.rb @@ -1,5 +1,5 @@ module Teamocil - VERSION = "0.1.10" + VERSION = "0.1.11" autoload :Layout, "teamocil/layout" autoload :CLI, "teamocil/cli" end diff --git a/lib/teamocil/layout.rb b/lib/teamocil/layout.rb index 61517da..eb5267d 100644 --- a/lib/teamocil/layout.rb +++ b/lib/teamocil/layout.rb @@ -23,6 +23,7 @@ module Teamocil def generate_commands # {{{ output = [] + # Support renaming of current session if @layout["session"].nil? windows = @layout["windows"] else @@ -39,7 +40,8 @@ module Teamocil output << "tmux new-window -n \"#{window["name"]}\"" end - # Make sure we have a `filters` key and it contains arrays + # Make sure we have all the keys we need + window["options"] ||= {} window["filters"] ||= {} window["filters"]["before"] ||= [] window["filters"]["after"] ||= [] @@ -71,6 +73,13 @@ module Teamocil end end + # Set tmux options + window["options"].each_pair do |option, value| + value = "on" if value === true + value = "off" if value === false + output << "tmux set-window-option #{option} #{value}" + end + end # Set the focus in the first split