- name: Preparing for Hack Nerd font installation
  become: true 
  file:
    path: /usr/share/fonts/hack
    state: directory
    owner: root
    group: root
    mode: '0755'
  changed_when: false

- name: Installing Hack Nerd Font
  become: true
  copy:
    src: fonts/hack_nerd_font.ttf
    dest: /usr/share/fonts/hack/hack_nerd_font.ttf
    owner: root
    group: root
    mode: preserve

- name: Setting up fonts.conf (Fallback for emojis)
  block:
    - name: Make sure fontconfig folder exists
      file:
        path: ~/.config/fontconfig
        state: directory
        mode: '0755'
      changed_when: false

    - name: Copy over font configuration
      copy:
        src: fonts/fonts.conf
        dest: ~/.config/fontconfig/fonts.conf
        mode: preserve
        force: yes
      changed_when: false
