summaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2019-01-22 15:53:12 +0100
committerDave Davenport <qball@gmpclient.org>2019-01-22 15:53:12 +0100
commit274f2297aac92fb3c7bc4b8f09c696bbf1873f37 (patch)
treeebb16438cf0394a8be911c355077eb3ea4758de6 /script
parentcac2eb1a7fec8238379526d5195cd0d3bad1620a (diff)
Fix creating config file if none exists.
Fixes: #895
Diffstat (limited to 'script')
-rwxr-xr-xscript/rofi-theme-selector9
1 files changed, 7 insertions, 2 deletions
diff --git a/script/rofi-theme-selector b/script/rofi-theme-selector
index f49e8d59..3f380992 100755
--- a/script/rofi-theme-selector
+++ b/script/rofi-theme-selector
@@ -178,12 +178,17 @@ function set_theme()
${SED} -i "/@import.*/d" "${get_link}"
echo "@import \"${1}\"" >> "${get_link}"
else
- if [ -f "${CDIR}/config" ]
+ if [ ! -e "${CDIR}/config" ]
then
+ # No file.
+ echo "rofi.theme: ${1}" >> "${CDIR}/config"
+ elif [ -f "${CDIR}/config" ]
+ then
+ # Regular file
get_link=$(readlink -f "${CDIR}/config")
${SED} -i "/rofi\.theme: .*\.rasi$/d" "${get_link}"
+ echo "rofi.theme: ${1}" >> "${get_link}"
fi
- echo "rofi.theme: ${1}" >> "${get_link}"
fi
}