aboutsummaryrefslogtreecommitdiff
path: root/tmux
diff options
context:
space:
mode:
Diffstat (limited to 'tmux')
-rw-r--r--tmux/bin/tmux.sh11
-rw-r--r--tmux/profile.d/tmux.sh4
-rw-r--r--tmux/systemd/user/tmux.service11
-rw-r--r--tmux/tmux.conf23
4 files changed, 30 insertions, 19 deletions
diff --git a/tmux/bin/tmux.sh b/tmux/bin/tmux.sh
new file mode 100644
index 00000000..bbe11636
--- /dev/null
+++ b/tmux/bin/tmux.sh
@@ -0,0 +1,11 @@
+#
+# Simple wrapper to force acting only as client; can't do anything if the
+# server isn't actually running. The correct way to do this is of course
+# socket activation, but Debian's version doesn't have --enable-systemd yet.
+# This will do fine in the meantime.
+#
+if ! systemctl --user is-active --quiet tmux.service ; then
+ printf >&2 'tmux: server not running\n'
+ exit
+fi
+exec /usr/bin/tmux "$@"
diff --git a/tmux/profile.d/tmux.sh b/tmux/profile.d/tmux.sh
new file mode 100644
index 00000000..15ba00ff
--- /dev/null
+++ b/tmux/profile.d/tmux.sh
@@ -0,0 +1,4 @@
+# Encourage tmux to put its sockets into XDG_RUNTIME_DIR rather than /tmp
+[ -n "$XDG_RUNTIME_DIR" ] || return
+TMUX_TMPDIR=$XDG_RUNTIME_DIR
+export TMUX_TMPDIR
diff --git a/tmux/systemd/user/tmux.service b/tmux/systemd/user/tmux.service
new file mode 100644
index 00000000..404f1888
--- /dev/null
+++ b/tmux/systemd/user/tmux.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=tmux server
+Documentation=man:tmux(1)
+
+[Service]
+ExecStart=/bin/sh -lc 'exec /usr/bin/tmux start-server \\; set-option -s exit-empty off'
+KillMode=mixed
+Type=forking
+
+[Install]
+WantedBy=default.target
diff --git a/tmux/tmux.conf b/tmux/tmux.conf
index 2eb1665a..ad420528 100644
--- a/tmux/tmux.conf
+++ b/tmux/tmux.conf
@@ -1,20 +1,8 @@
-# Strip out a lot of machine and X11 dependent crap from the initial
-# environment
-set-environment -gru DISPLAY
-set-environment -gru SSH_CLIENT
-set-environment -gru SSH_CONNECTION
-set-environment -gru SSH_TTY
-set-environment -gru WINDOWID
-
-# Otherwise, use the environment we had when we started; don't touch it during
-# a session unless I specifically ask
-set-option -g update-environment 'COLORFGBG COLORTERM'
+# Don't update the environment from anywhere; too confusing
+set-option -g update-environment ''
# Setting this makes each new pane a non-login shell, which suits me better
-set-option -g default-command "$SHELL"
-
-# Expect a 256-color terminal
-set-option -g default-terminal 'screen-256color'
+set-option -g default-command "exec $SHELL"
# Change the prefix to ^A rather than the default of ^B, because I'm a godless
# GNU Screen refugee, and also I like using ^B in my shell and in Vim more
@@ -69,7 +57,7 @@ bind-key s choose-session
set-option -g status-left '[#S] '
# Username, hostname, and the current date on the right side of the status bar
-set-option -g status-right ' [#H] %F %T'
+set-option -g status-right ' (mail:#(msc)) [#h] %F %T'
# Update the status bar every second
set-option -g status-interval 1
@@ -81,9 +69,6 @@ set-option -g base-index 1
# meta and prefer things to be snappier
set-option -g escape-time 0
-# Keep plenty of history
-set-option -g history-limit 100000
-
# Don't interfere with my system clipboard
set-option -g set-clipboard off