Files
rootiest ce84db593c feat(guards): add opinionated component guards to config.fish and conf.d
Adds __fish_config_op_enabled helper (master __fish_config_opinionated
evaluated first via __fish_variable_check, then the category variable)
and gates C1-C4 components: CachyOS surgical override, PAGER/MANPAGER,
CDPATH, Vi mode, exit override, bang-bang bindings, history/cp/mv/wget/
grep aliases, cd->z alias, Fisher bootstrap and theme apply, paru/yay
wrapper generation, WakaTime hook, custom key chords, puffer, autopair,
starship prompt, Catppuccin colors, FZF_DEFAULT_OPTS, done notifications,
and Kitty/WezTerm window-management abbreviations.
2026-06-10 11:28:43 -04:00

49 lines
1.3 KiB
Fish

###
# wakatime.fish
#
# hook script to send wakatime a tick (unofficial)
# see: https://github.com/ik11235/wakatime.fish
###
# Local modification: opinionated guard (AGENTS.md Task #3). WakaTime
# reporting is classified under both C2 auto-execution and C4 integrations;
# disabling either category skips registering the hook.
__fish_config_op_enabled __fish_config_op_autoexec; or exit
__fish_config_op_enabled __fish_config_op_integrations; or exit
function __register_wakatime_fish_before_exec -e fish_postexec
if set -q FISH_WAKATIME_DISABLED
return 0
end
set -l exec_command_str
set exec_command_str (string split -f1 ' ' "$argv")
if test "$exec_command_str" = 'exit'
return 0
end
set -l PLUGIN_NAME "ik11235/wakatime.fish"
set -l PLUGIN_VERSION "0.0.6"
set -l project
set -l wakatime_path
if type -p wakatime 2>&1 > /dev/null
set wakatime_path (type -p wakatime)
else if type -p ~/.wakatime/wakatime-cli 2>&1 > /dev/null
set wakatime_path (type -p ~/.wakatime/wakatime-cli)
else
return 1
end
if git rev-parse --is-inside-work-tree &> /dev/null
set project (basename (git rev-parse --show-toplevel))
else
set project "Terminal"
end
$wakatime_path --write --plugin "$PLUGIN_NAME/$PLUGIN_VERSION" --entity-type app --project "$project" --entity "$exec_command_str" &> /dev/null&; disown
end