Skip to content

Commit 72e4071

Browse files
committed
properly check for user config
1 parent 890f25c commit 72e4071

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

buku_run

+21-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,29 @@ actions="Alt+a"
1313
help_color="#334433"
1414

1515
# source global config
16-
source /etc/buku.config
16+
if [[ -f /etc/buku_run.config ]]
17+
then
18+
source /etc/buku_run.config
19+
fi
1720

1821
# source local config:
19-
source $HOME/.config/buku_run/config
22+
if [[ -z $XDG_CONFIG_DIR ]]
23+
then
24+
if [[ -f $HOME/.config/buku_run/config ]]
25+
then
26+
source $HOME/.config/buku_run/config
27+
else
28+
echo "User config file \'~/.config/buku_run/config\' not found. using global config"
29+
fi
30+
else
31+
if [[ -f "${XDG_CONFIG_DIR}/buku_run/config" ]]
32+
then
33+
source "${XDG_CONFIG_DIR}/buku_run/config"
34+
else
35+
echo "User config file \'~/.config/buku_run/config\' not found. using global config"
36+
fi
37+
fi
38+
2039

2140
main () {
2241
HELP="Welcome to Buku. Use <span color='${help_color}'>${new_bookmark}</span> to add a new Bookmark

0 commit comments

Comments
 (0)