From da53f478f4808fdad0fc1e4b322e98f94d9b116c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 30 Dec 2024 21:49:33 +0200 Subject: feat(bash): Set tab title after entering a command --- .bashrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to '.bashrc') diff --git a/.bashrc b/.bashrc index 0ea7c66..b374b15 100644 --- a/.bashrc +++ b/.bashrc @@ -221,8 +221,12 @@ export PROMPT_COMMAND="shell_var_fix;" bind "set vi-ins-mode-string \"$(left_cap)i$(right_cap)\"" bind "set vi-cmd-mode-string \"$(left_cap $PS_WARN)n$(right_cap $PS_WARN)\"" + # Thanks https://stackoverflow.com/a/13773343 + set_tab_title() { + printf '\e]2;%s\a' "$*" + } # Huge thanks to: https://lists.gnu.org/archive/html/help-bash/2022-02/msg00023.html - bind -x "\"\xC0\a\":printf \"$(left_cap $PS_DBG)%(%T)T$(right_cap $PS_DBG)\"" + bind -x "\"\xC0\a\":set_tab_title \"\$READLINE_LINE\";printf \"$(left_cap $PS_DBG)%(%T)T$(right_cap $PS_DBG)\"" bind '"\xC0\r":accept-line' bind '"\r":"\xC0\a\xC0\r"' # }}} -- cgit v1.2.3