mirror of
https://github.com/tmux-plugins/tmux-continuum.git
synced 2024-12-22 23:58:48 +00:00
Avoid overriding systemd unit/settings when not configured to do so
This commit is contained in:
parent
3e4bc35da4
commit
0a90b1b554
@ -18,17 +18,25 @@ is_systemd() {
|
|||||||
[ $(ps -o comm= -p1) == '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() {
|
main() {
|
||||||
if is_tmux_automatic_start_enabled; then
|
if is_tmux_automatic_start_enabled; then
|
||||||
if is_osx; then
|
if is_osx; then
|
||||||
"$CURRENT_DIR/handle_tmux_automatic_start/osx_enable.sh"
|
"$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"
|
"$CURRENT_DIR/handle_tmux_automatic_start/systemd_enable.sh"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if is_osx; then
|
if is_osx; then
|
||||||
"$CURRENT_DIR/handle_tmux_automatic_start/osx_disable.sh"
|
"$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"
|
"$CURRENT_DIR/handle_tmux_automatic_start/systemd_disable.sh"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -17,6 +17,9 @@ template() {
|
|||||||
local tmux_path="$(command -v tmux)"
|
local tmux_path="$(command -v tmux)"
|
||||||
|
|
||||||
read -r -d '' content <<-EOF
|
read -r -d '' content <<-EOF
|
||||||
|
#managed-by:tmux-continuum
|
||||||
|
# This file is managed by the tmux-continuum plugin. Manual changes
|
||||||
|
# will be overridden.
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=tmux default session (detached)
|
Description=tmux default session (detached)
|
||||||
Documentation=man:tmux(1)
|
Documentation=man:tmux(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user