- name: Install packages
  package:
    name:
      - sway
      - swaybg
      - swayidle
      - swaylock
      - wofi
      - mako
      - grim
      - xeyes
      - qt5-wayland
      # - gvfs
      - xauth # for ssh x11 forwarding
      - slurp # screen coordinates for screenshots
      - libnotify # mako doesn't seem to work without it
      - pcmanfm # For mounting drives
      - wf-recorder # screen recording
      - waybar
      - xdg-desktop-portal
      - xdg-desktop-portal-wlr # screen sharing
      # - rofimoji
      - wtype # for rofimoji to be able to insert characters
      - dbus # for desktop notifications
      - lumina-fm
      - jq
    state: present

- name: Install service configuration
  copy:
    src: "files/{{ item }}_rc.conf"
    dest: "/etc/rc.conf.d/{{ item }}"
    mode: 0644
    owner: root
    group: wheel
  loop:
    - seatd
    - dbus

- name: Install scripts
  copy:
    src: "files/{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: 0755
    owner: root
    group: wheel
  loop:
    - src: launch_sway_freebsd.bash
      dest: /usr/local/bin/launch_sway
    - src: waybar_battery_freebsd.bash
      dest: /usr/local/bin/waybar_custom_battery
    - src: waybar_available_memory_freebsd.bash
      dest: /usr/local/bin/waybar_custom_available_memory
