From d415797a94bb0a8199b214049878ad2a3224128e Mon Sep 17 00:00:00 2001 From: Nuno Sa Date: Thu, 18 Apr 2024 09:14:52 +0200 Subject: [PATCH] tmux: add systemd service Add a systemd service so a tmux session is started at boot. It depends on the graphical session to be fully initialized so that we inherit most of the env variables as we would with a typical terminal emulator. With this, a new directory was created and tmux.conf was moved accordingly, Signed-off-by: Nuno Sa --- tmux/tmux-desktop.service | 23 +++++++++++++++++++++++ tmux.conf => tmux/tmux.conf | 0 2 files changed, 23 insertions(+) create mode 100644 tmux/tmux-desktop.service rename tmux.conf => tmux/tmux.conf (100%) diff --git a/tmux/tmux-desktop.service b/tmux/tmux-desktop.service new file mode 100644 index 0000000..6d449ad --- /dev/null +++ b/tmux/tmux-desktop.service @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# tmux systemd service. This is called tmux-desktop as the main +# usage for it is to use it on local machines with a desktop environment +# installed. Hence, we just start the new session after the graphical +# environment is fully initialized so that we inherit almost all the +# env variables so that we have the same ones as with a typical terminal +# emulator as terminator. +# +# !\TODO: Check if the graphical-session.target is generic across DEs +# (at least on xfce) so that this unit can be used on all my machines. + +[Unit] +Description=Start tmux in detached session +Requires=graphical-session.target +After=graphical-session.target + +[Service] +Type=forking +ExecStart=/usr/bin/tmux new-session -s %u -d + +[Install] +WantedBy=graphical-session.target diff --git a/tmux.conf b/tmux/tmux.conf similarity index 100% rename from tmux.conf rename to tmux/tmux.conf