From 785c5e4b7c9312428862d8bb396537faa3e61b91 Mon Sep 17 00:00:00 2001
From: Jonathan Bauer
Date: Wed, 19 May 2021 10:26:57 +0200
Subject: [desktop-xfce4] xfce4 with bwlp modifications
---
.../18.04/etc/profile.d/20-default-xfce4-panel.sh | 16 +++
.../files/18.04/etc/xdg/xfce4/kiosk/kioskrc | 2 +
.../files/18.04/etc/xdg/xfce4/panel/default.xml | 92 ++++++++++++++++
.../20.04/etc/profile.d/20-default-xfce4-panel.sh | 16 +++
.../files/20.04/etc/xdg/xfce4/kiosk/kioskrc | 2 +
.../files/20.04/etc/xdg/xfce4/panel/default.xml | 120 +++++++++++++++++++++
desktop-xfce4/tasks/main.yml | 104 ++++++++++++++++++
7 files changed, 352 insertions(+)
create mode 100644 desktop-xfce4/files/18.04/etc/profile.d/20-default-xfce4-panel.sh
create mode 100644 desktop-xfce4/files/18.04/etc/xdg/xfce4/kiosk/kioskrc
create mode 100644 desktop-xfce4/files/18.04/etc/xdg/xfce4/panel/default.xml
create mode 100644 desktop-xfce4/files/20.04/etc/profile.d/20-default-xfce4-panel.sh
create mode 100644 desktop-xfce4/files/20.04/etc/xdg/xfce4/kiosk/kioskrc
create mode 100644 desktop-xfce4/files/20.04/etc/xdg/xfce4/panel/default.xml
create mode 100644 desktop-xfce4/tasks/main.yml
diff --git a/desktop-xfce4/files/18.04/etc/profile.d/20-default-xfce4-panel.sh b/desktop-xfce4/files/18.04/etc/profile.d/20-default-xfce4-panel.sh
new file mode 100644
index 0000000..6454c84
--- /dev/null
+++ b/desktop-xfce4/files/18.04/etc/profile.d/20-default-xfce4-panel.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+default_panel_file="/etc/xdg/xfce4/panel/default.xml"
+if [ ! -e "$default_panel_file" ]; then
+ exit 1
+fi
+
+[ -z "$HOME" ] && HOME=$( getent passwd "$(id -u $PAM_USER)" | awk -F: '{print $6}' )
+
+TARGET_HOME_DIR="$HOME"
+[ -d "$HOME/PERSISTENT" ] && TARGET_HOME_DIR="$HOME/PERSISTENT"
+
+if [ ! -e "${TARGET_HOME_DIR}/.config/xfce4/panel/default.xml" ]; then
+ mkdir -p "${TARGET_HOME_DIR}/.config/xfce4/panel"
+ cp -f -- "$default_panel_file" "${TARGET_HOME_DIR}/.config/xfce4/panel/"
+fi
diff --git a/desktop-xfce4/files/18.04/etc/xdg/xfce4/kiosk/kioskrc b/desktop-xfce4/files/18.04/etc/xdg/xfce4/kiosk/kioskrc
new file mode 100644
index 0000000..b2bd204
--- /dev/null
+++ b/desktop-xfce4/files/18.04/etc/xdg/xfce4/kiosk/kioskrc
@@ -0,0 +1,2 @@
+[xfce4-session]
+SaveSession=NONE
diff --git a/desktop-xfce4/files/18.04/etc/xdg/xfce4/panel/default.xml b/desktop-xfce4/files/18.04/etc/xdg/xfce4/panel/default.xml
new file mode 100644
index 0000000..2e58896
--- /dev/null
+++ b/desktop-xfce4/files/18.04/etc/xdg/xfce4/panel/default.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/desktop-xfce4/files/20.04/etc/profile.d/20-default-xfce4-panel.sh b/desktop-xfce4/files/20.04/etc/profile.d/20-default-xfce4-panel.sh
new file mode 100644
index 0000000..6454c84
--- /dev/null
+++ b/desktop-xfce4/files/20.04/etc/profile.d/20-default-xfce4-panel.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+default_panel_file="/etc/xdg/xfce4/panel/default.xml"
+if [ ! -e "$default_panel_file" ]; then
+ exit 1
+fi
+
+[ -z "$HOME" ] && HOME=$( getent passwd "$(id -u $PAM_USER)" | awk -F: '{print $6}' )
+
+TARGET_HOME_DIR="$HOME"
+[ -d "$HOME/PERSISTENT" ] && TARGET_HOME_DIR="$HOME/PERSISTENT"
+
+if [ ! -e "${TARGET_HOME_DIR}/.config/xfce4/panel/default.xml" ]; then
+ mkdir -p "${TARGET_HOME_DIR}/.config/xfce4/panel"
+ cp -f -- "$default_panel_file" "${TARGET_HOME_DIR}/.config/xfce4/panel/"
+fi
diff --git a/desktop-xfce4/files/20.04/etc/xdg/xfce4/kiosk/kioskrc b/desktop-xfce4/files/20.04/etc/xdg/xfce4/kiosk/kioskrc
new file mode 100644
index 0000000..b2bd204
--- /dev/null
+++ b/desktop-xfce4/files/20.04/etc/xdg/xfce4/kiosk/kioskrc
@@ -0,0 +1,2 @@
+[xfce4-session]
+SaveSession=NONE
diff --git a/desktop-xfce4/files/20.04/etc/xdg/xfce4/panel/default.xml b/desktop-xfce4/files/20.04/etc/xdg/xfce4/panel/default.xml
new file mode 100644
index 0000000..16bd715
--- /dev/null
+++ b/desktop-xfce4/files/20.04/etc/xdg/xfce4/panel/default.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/desktop-xfce4/tasks/main.yml b/desktop-xfce4/tasks/main.yml
new file mode 100644
index 0000000..ac78a13
--- /dev/null
+++ b/desktop-xfce4/tasks/main.yml
@@ -0,0 +1,104 @@
+---
+- name: Install XFCE4 desktop environment
+ apt:
+ name: "{{ xfce_packages }}"
+ state: present
+ install_recommends: no
+ vars:
+ xfce_packages:
+ - evince
+ - mousepad
+ - ristretto
+ - xfce4
+ - xfce4-terminal
+ - xfce4-goodies
+ - xfce4-power-manager
+ - xubuntu-icon-theme
+ - greybird-gtk-theme
+ - pavucontrol
+ - pulseaudio
+ - udisks2
+ - gvfs
+ - gvfs-backends
+ - gvfs-fuse
+ # for xml module
+ - python3-lxml
+
+# TODO: do this the proper way, when it is known how :)
+- name: HACK overwrite default wallpaper
+ find:
+ paths: /usr/share/backgrounds/xfce
+ patterns: "*"
+ register: xfce_backgrounds
+
+- name: HACK overwrite default wallpaper
+ file:
+ path: "{{ item.path }}"
+ state: absent
+ with_items: "{{ xfce_backgrounds.files }}"
+
+- name: HACK overwrite default wallpaper
+ file:
+ src: /usr/share/backgrounds/bwlp-1920x1080.png
+ dest: "{{ item.path }}"
+ state: link
+ force: yes
+ with_items: "{{ xfce_backgrounds.files }}"
+
+- name: Cleanup applications menu
+ file:
+ path: "{{ item }}"
+ state: absent
+ with_items:
+ - /usr/share/applications/exo-mail-reader.desktop
+ - /usr/share/applications/assistant-qt5.desktop
+ - /usr/share/applications/designer-qt5.desktop
+ - /usr/share/applications/linguist-qt5.desktop
+ - /usr/share/applications/globaltime.desktop
+ - /usr/share/applications/xfcalendar.desktop
+
+- name: Copy distro's specific static files
+ copy:
+ src: "files/{{ ansible_distribution_version }}/"
+ dest: /
+ become: yes
+
+# disable logout menu items
+- name: Configure xfce4 logout menu | probe shutdown node
+ xml:
+ path: /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml
+ xpath: /channel/property[@name='shutdown']
+ count: yes
+ register: shutdown_nodes
+
+- name: Configure xfce4 logout menu | check shutdown node
+ debug:
+ var: shutdown_nodes.count
+
+- name: Configure xfce4 logout menu | add shutdown node if missing
+ xml:
+ path: /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml
+ xpath: /channel
+ add_children:
+ - property:
+ name: "shutdown"
+ type: "empty"
+ pretty_print: yes
+ when: shutdown_nodes.count == 0
+
+- name: Configure xfce4 logout menu | disable suspend and hibernate
+ xml:
+ path: /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml
+ xpath: /channel/property[@name='shutdown']
+ add_children:
+ - property:
+ name: "ShowSuspend"
+ type: "bool"
+ value: "false"
+ - property:
+ name: "ShowHibernate"
+ type: "bool"
+ value: "false"
+ pretty_print: yes
+ when: shutdown_nodes.count == 0
+
--
cgit v1.2.3-55-g7522