summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authormynacol2021-02-05 22:39:34 +0100
committermynacol2021-02-05 22:39:34 +0100
commitc32caef84390ec7fab33be45b77f4bd3cb73e1f6 (patch)
tree41ce67eea237f3b42faa1a8fe8270aad1585f564
parent487b1d831cb5d5024e9db694dc5c3d6665ac8e27 (diff)
downloadaur-c32caef84390ec7fab33be45b77f4bd3cb73e1f6.tar.gz
Check if files exist and are writable first
-rwxr-xr-xdark-theme.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/dark-theme.sh b/dark-theme.sh
index 29d3dc8a305b..315efecc0f34 100755
--- a/dark-theme.sh
+++ b/dark-theme.sh
@@ -55,14 +55,22 @@ else
fi
# set Qt theme
-sed -i -E "s@^style=.*@style=${UI_THEME_QT}@" ~/.config/qt5ct/qt5ct.conf
+f="$HOME/.config/qt5ct/qt5ct.conf"
+if [[ -w "$f" ]]; then
+ sed -i -E "s@^style=.*@style=${UI_THEME_QT}@" "$f"
+fi
# set alacritty theme
-sed -i -E "s/^colors: \*.*$/colors: *$UI_ALACRITTY/" ~/.config/alacritty/alacritty.yml
+f="$HOME/.config/alacritty/alacritty.yml"
+if [[ -w "$f" ]]; then
+ sed -i -E "s/^colors: \*.*$/colors: *$UI_ALACRITTY/" "$f"
+fi
# set vscode theme
f="$HOME/.config/Code - OSS/User/settings.json"
-jq ".[\"workbench.colorTheme\"]=\"${UI_VSCODE}\"" "$f" | sponge "$f"
+if [[ -w "$f" ]]; then
+ jq ".[\"workbench.colorTheme\"]=\"${UI_VSCODE}\"" "$f" | sponge "$f"
+fi
# set background
# properly supply arguments separated by spaces