Commit 4c3f80db authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Fix tmux helper when unit files not loaded

parent cf0e9084
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@ COMMANDS="Commands:
				the client's terminal.
"

SERVICE_CTL='systemctl --user'
SERVICE_UNIT=tmux.service


. ~/.shell/funcs

@@ -83,13 +86,17 @@ get_var() {
	eval ${1}="\$$VAR_NAME"
}

service_installed() {
	[ -n "`$SERVICE_CTL list-unit-files --no-legend $SERVICE_UNIT`" ]
}


start_client() {
	[ $# -eq 1 ] || bad_arg "start-client takes no arguments"
	[ -z "$TMUX" ] || die "this command must be run from outside of tmux"
	if ! tmux has-session; then
		if has systemctl; then
			systemctl --user start tmux.service
		if has systemctl && service_installed; then
			$SERVICE_CTL start $SERVICE_UNIT
		else
			setsid tmux start-server
		fi