summaryrefslogtreecommitdiffstats
path: root/roles/hyprland/tasks/main.yml
blob: 7a25e7c26b5d6b18d0f40561a2fcbd5b236bc817 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
- name: "Ensure hyprland packages are installed"
  become: true
  ansible.builtin.package:
    name:
      - "swaybg"
      - "hyprlock"
      - "hypridle"
      - "hyprpicker"
      - "hyprsunset"
      - "hyprshot"
      - "satty"
      - "hyprland"
    state: "present"

- name: "Ensure hyprland AUR packages are installed"
  become: true
  become_user: "aur_builder"
  kewlfft.aur.aur:
    name: "{{ item }}"
    state: "present"
    use: "yay"
  loop:
    - "hyprshutdown"

- name: "Configure greetd"
  become: true
  ansible.builtin.copy:
    dest: "/etc/greetd/config.toml"
    owner: "greeter"
    group: "greeter"
    mode: "0644"
    content: |
      [terminal]
      vt = 2
      [default_session]
      command = "tuigreet -c 'uwsm start hyprland.desktop' --theme=border=cyan"
      user = "greeter"
  notify:
    - "Restart greetd"

- name: "Create config directories"
  become: true
  ansible.builtin.file:
    path: "{{ item }}"
    state: "directory"
    mode: "0755"
  loop:
    - "/etc/hypr"
    - "/etc/hypr/scripts"
    - "/etc/xdg/uwsm"
    - "/etc/xdg/xdg-desktop-portal"
    - "{{ ansible_facts['env']['HOME'] }}/.config/hypr"

- name: "Configure system defaults"
  become: true
  ansible.builtin.template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: "0644"
  loop:
    - src: "hypr/autostart.conf.j2"
      dest: "/etc/hypr/autostart.conf"
    - src: "hypr/monitors.conf.j2"
      dest: "/etc/hypr/monitors.conf"
    - src: "hypr/input.conf.j2"
      dest: "/etc/hypr/input.conf"
    - src: "hypr/bindings.conf.j2"
      dest: "/etc/hypr/bindings.conf"
    - src: "hypr/looknfeel.conf.j2"
      dest: "/etc/hypr/looknfeel.conf"
    - src: "hypr/rules.conf.j2"
      dest: "/etc/hypr/rules.conf"
    - src: "hypr/hyprlock.conf.j2"
      dest: "/etc/hypr/hyprlock.conf"
    - src: "hypr/hypridle.conf.j2"
      dest: "/etc/hypr/hypridle.conf"
    - src: "hypr/hyprland.conf.j2"
      dest: "/etc/hypr/hyprland.conf"
    - src: "uwsm/env.j2"
      dest: "/etc/xdg/uwsm/env"
    - src: "uwsm/env-hyprland.j2"
      dest: "/etc/xdg/uwsm/env-hyprland"
    - src: "xdg-desktop-portal/portals.conf.j2"
      dest: "/etc/xdg/xdg-desktop-portal/portals.conf"

- name: "Configure user defaults"
  block:
    - name: "Configure user hyprland configuration"
      ansible.builtin.blockinfile:
        path: "{{ ansible_facts['env']['HOME'] }}/.config/hypr/hyprland.conf"
        state: "present"
        prepend_newline: true
        append_newline: true
        marker: "# ==== {mark} ANSIBLE HYPRLAND CONFIG"
        block: |
          # System defaults
          source = /etc/hypr/hyprland.conf

    - name: "Configure user hypridle configuration"
      ansible.builtin.blockinfile:
        path: "{{ ansible_facts['env']['HOME'] }}/.config/hypr/hypridle.conf"
        state: "present"
        prepend_newline: true
        append_newline: true
        marker: "# ==== {mark} ANSIBLE HYPRLAND CONFIG"
        block: |
          # System defaults
          source = /etc/hypr/hypridle.conf

- name: "Copy hyprland scripts"
  become: true
  ansible.builtin.copy:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: "0755"
  loop:
    - src: "scripts/brightness.sh"
      dest: "/etc/hypr/scripts/brightness.sh"
    - src: "scripts/volume.sh"
      dest: "/etc/hypr/scripts/volume.sh"
    - src: "scripts/sunset.sh"
      dest: "/etc/hypr/scripts/sunset.sh"
    - src: "scripts/wifi.sh"
      dest: "/etc/hypr/scripts/wifi.sh"
    - src: "scripts/bluetooth.sh"
      dest: "/etc/hypr/scripts/bluetooth.sh"
    - src: "scripts/power.sh"
      dest: "/etc/hypr/scripts/power.sh"
    - src: "scripts/screenshot.sh"
      dest: "/etc/hypr/scripts/screenshot.sh"