summaryrefslogtreecommitdiffstats
path: root/roles/hyprtheme/tasks/main.yml
blob: fd7a173443c1a9e1f4bcc91ca044d9973f72451c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
- name: "Create current theme directory"
  ansible.builtin.file:
    path: "{{ ansible_facts['env']['HOME'] }}/.config/hyprtheme/current"
    state: "directory"
    mode: "0755"

- name: "Create themes directory"
  ansible.builtin.file:
    path: "{{ ansible_facts['env']['HOME'] }}/.config/hyprtheme/themes/{{ item }}"
    state: "directory"
    mode: "0755"
  loop: "{{ hyprtheme_themes }}"

- name: "Create scripts directory"
  ansible.builtin.file:
    path: "{{ ansible_facts['env']['HOME'] }}/.config/hyprtheme/scripts"
    state: "directory"
    mode: "0755"

- name: "Template themes"
  ansible.builtin.include_tasks: "template-theme.yml"
  vars:
    hyprtheme_name: "{{ item }}"
  loop: "{{ hyprtheme_themes }}"

- name: "Copy theme scripts"
  ansible.builtin.copy:
    src: "{{ item }}"
    dest: "{{ ansible_facts['env']['HOME'] }}/.config/hyprtheme/{{ item }}"
    mode: "0755"
  loop:
    - "scripts/theme.sh"
    - "scripts/wallpaper.sh"

- name: "Set default theme"
  ansible.builtin.command:
    # Running the command creates the symlinks for the current themes, using the hyprland.conf file to avoid rerunning
    # This will run only if there is no current theme in place
    # This will ignore the errors in the script, because the script restarts some hyprland services, which
    # will fail on ssh connection, but having the theme files placed in the right directory will make sure that
    # the first setup of hyprtheme is working and doesn't show errors on first boot
    cmd: "{{ ansible_facts['env']['HOME'] }}/.config/hyprtheme/scripts/theme.sh {{ hyprtheme_default_theme }}"
    creates: "{{ ansible_facts['env']['HOME'] }}/.config/hyprtheme/current/hyprland.conf"
  failed_when: false