Closed thewatts closed 10 years ago
:+1: for this issue.
I'm having this problem too. There's no problem focusing a pane as long as it's in the last window, but there's no way to switch to a specific window after initialization.
Oh, never mind. It looks like #53 added the focus option for windows. @toobulkeh Try updating the gem, that worked for me.
@thewatts Can you test it with teamocil 1.0 please? Thanks!
Focus isn't working correctly in 1.0.3. In the below example I would expect the last select-window statement to choose window 2.
windows:
- name: window-1
focus: true
root: /
panes:
- ls
- name: window-2
root: /
panes:
- ls
Deep-Thought:~ $ tmux list-windows
0: bash* (1 panes) [242x80] [layout b49d,242x80,0,0,0] @0 (active)
1: bash- (1 panes) [234x62] [layout b95e,234x62,0,0,1] @1
Deep-Thought:~ $ teamocil --debug test
tmux rename-session 'teamocil-session-506052'
tmux new-window -n 'window-1' -c '/'
tmux send-keys -t 0 'ls'
tmux send-keys -t 0 'Enter'
tmux select-layout ''
tmux select-pane -t 0
tmux new-window -n 'window-2' -c '/'
tmux send-keys -t 0 'ls'
tmux send-keys -t 0 'Enter'
tmux select-layout ''
tmux select-pane -t 0
tmux select-window -t 0
@remiprev --- I posted a response days ago... but it must not have gone through.
I'll repost here in the next day or so.
Sorry about that!
The first window (index 0
) in the YAML file has the focus: true
option. Therefore, tmux select-window -t 0
is sent by teamocil
— I don’t see what’s wrong with that.
In the below example I would expect the last select-window statement to choose window 2.
Why?
Because there are already existing windows 0 and 1, so the first window teamocil creates is at index 2. Since teamocil is run within tmux, there is always at least 1 existing window.
Oh, yes, you’re right. I never use teamocil with multiple window layout so I never tested this.
I just pushed a fix on master
— could you test it?
This is also where I should be starting to rewrite the whole test suite :smile:
It didn't work for me, I got the following error.
Deep-Thought:~/Projects/3rdparty/teamocil (master) $ tmux ls
teamocil-session-147586: 1 windows (created Thu Aug 21 10:23:32 2014) [204x51] (attached)
Deep-Thought:~/Projects/3rdparty/teamocil (master) $ teamocil --show test
windows:
- name: window-1
root: "~"
focus: true
panes:
- ls
- name: window-2
root: "~"
panes:
- ls
Deep-Thought:~/Projects/3rdparty/teamocil (master) $ teamocil test
/Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.5/lib/teamocil/tmux/window.rb:48:in `internal_index': undefined method `window_base_index' for Teamocil::Tmux::Window:Class (NoMethodError)
from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.5/lib/teamocil/tmux/session.rb:25:in `block in as_tmux'
from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.5/lib/teamocil/tmux/session.rb:19:in `tap'
from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.5/lib/teamocil/tmux/session.rb:19:in `as_tmux'
from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.5/lib/teamocil/layout.rb:37:in `shell_commands'
from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.5/lib/teamocil/layout.rb:7:in `execute!'
from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.5/lib/teamocil/cli.rb:21:in `run!'
from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.5/bin/teamocil:7:in `<top (required)>'
from /Users/john/.rbenv/versions/2.0.0-p451/bin/teamocil:23:in `load'
from /Users/john/.rbenv/versions/2.0.0-p451/bin/teamocil:23:in `<main>'
Oops sorry, it should work now.
@thewatts @johnhampton I’m going to close the issue as I believe the issue is now fixed. Feel free to reopen if it’s still not working for you!
Here is my current template,
running as:
teamocil rails --here
It won't switch to the "vim" pane inside of "CODE", instead it stays in the "SERVER" window.
Am I doing something wrong?