From c1b253f0fe13e104dfcaae7b69d64cd9f4434cd4 Mon Sep 17 00:00:00 2001 From: swapnil Date: Tue, 22 Mar 2022 17:32:41 +0530 Subject: [PATCH] Updated general changes - Expects xfce to be installed and session is running - Get property name before setting wallpaper because this property differs --- .../roles/role-one/tasks/general-changes.yml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/playbook/roles/role-one/tasks/general-changes.yml b/playbook/roles/role-one/tasks/general-changes.yml index ae4f0c5..eef9a8a 100644 --- a/playbook/roles/role-one/tasks/general-changes.yml +++ b/playbook/roles/role-one/tasks/general-changes.yml @@ -1,11 +1,18 @@ --- -- name: General Changes | Install xfce4 - become: yes - apt: - name: xfce4 - state: latest - update_cache: yes +- name: General Changes | Check if xfce session is running + shell: + cmd: "echo $DESKTOP_SESSION" + register: session_running + +- name: General Changes | Debug session_running + debug: + var: session_running + +- name: General Changes | Stop execution if xfce session is not running + fail: + msg: "xfce session is not running" + when: session_running.stdout and session_running.stdout != 'xfce' - name: General Changes | Hide icons xfconf: @@ -59,9 +66,22 @@ dest: "{{ home_directory }}/Pictures" remote_src: yes +- name: General Changes | Get propery name for setting wallpaper + shell: + cmd: "xfconf-query -c xfce4-desktop -l | grep 'last-image$'" + register: wallpaper_property + +- name: Debug | Debug wallpaper_property + debug: + var: wallpaper_property + +- name: Debug | Debug wallpaper_property.stdout_lines + debug: + var: wallpaper_property.stdout_lines[0] + - name: General Changes | Change wallpaper xfconf: channel: "xfce4-desktop" - property: "/backdrop/screen0/monitor0/workspace0/last-image" - value_type: "string" + property: "{{ wallpaper_property.stdout_lines[0] }}" + value_type: string value: "{{ home_directory }}/Pictures/wallpapers/2560x1440.png"