Skip to content

Commit

Permalink
feat: error/warning messages on first load (#278)
Browse files Browse the repository at this point in the history
`tmux_echo` now uses hooks this allows it to print on the first load. To cleanup the hooks every hook gets a _unique_ number/index, this is _not_ enforced.
  • Loading branch information
vdbe authored Aug 5, 2024
1 parent 362a306 commit a2dda02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions utils/module_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ load_modules() {

if [[ -z "${module_name/ }" ]]; then
if [[ -z "${modules_list/ }" ]]; then
tmux_echo "catppuccin warning: a module list has only white space, to remove all modules set it to \"null\""
tmux_echo "catppuccin warning: a module list has only white space, to remove all modules set it to \"null\"" 100
else
tmux_echo "catppuccin warning: a module list with value \"$modules_list\" has leading/trailing whitespace"
tmux_echo "catppuccin warning: a module list with value \"$modules_list\" has leading/trailing whitespace" 101
fi
continue
fi

tmux_echo "catppuccin warning: module $module_name not found"
tmux_echo "catppuccin warning: module $module_name not found" 102


done
Expand Down
6 changes: 4 additions & 2 deletions utils/tmux_utils.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/sh

tmux_echo() {
local message="$1"
tmux run-shell "echo '$message'"
local hook
hook="after-new-session[$2]"

tmux set-hook -g "$hook" "run-shell 'echo \"$1\"'; set-hook -gu \"$hook\""
}

get_tmux_option() {
Expand Down

0 comments on commit a2dda02

Please sign in to comment.