From fc738ad9cc733d9c0bb42d9395219c18d26375e3 Mon Sep 17 00:00:00 2001 From: Samuel Garneau Date: Thu, 17 Feb 2011 22:12:39 -0500 Subject: [PATCH] Add rename-session --- README.mkd | 22 ++++++++++++---------- lib/teamocil/layout.rb | 9 ++++++++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/README.mkd b/README.mkd index 30253c6..a0266e6 100644 --- a/README.mkd +++ b/README.mkd @@ -14,16 +14,18 @@ Teamocil is a tool used to automatically create windows and splits in `tmux` wit # ~/.teamocil/sample.yml - windows: - - name: sample-window - splits: - - cmd: cd ~/Code/sample/www - - cmd: - - cd ~/Code/sample/www - - rails s - width: 50 - - cmd: memcached -p 11211 -vv - height: 25 + session: + name: sample-session + windows: + - name: sample-window + splits: + - cmd: cd ~/Code/sample/www + - cmd: + - cd ~/Code/sample/www + - rails s + width: 50 + - cmd: memcached -p 11211 -vv + height: 25 will create a new window named `sample-window` with a layout like this: diff --git a/lib/teamocil/layout.rb b/lib/teamocil/layout.rb index 7786782..7cd5d68 100644 --- a/lib/teamocil/layout.rb +++ b/lib/teamocil/layout.rb @@ -16,7 +16,14 @@ module Teamocil def generate_commands # {{{ output = [] - @layout["windows"].each_with_index do |window, window_index| + if @layout["session"].nil? + windows = @layout["windows"] + else + output << "tmux rename-session #{@layout["session"]["name"]}" + windows = @layout["session"]["windows"] + end + + windows.each_with_index do |window, window_index| if options.include?(:here) and window_index == 0 output << "tmux rename-window #{window["name"]}"