---

- name: workspace app service
  template:
    src: workspaces/workspace-app.service.j2
    dest: ~/.config/systemd/user/workspace-app@.service
    mode: 0755
  notify: systemd daemon-reload

- name: workspaces directory
  file:
    path: ~/.workspaces
    state: directory

- name: workspace focus scripts
  template:
    src: workspaces/workspace.focus.fish.j2
    dest: ~/.workspaces/{{workspace}}.focus
    mode: 0755
  with_items: "{{ workspaces }}"
  loop_control:
    loop_var: workspace

- name: workspace space shortcut scripts
  template:
    src: workspaces/workspace.space.fish.j2
    dest: ~/.workspaces/{{workspace}}.space
    mode: 0755
  with_items: "{{workspaces|dict2items|json_query(\"[?value.type=='vncviewer'||value.type=='tmux'].key\") }}"
  loop_control:
    loop_var: workspace
