---

- name: lockscreen environment
  template:
    src: lockscreen/lockscreen.env.j2
    dest: ~/.lockscreen.env

- name: screensaver shell script
  template:
    src: lockscreen/screensaver.sh.j2
    dest: ~/.screensaver.sh
    mode: 0755

- name: lockscreen graphical-session service definition
  template:
    src: lockscreen/lockscreen.service.j2
    dest: ~/.config/systemd/user/lockscreen.service
  notify: systemd daemon-reload

- name: lockscreen-auto graphical-session service definition
  template:
    src: lockscreen/lockscreen-auto.service.j2
    dest: ~/.config/systemd/user/lockscreen-auto.service
  notify: systemd daemon-reload

- name: lockscreen-auto graphical-session service
  systemd:
    name: lockscreen-auto.service
    enabled: "{{ lockscreen_auto_enabled }}"
    state: "{{ lockscreen_auto_enabled | ternary('started','stopped') }}"
    scope: user
