Start tmux sessions using systemd

While starting the tmux sessions from fish worked some environment
variables were not getting picked up in tmux session.

For example DISPLAY is set after we log in and the graphical sway
session starts but since tmux sessions were started before that it
would be absent from the tmux session. We may be wrong about the
exact order and reasoning for this but atleast that is the observed
behaviour.

Fix this by defining a sway session target and making the tmux session
service dependent on it.
This commit is contained in:
Sanchayan Maity 2022-04-04 14:52:07 +05:30
parent 0ee7a4cd10
commit 8a7567a8b1
4 changed files with 17 additions and 3 deletions

View File

@ -65,9 +65,6 @@ function __fish_setup_on_tty_login --description "Set up environment on tty logi
mkdir -p /tmp/gst-dot
set -Ux GST_DEBUG_DUMP_DOT_DIR /tmp/gst-dot
# Start all tmux sessions on login
~/.tmux/session-setup.sh
end
# Instead of tty check, we would have liked to do this using status is-login

View File

@ -268,3 +268,5 @@ for_window [title="Firefox — Sharing Indicator"] no_focus
for_window [app_id="gst-launch-1.0"] floating enable, resize set width 1920 px height 1080px
assign [app_id="gst-launch-1.0"] 4
assign [title="gst-play-1.0"] 4
exec_always "systemctl --user import-environment; systemctl --user start sway-session.target"

View File

@ -0,0 +1,6 @@
[Unit]
Description=Sway compositor session
Documentation=man:systemd.special
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target

View File

@ -0,0 +1,9 @@
[Unit]
Description=Start all tmux sessions on login
[Service]
Type=forking
ExecStart=%h/.tmux/session-setup.sh
[Install]
WantedBy=sway-session.target