- name: Install packages
  package:
    name:
      - aspell-en
      - emacs-wayland
    state: present

- name: Install packages
  when: 'emacs_flavor == "full"'
  package:
    name:
      - prettier # typescript+yaml formatting
      - pyright
      - gopls
      - typescript-language-server
      - shellcheck
      - vscode-css-languageserver
    state: present

- name: Create directories
  file:
    name: "{{ item }}"
    state: directory
    mode: 0755
    owner: root
    group: root # Using root group to match /usr/share/applications
  loop:
    - /usr/local/share/applications

- name: Install Configuration
  copy:
    src: "files/{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: 0644
    owner: root
    group: wheel
    # Can't use validate because it complains about the file extension for the temporary file.
    # validate: "desktop-file-validate %s"
  loop:
    - src: plainmacs.desktop
      dest: /usr/local/share/applications/
