summaryrefslogtreecommitdiff
path: root/init.d/tmux
diff options
context:
space:
mode:
Diffstat (limited to 'init.d/tmux')
-rwxr-xr-xinit.d/tmux18
1 files changed, 18 insertions, 0 deletions
diff --git a/init.d/tmux b/init.d/tmux
new file mode 100755
index 0000000..770a996
--- /dev/null
+++ b/init.d/tmux
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+
+user=$(whoami)
+command="/usr/bin/tmux"
+command_args="new-session -s ${user} -t ${user} -d"
+pidfile="${XDG_RUNTIME_DIR:-RC_SVCDIR}/tmux.pid"
+description="Start a tmux session"
+
+start_post() {
+ tmux display-message -p '#{pid}' > ${pidfile}
+ for session in ${sessions}; do
+ tmux new-session -s ${session} -d
+ eval local commands="\${commands_${session}}"
+ for command in "${commands}"; do
+ tmux new-window -n "${session}":"${command}" "${command}"
+ done
+ done
+}