瀏覽代碼

replace current script based xsession invocation with a systemd based

systemd-xsession
父節點
當前提交
b647fd12ce
共有 5 個檔案被更改,包括 31 行新增13 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

+ 1
- 10
templates/x11/xsessionrc.j2 查看文件

@@ -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