Selaa lähdekoodia

Add tmux dimensions

added the ability to set the default width and height of the detatched session using variables tmux_width and tmux_height.

these variables may be set at a local level or system wide.

the script checks if the input from the variables is a valid positive integer and if input is not a valid positive integer, sets the values for the tmux to the default values of 80x23
TechNZ 9 vuotta sitten
vanhempi
commit
61bc06acf2
1 muutettua tiedostoa jossa 15 lisäystä ja 1 poistoa
  1. 15 1
      lgsm/functions/command_start.sh

+ 15 - 1
lgsm/functions/command_start.sh

@@ -56,6 +56,20 @@ fn_start_teamspeak3(){
 
 fn_start_tmux(){
 	fn_parms
+	
+	# check for tmux size variables
+	if [[ ${tmux_width} =~ ^[0-9]+$ ]]
+	then
+		tmux-x=${tmux_width}
+	else
+		tmux-x=80
+	fi
+	if [[ ${tmux_height} =~ ^[0-9]+$ ]]
+	then
+		tmux-y=${tmux_height}
+	else
+		tmux-y=23
+	fi
 
 	# Log rotation
 	check_status.sh
@@ -81,7 +95,7 @@ fn_start_tmux(){
 	# Create lockfile
 	date > "${rootdir}/${lockselfname}"
 	cd "${executabledir}"
-	tmux new-session -d -s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
+	tmux new-session -d -x ${tmux-x} -y ${tmux-y} --s "${servicename}" "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
 
 	# tmux pipe-pane not supported in tmux versions < 1.6
 	if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then