Add support for options in a window item

For example, you could synchronize all commands sent to a window by
adding this in your window item:

    options:
      synchronize-panes: true

See the `set-window-option` section of the tmux manual (`man tmux`) for
a list of all the options you can use.
This commit is contained in:
Rémi Prévost 2011-10-20 07:21:29 -04:00
parent 331ab490ce
commit ae4eb6b2b0
3 changed files with 14 additions and 2 deletions

View File

@ -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:

View File

@ -1,5 +1,5 @@
module Teamocil
VERSION = "0.1.10"
VERSION = "0.1.11"
autoload :Layout, "teamocil/layout"
autoload :CLI, "teamocil/cli"
end

View File

@ -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