diff --git a/README.md b/README.md index 752bdcf..0628823 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ Install and deploy a basic configuration of [I3 Window Manager](https://i3wm.org Optionally configure your resolution, which applications will be bound to which screen and what will be included in the autostart.
If you want to use wayland instead of xorg, think about using [sway](https://swaywm.org/) as window manager. The corresponding ansible is located on [github.com/roles-ansible/role-sway](https://github.com/roles-ansible/role-sway.git). -[![Build Status](https://travis-ci.org/chaos-bodensee/role-i3wm.svg?branch=master)](https://travis-ci.org/chaos-bodensee/role-i3wm) [![MIT License](https://raw.githubusercontent.com/chaos-bodensee/role-i3wm/master/.github/license.svg?sanitize=true)](https://github.com/chaos-bodensee/role-i3wm/blob/master/LICENSE) [![MIT License](https://raw.githubusercontent.com/chaos-bodensee/role-i3wm/master/.github/galaxy.svg?sanitize=true)](https://galaxy.ansible.com/do1jlr/i3wm) diff --git a/files/i3blocks/config b/files/i3blocks/config index 5ff1bf4..53806a6 100644 --- a/files/i3blocks/config +++ b/files/i3blocks/config @@ -3,8 +3,8 @@ separator_block_width=15 markup=pango [weather] -command=curl -Ss 'https://wttr.in?0&T' | cut -c 16- | head -4 | tail -2 | xargs echo -interval=1800 +command=curl -Ss 'wttr.in?format="%l:+%c%t+%w\n"' | xargs echo +interval=600 color=#A4C2F4 [volume] diff --git a/files/i3blocks/wlan b/files/i3blocks/wlan index 246e421..a51b6ae 100755 --- a/files/i3blocks/wlan +++ b/files/i3blocks/wlan @@ -10,7 +10,8 @@ if [[ -z "$IFACE" ]] ; then elif ( ip a s dev wlan0 ) > /dev/null 2>& 1 ; then IFACE="wlan0" else - exit 1 + # No wlan interface found + exit 0 fi fi diff --git a/tasks/config.yml b/tasks/config.yml new file mode 100644 index 0000000..ffd9ab9 --- /dev/null +++ b/tasks/config.yml @@ -0,0 +1,50 @@ +--- +- name: Creates directory + become: true + ansible.builtin.file: + path: '/home/{{ i3wm_user }}/.config' + state: directory + mode: 0750 + owner: "{{ i3wm_user }}" + group: "{{ i3wm_user }}" + +- name: create i3 config folder + become: true + ansible.builtin.file: + path: '/home/{{ i3wm_user }}/.config/i3/' + state: directory + mode: 0755 + owner: "{{ i3wm_user }}" + group: "{{ i3wm_user }}" + +- name: copy multiple images + ansible.builtin.copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: 0644 + owner: "{{ i3wm_user }}" + group: "{{ i3wm_user }}" + with_items: + - { src: 'files/background.png', dest: "/home/{{ i3wm_user }}/.config/background.png" } + - { src: 'files/lockscreen.png', dest: '/home/{{ i3wm_user }}/.config/lockscreen.png' } + when: i3wm_copy_wallpapers | bool + +- name: copy and validate i3wm config file + become: true + ansible.builtin.template: + src: templates/config.j2 + dest: "/home/{{ i3wm_user }}/.config/i3/config" + mode: 0600 + backup: true + validate: i3 -C -c %s + owner: "{{ i3wm_user }}" + group: "{{ i3wm_user }}" + +- name: copy bin src folder + become: true + ansible.builtin.copy: + src: "{{ role_path }}/files/i3blocks/" + dest: "~/.config/i3blocks" + mode: 0755 + owner: "{{ i3wm_user }}" + group: "{{ i3wm_user }}" diff --git a/tasks/main.yml b/tasks/main.yml index 62c907f..5d4181d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,65 +1,22 @@ --- -- include_tasks: versioncheck.yml +- name: run optional versionscheck + ansible.builtin.include_tasks: versioncheck.yml when: submodules_versioncheck|bool - name: register variables - import_tasks: variables.yml + ansible.builtin.import_tasks: variables.yml -# ensure i3 packages are installed [Debian]. -- include_tasks: setup-Debian.yml +- name: ensure i3 packages are installed [Debian] + ansible.builtin.include_tasks: setup-Debian.yml when: ansible_os_family == 'Debian' -# ensure i3 packages are installed [Archlinux} -- include_tasks: setup-Archlinux.yml +- name: ensure i3 packages are installed [Archlinux} + ansible.builtin.include_tasks: setup-Archlinux.yml when: ansible_os_family == 'Archlinux' -# ensure i3 packages are installed [RHEL]. -- include_tasks: setup-RedHat.yml +- name: ensure i3 packages are installed [RHEL]. + ansible.builtin.include_tasks: setup-RedHat.yml when: ansible_os_family == 'Fedora' or ansible_os_family == 'RedHat' -# create i3 config file -- name: Creates directory - become: true - become_user: "{{ i3wm_user }}" - file: - path: '/home/{{ i3wm_user }}/.config' - state: directory - mode: 0750 - owner: "{{ i3wm_user }}" - -- name: create i3 config folder - become: true - become_user: "{{ i3wm_user }}" - file: - path: '/home/{{ i3wm_user }}/.config/i3/' - state: directory - mode: 0755 - owner: "{{ i3wm_user }}" - -- name: copy multiple images - copy: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - mode: 0644 - with_items: - - { src: 'files/background.png', dest: "/home/{{ i3wm_user }}/.config/background.png" } - - { src: 'files/lockscreen.png', dest: '/home/{{ i3wm_user }}/.config/lockscreen.png' } - when: i3wm_copy_wallpapers | bool - -- name: copy and validate i3wm config file - become: true - become_user: "{{ i3wm_user }}" - template: - src: templates/config.j2 - dest: "/home/{{ i3wm_user }}/.config/i3/config" - mode: 0600 - backup: true - validate: i3 -C -c %s - -- name: vim - copy bin src folder - become: true - become_user: "{{ i3wm_user }}" - copy: - src: "{{ role_path }}/files/i3blocks/" - dest: "~/.config/i3blocks" - mode: 0755 +- name: create i3 config file + ansible.builtin.include_tasks: config.yml diff --git a/tasks/setup-Archlinux.yml b/tasks/setup-Archlinux.yml index 558f8a5..6fa8068 100644 --- a/tasks/setup-Archlinux.yml +++ b/tasks/setup-Archlinux.yml @@ -1,6 +1,6 @@ --- - name: ensure i3 packages are installed. - pacman: + ansible.builtin.pacman: name: "{{ i3_packages }}" state: present update_cache: true diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index f25a6ce..cd5dec9 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -1,6 +1,6 @@ --- - name: ensure i3 packages are installed. - apt: + ansible.builtin.apt: name: "{{ i3_packages }}" state: "present" become: true diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index e30c238..a629e80 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -1,6 +1,6 @@ --- - name: ensure i3 packages are installed. - dnf: + ansible.builtin.dnf: name: "{{ i3_packages }}" state: present become: true diff --git a/tasks/variables.yml b/tasks/variables.yml index 908231f..7896d1c 100644 --- a/tasks/variables.yml +++ b/tasks/variables.yml @@ -1,46 +1,46 @@ --- - name: register os-specific variables - include_vars: "{{ ansible_os_family }}.yml" + ansible.builtin.include_vars: "{{ ansible_os_family }}.yml" when: ansible_distribution != "Fedora" - name: register Fedora variables - include_vars: "{{ ansible_distribution }}.yml" + ansible.builtin.include_vars: "{{ ansible_distribution }}.yml" when: ansible_distribution == "Fedora" # i3 packages - name: define i3_packages - set_fact: + ansible.builtin.set_fact: i3_packages: "{{ __i3_packages | list }}" when: i3_packages is not defined - name: define i3_packages_extra - set_fact: + ansible.builtin.set_fact: i3_packages: "{{ i3_packages | list + i3_packages_extra | list }}" when: i3_packages_extra is defined # i3 workspaces - name: define i3_packages - set_fact: + ansible.builtin.set_fact: i3_workspaces: "{{ __i3_workspaces | list }}" when: i3_workspaces is not defined # i3 keybindings - name: define i3_packages - set_fact: + ansible.builtin.set_fact: i3_keybindings: "{{ __i3_keybindings | list }}" when: - i3_keybindings is not defined - __i3_keybindings is defined - name: define extra i3 keybindings - set_fact: + ansible.builtin.set_fact: i3_keybindings: "{{ i3_keybindings_extra | list + i3_keybindings | list }}" when: - i3_keybindings_extra is defined - i3_keybindings is defined - name: define extra i3 keybindings - set_fact: + ansible.builtin.set_fact: i3_keybindings: "{{ i3_keybindings_extra | list }}" when: - i3_keybindings_extra is defined diff --git a/vars/main.yml b/vars/main.yml index 5200357..c42b734 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -33,5 +33,5 @@ __i3_workspaces: user: "{{ i3wm_user }}" -playbook_version_number: 9020 # should be int +playbook_version_number: 9021 # should be int playbook_version_path: 'role-i3wm_chaos-bodensee_github.com.version'