From 52ca81ba1cf2e2739a96b326d40705753d31872d Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Wed, 29 Mar 2023 15:00:32 +0100 Subject: [PATCH] Set up XDG desktop dirs under data/ --- roles/home-cli/files/profile | 21 +++++++++++++++++---- roles/home-cli/files/user-dirs.dirs | 8 ++++++++ roles/home-cli/tasks/dotfiles.yml | 4 ++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 roles/home-cli/files/user-dirs.dirs diff --git a/roles/home-cli/files/profile b/roles/home-cli/files/profile index 1b3d98a..a577d46 100644 --- a/roles/home-cli/files/profile +++ b/roles/home-cli/files/profile @@ -44,11 +44,24 @@ export POWERSHELL_TELEMETRY_OPTOUT=1 export PYTHONWARNINGS=ignore::UserWarning export VIRSH_DEFAULT_CONNECT_URI=qemu:///session -if [ -d /var/acp ] && ! [ -L /var/acp ] +if ! [ -x "$HOME/data" ] then - export ACP=/var/acp -else - export ACP="$HOME/data" + install -d -m 0700 "$HOME/data" +fi + +if [ -r "$XDG_CONFIG_HOME/user-dirs.dirs" ] +then + ( + . "$XDG_CONFIG_HOME/user-dirs.dirs" + mkdir -p $XDG_DESKTOP_DIR + mkdir -p $XDG_DOCUMENTS_DIR + mkdir -p $XDG_DOWNLOAD_DIR + mkdir -p $XDG_MUSIC_DIR + mkdir -p $XDG_PICTURES_DIR + mkdir -p $XDG_PUBLICSHARE_DIR + mkdir -p $XDG_TEMPLATES_DIR + mkdir -p $XDG_VIDEOS_DIR + ) fi # Desktop files (used by desktop environments within both X11 and Wayland) are diff --git a/roles/home-cli/files/user-dirs.dirs b/roles/home-cli/files/user-dirs.dirs new file mode 100644 index 0000000..768494a --- /dev/null +++ b/roles/home-cli/files/user-dirs.dirs @@ -0,0 +1,8 @@ +XDG_DESKTOP_DIR="$HOME/Desktop" +XDG_DOCUMENTS_DIR="$HOME/data/Documents" +XDG_DOWNLOAD_DIR="$HOME/Downloads" +XDG_MUSIC_DIR="$HOME/data/Music" +XDG_PICTURES_DIR="$HOME/data/Pictures" +XDG_PUBLICSHARE_DIR="$HOME/Public" +XDG_TEMPLATES_DIR="$HOME/Templates" +XDG_VIDEOS_DIR="$HOME/data/Videos" diff --git a/roles/home-cli/tasks/dotfiles.yml b/roles/home-cli/tasks/dotfiles.yml index bfafcc0..82f5d0f 100644 --- a/roles/home-cli/tasks/dotfiles.yml +++ b/roles/home-cli/tasks/dotfiles.yml @@ -71,3 +71,7 @@ src: virtinst.sh dest: "{{ ansible_env.HOME }}/.local/bin/virtinst" mode: '0755' +- name: Create $XDG_CONFIG_HOME/user-dirs.dirs + ansible.builtin.copy: + src: user-dirs.dirs + dest: "{{ ansible_env.XDG_CONFIG_HOME }}/user-dirs.dirs"