Test if already inside a tmux
This commit is contained in:
		
							parent
							
								
									2b12a22861
								
							
						
					
					
						commit
						729cbff471
					
				|  | @ -16,11 +16,16 @@ | |||
| if-shell -b 'tmux has-session -t jd' { | ||||
| 	display-message "Attach to **jd** existing session" | ||||
| 	## Attach to the first pane of the first window | ||||
| 	## Only works from a running tmux | ||||
| 	attach-session -t jd:1.1 | ||||
| } | ||||
| # }}} | ||||
| # If no session already exists | ||||
| if-shell '! tmux has-session -t jd' { | ||||
| 
 | ||||
| # If file was source from a running tmux | ||||
| # This allow to run tmux source-file command outside of Tmux… | ||||
| if-shell -b 'test -n $TMUX' { | ||||
| 	# If no session already exists | ||||
| 	if-shell '! tmux has-session -t jd' { | ||||
| 		display-message "Create a new session for Workstation" | ||||
| 		# A first window named **42** | ||||
| 		new-session -A -sjd -n42 | ||||
|  | @ -47,10 +52,11 @@ if-shell '! tmux has-session -t jd' { | |||
| 
 | ||||
| 		# Default pane should be jd:4.2 | ||||
| 		#select-pane -tjd:4.2 | ||||
| } | ||||
| # If a default session still exists {{{ | ||||
| if-shell -b 'tmux has-session -t 0' { | ||||
| 	} | ||||
| 	# If a default session still exists {{{ | ||||
| 	if-shell -b 'tmux has-session -t 0' { | ||||
| 		# Kill it | ||||
| 		kill-session -t 0 | ||||
| 	} | ||||
| 	# }}} | ||||
| } | ||||
| # }}} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue