Skip to content

Commit 8e8043c

Browse files
authoredAug 19, 2021
Merge pull request #62 from setsevireon/patch-1
XDG-friendly config reload
2 parents 989d092 + eba4cbe commit 8e8043c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed
 

‎sensible.tmux

+14-3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ key_binding_not_changed() {
6464
fi
6565
}
6666

67+
get_tmux_config() {
68+
local tmux_config_xdg="${XDG_CONFIG_HOME:-$HOME/.config}/tmux/tmux.conf"
69+
local tmux_config="$HOME/.tmux.conf"
70+
71+
[[ -f "${tmux_config_xdg}" ]] && tmux_config=${tmux_config_xdg}
72+
73+
echo ${tmux_config}
74+
}
75+
6776
main() {
6877
# OPTIONS
6978

@@ -147,9 +156,11 @@ main() {
147156

148157
# source `.tmux.conf` file - as suggested in `man tmux`
149158
if key_binding_not_set "R"; then
150-
tmux bind-key R run-shell ' \
151-
tmux source-file ~/.tmux.conf > /dev/null; \
152-
tmux display-message "Sourced .tmux.conf!"'
159+
local tmux_config=$(get_tmux_config)
160+
161+
tmux bind-key R run-shell " \
162+
tmux source-file ${tmux_config} > /dev/null; \
163+
tmux display-message 'Sourced ${tmux_config}!'"
153164
fi
154165
}
155166
main

0 commit comments

Comments
 (0)
Failed to load comments.