]> git.pld-linux.org Git - packages/tmux.git/commitdiff
add systemd unit for autostarting tmux session
authorJan Palus <atler@pld-linux.org>
Wed, 6 May 2020 09:20:56 +0000 (11:20 +0200)
committerJan Palus <atler@pld-linux.org>
Wed, 6 May 2020 09:20:56 +0000 (11:20 +0200)
inspired by arch's wiki page

tmux.spec
tmux@.service [new file with mode: 0644]

index 43bbee104c7b1254ba9a10f156c32cf4f99ef044..a83903dd84f96a0a6c65f9766c43619385b19c3d 100644 (file)
--- a/tmux.spec
+++ b/tmux.spec
@@ -16,6 +16,7 @@ Source2:      https://raw.githubusercontent.com/keith/tmux.vim/master/syntax/tmux.vim
 # Source2-md5: cd1169a1757b515b5c57816d339c6f72
 Source3:       https://raw.githubusercontent.com/imomaliev/tmux-bash-completion/master/completions/tmux
 # Source3-md5: 6d65c0f42c74f61602a399d7bb04a85c
+Source4:       tmux@.service
 URL:           http://tmux.github.io/
 BuildRequires: libevent-devel
 BuildRequires: libutempter-devel
@@ -91,6 +92,8 @@ install %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/ftdetect/tmux.vim
 install %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/syntax
 install -d $RPM_BUILD_ROOT%{bash_compdir}
 sed -e '1s,#!/usr/bin/env bash,#!/bin/bash,' %{SOURCE3} > $RPM_BUILD_ROOT%{bash_compdir}/%{name}
+install -d $RPM_BUILD_ROOT%{systemdunitdir}
+install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -100,6 +103,7 @@ rm -rf $RPM_BUILD_ROOT
 %doc CHANGES COPYING README
 %attr(755,root,root) %{_bindir}/tmux
 %{_mandir}/man1/tmux.1*
+%{systemdunitdir}/tmux@.service
 
 %files -n vim-syntax-tmux
 %defattr(644,root,root,755)
diff --git a/tmux@.service b/tmux@.service
new file mode 100644 (file)
index 0000000..0234a2d
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Start tmux in detached session
+
+[Service]
+Type=forking
+User=%I
+ExecStart=/usr/bin/tmux new-session -s %u -d
+ExecStop=/usr/bin/tmux kill-session -t %u
+
+[Install]
+WantedBy=multi-user.target
This page took 0.386824 seconds and 4 git commands to generate.