tummy 1.1.2 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68a623f3ea08292162fb23244e4d205a3dbf1977
4
- data.tar.gz: 979e16a770e741a38ff24c60d85450501dc973cd
3
+ metadata.gz: 38652abbd388a1042e3080751b4a631ace7d77ab
4
+ data.tar.gz: d5910e51c1accb9c5c30f61d5cf556d87d5f5277
5
5
  SHA512:
6
- metadata.gz: 9b800c787a752e80d3b83d1a2308118f5d3a8c2b4586e0d4fadeb0f1dd8e03aaa99239d3ed85f09bc0fe6641756a90c7ce3a1084b9e94139e325eadaf0e87fc7
7
- data.tar.gz: ec6d5c2270ae981c2891b61863abdf7db650c7ee5ff6edcdf22acdc9f7aae9dda867a31d1abfd9a3aaa8bb3421386c7c6b97db8eb871d943ebc1054c3762e0be
6
+ metadata.gz: 49139f09afc804bfb54eb17949a6f000164b06e8539b8fc0fdd560a4e1661e0cc2e19e22bf9190aafa7a87f2de60b5ed8a821d1c4181f132cca20fc6cb5dfac8
7
+ data.tar.gz: 2681153c1a16cf756dc74e5b74cbb09c053e8f7b56dc8e8c2646b52305f0fc821960f60404b616ddce94b976bdee373895875383ccf3d47479904b5aae96f53b
@@ -18,4 +18,8 @@ window "play", [
18
18
  pane("echo awesome", :vertical),
19
19
  ]
20
20
 
21
+ # if you comment this out it will focus the first window when the session is started
22
+ focus_window "server-iex"
23
+ # focus_window 0 # you can even focus a window by index starting at 0
24
+
21
25
  # vim: filetype=ruby
data/exe/tummy CHANGED
@@ -11,15 +11,15 @@ class Runner
11
11
  attach_to_running_session
12
12
  create_session
13
13
  create_windows
14
- focus_first_window
14
+ focus_window
15
15
  attach_to_running_session
16
16
  end
17
17
 
18
18
  def session; tmux.session_name end
19
19
  def directory; tmux.directory_name end
20
20
 
21
- def focus_first_window
22
- run_cmd "tmux select-window -t #{session}:0"
21
+ def focus_window
22
+ run_cmd "tmux select-window -t #{session}:#{tmux.focused_window}"
23
23
  end
24
24
 
25
25
  def create_session
@@ -74,6 +74,17 @@ class Tmux
74
74
  Runner.new(self).run
75
75
  end
76
76
 
77
+ def focus_window(window_name_or_index)
78
+ @focused_window = window_name_or_index
79
+ end
80
+
81
+ def focused_window
82
+ # try to find the window with the name
83
+ index = @windows.find_index{|w| w.name == @focused_window}
84
+
85
+ index || @focused_window.to_i
86
+ end
87
+
77
88
  def session(name)
78
89
  @session = name
79
90
  end
@@ -1,3 +1,3 @@
1
1
  module Tummy
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tummy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Khaja Minhajuddin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-02 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler