Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use Growl to monitor long-running shell commands' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use Growl to monitor long-running shell commands
Authored by: atr000 on Oct 11, '07 09:01:35PM

Amazing work here, especially the bash code for doing this. Even with how customized I've got bash to be, zsh seems to incorporate many of the great features that don't require scripts like this to be created.

A few thoughts:
1) Would it be possible to retain another PROMPT_COMMAND function? I have (had) a very nice newCMD to truncate the PWD on PS1 (the shell prompt), which required using the PROMPT_COMMAND variable?

2) Quickly, I did modify the ten second limit to much longer but have found that the growl popups from any command are annoying. I think putting in a white/black list scheme would help here since commands like make are optimal for something like this, while closing a tab after being connected for an hour via SSH is not.



[ Reply to This | # ]
Use Growl to monitor long-running shell commands
Authored by: sapporo on Oct 12, '07 01:56:54AM
1) Not unless you improve preexec.bash to allow this. It explicitly states:
"Note: this module requires 2 bash features which you must not otherwise be using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. preexec_install will override these and if you override one or the other this _will_ break".

2) Depending on your shell usage pattern, yes, there will be false positives (notifications you don't need or want). I thought about a white/blacklist approach, but it's too much hassle for my taste.

I like to keep stuff like that simple, and I don't mind the false positives. They do distract me for a second, but I still prefer that to having to decide in advance whether or not I'll be notified. Making that decision in advance each time I execute a shell command would take me more time than looking at a superfluous notification once in a while.

And while this setup works fine for me, I consider that a technique rather than a product, so go ahead and tweak it to your tastes.

[ Reply to This | # ]

Use Growl to monitor long-running shell commands
Authored by: stevev on Oct 12, '07 06:15:21AM

as for #1, i use a different technique which may be of use to you in this scenario. specifically, the steps below do not use PROMPT_COMMAND.

1. take the contents of your newPWD command and put them in an executable shell script somewhere in your path.

2. change PS1 to use something along the lines of "\$(<shell name here>)". for example, my PS1 is "\\h:\$(trim-pwd.bash)\$ \[\e]0;\H:\w\a\]" (as an aside, the escape sequence is there to change the title of terminal to the working directory)

and that's it. you now should have the path trimmed without using the PROMPT_COMMAND environment variable. i can post the contents of "trim-pwd.bash" if anyone needs it.

hth



[ Reply to This | # ]