---
# Sync and update Pacman
- name: Sync and update Pacman
  community.general.pacman:
    update_cache: yes
    upgrade: yes
  become: yes
  tags: update
# Install Pacman-based daily drivers
- name: Ensure daily-driver (development, work, gaming) installed
  community.general.pacman:
    name: 
    - remmina
    - freerdp
    - chromium
    - steam-manjaro
    - steam-native
    - discord
    - geary
    - make
    - vlc
    - seahorse # gnome keyring manager
    - gimp
    - libreoffice-fresh
    state: present
  become: yes
# Install snap-based daily-drivers
- name: Ensure snap installed
  community.general.pacman:
    name: snapd
    state: present
  become: yes
- name: Ensure snapd service running
  ansible.builtin.systemd:
    name: snapd.socket
    state: started
    enabled: yes
  become: yes
- name: Link /var/lib/snapd/snap /snap
  ansible.builtin.file:
    src: /var/lib/snapd/snap
    dest: /snap
    owner: root
    group: root
    state: link
  become: yes
- name: Install snap packages
  community.general.snap:
    name: 
    - snap-store
    - spotify
    state: present
  become: yes
  retries: 6
  delay: 10
# AppImage Launcher
- name: Ensure appimagelauncher installed
  community.general.pacman:
    name: appimagelauncher
    state: present
  become: yes
- name: Ensure Applications directory
  file:
    path: ~/Applications
    state: directory
# QMK
- name: Ensure qmk installed
  community.general.pacman:
    name: qmk
    state: present
  become: yes
- name: Run qmk setup
  ansible.builtin.command: qmk setup -y
  become: yes
- name: Copy qmk udev rules
  ansible.builtin.copy:
    src: ~/qmk_firmware/util/udev/50-qmk.rules
    dest: /etc/udev/rules.d/50-qmk.rules
    owner: ducoterra
    group: root
    mode: '0755'
  become: yes
