Test if already inside a tmux
This commit is contained in:
		
							parent
							
								
									2b12a22861
								
							
						
					
					
						commit
						729cbff471
					
				|  | @ -16,9 +16,14 @@ | ||||||
| if-shell -b 'tmux has-session -t jd' { | if-shell -b 'tmux has-session -t jd' { | ||||||
| 	display-message "Attach to **jd** existing session" | 	display-message "Attach to **jd** existing session" | ||||||
| 	## Attach to the first pane of the first window | 	## Attach to the first pane of the first window | ||||||
|  | 	## Only works from a running tmux | ||||||
| 	attach-session -t jd:1.1 | 	attach-session -t jd:1.1 | ||||||
| } | } | ||||||
| # }}} | # }}} | ||||||
|  | 
 | ||||||
|  | # 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 no session already exists | ||||||
| 	if-shell '! tmux has-session -t jd' { | 	if-shell '! tmux has-session -t jd' { | ||||||
| 		display-message "Create a new session for Workstation" | 		display-message "Create a new session for Workstation" | ||||||
|  | @ -54,3 +59,4 @@ if-shell -b 'tmux has-session -t 0' { | ||||||
| 		kill-session -t 0 | 		kill-session -t 0 | ||||||
| 	} | 	} | ||||||
| 	# }}} | 	# }}} | ||||||
|  | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue