[vte/wip/fedora-0-64: 2/10] vte.sh: Emit OSC 777 from PROMPT_COMMAND




commit ea15828647e24adef86001cbb8bc0185eba3c41e
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Mar 22 19:02:31 2021 +0100

    vte.sh: Emit OSC 777 from PROMPT_COMMAND
    
    For some reason, the three consecutive backslashes break the parsing.
    As Christian Persch suggested, replacing the double quotes with
    singles fixes it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711059

 src/vte.sh.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/vte.sh.in b/src/vte.sh.in
index 3ac99d7e..2c6f6681 100644
--- a/src/vte.sh.in
+++ b/src/vte.sh.in
@@ -27,10 +27,12 @@ __vte_osc7 () {
 }
 
 __vte_prompt_command() {
+  local command=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]\+ *//')
+  command="${command//;/ }"
   local pwd='~'
   [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/}
   pwd="${pwd//[[:cntrl:]]}"
-  printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${pwd}"
+  printf '\033]777;notify;Command completed;%s\033\\\033]0;%s@%s:%s\033\\' "${command}" "${USER}" 
"${HOSTNAME%%.*}" "${pwd}"
   __vte_osc7
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]