pull/122/merge
Calle Pettersson 2024-01-29 19:40:16 -07:00 committed by GitHub
commit a9aff8ca72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View File

@ -18,17 +18,25 @@ is_systemd() {
[ $(ps -o comm= -p1) == 'systemd' ]
}
# Only manage the systemd unit either if it is not already installed, or if it
# was installed by us (as signified by the magic comment)
should_manage_systemd_unit() {
[ ! -f ${systemd_unit_file_path} ] \
&& \
systemctl cat --user ${systemd_service_name} | grep -q 'managed-by:tmux-continuum'
}
main() {
if is_tmux_automatic_start_enabled; then
if is_osx; then
"$CURRENT_DIR/handle_tmux_automatic_start/osx_enable.sh"
elif is_systemd; then
elif is_systemd && should_manage_systemd_unit; then
"$CURRENT_DIR/handle_tmux_automatic_start/systemd_enable.sh"
fi
else
if is_osx; then
"$CURRENT_DIR/handle_tmux_automatic_start/osx_disable.sh"
elif is_systemd; then
elif is_systemd && should_manage_systemd_unit; then
"$CURRENT_DIR/handle_tmux_automatic_start/systemd_disable.sh"
fi
fi

View File

@ -17,6 +17,9 @@ template() {
local tmux_path="$(command -v tmux)"
read -r -d '' content <<-EOF
#managed-by:tmux-continuum
# This file is managed by the tmux-continuum plugin. Manual changes
# will be overridden.
[Unit]
Description=tmux default session (detached)
Documentation=man:tmux(1)