diff --git a/defaults/main/variables.yml b/defaults/main/variables.yml new file mode 100644 index 0000000..4391596 --- /dev/null +++ b/defaults/main/variables.yml @@ -0,0 +1,14 @@ +--- +sway_variables: + - name: '$left' + value: 'h' + - name: '$down' + value: 'j' + - name: '$up' + value: 'k' + - name: '$right' + value: 'l' + - name: '$term' + value: 'foot' + - name: '$menu' + value: 'dmenu_path | dmenu | xargs swaymsg exec --' diff --git a/files/90-startup.config b/files/90-startup.config new file mode 100644 index 0000000..2fafb70 --- /dev/null +++ b/files/90-startup.config @@ -0,0 +1 @@ +exec_always "systemctl --user import-environment; systemctl --user start sway-session.target" diff --git a/tasks/main.yml b/tasks/main.yml index 8d362cb..743f7dd 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -38,9 +38,16 @@ validate: >- sh -c "if sway --config %s --validate 2>&1 | grep -q sway/config.c; then >&2 echo \"Error validating sway configuration\"; exit 1; else exit 0; fi" loop: + - 00-variables - 10-input - 20-output - 30-theme - 40-workspaces - 50-keybindings any_errors_fatal: true + +- name: Copy default startup Sway conf file + ansible.builtin.copy: + src: '90-startup.config' + dest: '{{ ansible_user_dir }}/.config/systemd/user/' + mode: 0640 diff --git a/templates/00-variables.config.j2 b/templates/00-variables.config.j2 new file mode 100644 index 0000000..03e7879 --- /dev/null +++ b/templates/00-variables.config.j2 @@ -0,0 +1,5 @@ +{% if sway_variables %} +{% for v in sway_variables %} +set {{ v.name }} {{ v.value}} +{% endfor %} +{% endif %}