---
# Nice, simple, and easy to use tiling window manager.
# https://dwm.suckless.org/
# https://sites.google.com/site/lazyboxx/-articles/dwm-a-newbie-s-guide#TOC-Status-Bar

#TODO: Move this to tasks/shared/ pasth rather than tasks/linux/.
#TODO: Generate files based on blockinfile.
#TODO: Fix config.mk for FreeBSD automatically (use /usr/local/ for libs not /usr/X11RC/)
#TODO: scm.sh to use bash variable so that FreeBSD correctly hits /usr/local/bin/bash.

## Pre-reqs ##

- name: Workstation | Linux | Software | DWM | Pre-Reqs
  package:
    name:
      - git
      - "{{ make }}"
      - "{{ dmenu }}"
      - "{{ font_awesome }}"
    update_cache: yes


## Download ##

- name: Workstation | Linux | Software | DWM | Git Clone
  git: 
    repo: https://git.suckless.org/dwm
    dest: "{{ dwm_install_dir }}"
    clone: yes
    force: yes

- name: Workstation | Linux | Software | DWM | Git Clone (st)
  git: 
    repo: https://git.suckless.org/st
    dest: "{{ st_install_dir }}"
    clone: yes
    force: yes

## Configuration ##

- name: Workstation | Linux | Software | DWM | Config File
  copy:
    src: dwm/config.h
    dest: "{{ dwm_install_dir }}"
    owner: root
    group: "{{ root_group }}"
    mode: 0755


## Install ##

- name: Workstation | Linux | Software | DWM | Install
  shell: "cd {{ dwm_install_dir }}; {{ make }} clean install"
  ignore_errors: yes

- name: Workstation | Linux | Software | DWM | Install (st)
  shell: "cd {{ st_install_dir }}; {{ make }} clean install"
  ignore_errors: yes


## X Init Sript ##

- name: Workstation | Linux | Software | DWM | Shell Script
  copy:
    src: dwm/dwm.sh
    dest: "{{ global_bin }}"
    owner: root
    group: "{{ root_group }}"
    mode: 0755


## Desktop File ##

- name: Workstation | Linux | Software | DWM | Desktop File
  copy:
    src: dwm/dwm.desktop
    dest: "{{ x_desktops }}"
    owner: root
    group: "{{ root_group }}"
    mode: 0644