Browse Source

replace current script based xsession invocation with a systemd based

systemd-xsession
parent
commit
b647fd12ce
5 changed files with 31 additions and 13 deletions
  1. +10
    -3
      tasks/i3.yaml
  2. +6
    -0
      tasks/x11.yaml
  3. +11
    -0
      templates/i3/i3wm.service.j2
  4. +3
    -0
      templates/x11/xsession.target.j2
  5. +1
    -10
      templates/x11/xsessionrc.j2

+ 10
- 3
tasks/i3.yaml View File

@@ -19,7 +19,14 @@
path: ~/.config/i3blocks
state: directory

- name: i3blocks config
- name: i3wm graphical-session service
template:
src: i3/i3blocks.config.j2
dest: ~/.config/i3blocks/config
src: i3/i3wm.service.j2
dest: ~/.config/systemd/user/i3wm.service
notify: systemd daemon-reload

- name: i3wm graphical-session service enabled
systemd:
name: i3wm.service
enabled: true
scope: user

+ 6
- 0
tasks/x11.yaml View File

@@ -22,6 +22,12 @@
dest: ~/.xsession.reload.fish
mode: 0755

- name: xsession systemd target
template:
src: x11/xsession.target.j2
dest: ~/.config/systemd/user/xsession.target
notify: systemd daemon-reload

- name: xsessionrc
template:
src: x11/xsessionrc.j2


+ 11
- 0
templates/i3/i3wm.service.j2 View File

@@ -0,0 +1,11 @@
[Unit]
Description=i3 Window Manager
PartOf=graphical-session.target

[Service]
ExecStart=/usr/bin/i3
ExecStopPost=/bin/systemctl --user stop graphical-session.target
Restart=on-failure

[Install]
RequiredBy=xsession.target

+ 3
- 0
templates/x11/xsession.target.j2 View File

@@ -0,0 +1,3 @@
[Unit]
Description=X session managed by systemd
BindsTo=graphical-session.target

+ 1
- 10
templates/x11/xsessionrc.j2 View File

@@ -2,13 +2,4 @@

{{ansible_managed|comment}}

if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi

exec fish ~/.xsession.fish
exec systemctl --user start --wait xsession.target