aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordi Pakey-Rodriguez <jordi@0xdec.im>2018-09-30 23:04:15 -0700
committerJordi Pakey-Rodriguez <jordi@0xdec.im>2018-09-30 23:04:15 -0700
commitcbdabe048531bdbfd857619de863010099938bc7 (patch)
treeba2c5b6441b0da71c248dde19aa577b66d80721b
parentedfd5063bee6bcd18ddd6e9d1c1f2a629d719508 (diff)
Make sure shell hook doesn't overwrite config
Addresses #8
-rw-r--r--README.md2
-rwxr-xr-xhook/rofi.sh5
2 files changed, 4 insertions, 3 deletions
diff --git a/README.md b/README.md
index 26667e3..4a5ee9a 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ ln -s base16-rofi/themes/base16-default-dark.config >> ~/.config/rofi/config
### Base16-Shell Hook
-For Rofi < 1.4 this repo also provides a hook to switch the colorscheme automatically when a base16_shell theme is set. The setup is pretty straightforward:
+For Rofi < 1.4 this repo also provides a hook to switch the colorscheme automatically when a base16_shell theme is set. Note that for now, this only works when there is no existing Rofi config file (to avoid overwriting it). The setup is pretty straightforward:
```
> export BASE16_SHELL_HOOKS=$HOME/.config/base16-shell/hooks
diff --git a/hook/rofi.sh b/hook/rofi.sh
index 816aac7..ca739bd 100755
--- a/hook/rofi.sh
+++ b/hook/rofi.sh
@@ -1,9 +1,10 @@
#!/usr/bin/env bash
+
rofi_config_file=$HOME/.config/rofi/config
rofi_themes_dir=$HOME/sources/base16-rofi/themes
-
rofi_theme_file=$rofi_themes_dir/base16-$BASE16_THEME.config
-if [ -f "$rofi_theme_file" ] && [ -f $rofi_config_file ]; then
+
+if ![ -f $rofi_config_file ] && [ -f "$rofi_theme_file" ]; then
cp "$rofi_theme_file" "$rofi_config_file"
echo 'Rofi theme updated'
fi