From 1efa3c0df71b51f7df007357c35d56dcc82780df Mon Sep 17 00:00:00 2001 From: Alexander Gottweis Date: Mon, 15 Jul 2024 15:30:30 +0200 Subject: [PATCH] Automatically create xfce4-terminal config if it does not exist --- apply-colors.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apply-colors.sh b/apply-colors.sh index c4b24e96..eb583f45 100755 --- a/apply-colors.sh +++ b/apply-colors.sh @@ -930,12 +930,12 @@ apply_xfce4-terminal() { CONFFILE="${HOME}/.config/xfce4/terminal/terminalrc" if [[ ! (-w "${CONFFILE}") ]]; then - if [[ -r "${XDG_CONFIG_DIRS%%:*}/Terminal/terminalrc" ]]; then - cp "${XDG_CONFIG_DIRS%%:*}/Terminal/terminalrc" ${CONFFILE} - else - printserr "ERROR: config file not present or not writable!" - exit 1 - fi + if [[ -r "${XDG_CONFIG_DIRS%%:*}/Terminal/terminalrc" ]]; then + cp "${XDG_CONFIG_DIRS%%:*}/Terminal/terminalrc" ${CONFFILE} + else + [[ -d "$(dirname "${CONFFILE}")" ]] || mkdir --parents "$(dirname "${CONFFILE}")" + touch "${CONFFILE}" || { printserr "Error: xfce4-terminal config file not writeable: ${CONFFILE}"; exit 1; } + fi fi [[ -d "${SCHEMEDIR}" ]] || mkdir -p "${SCHEMEDIR}"