-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for specifying the Growl alert title #153
base: master
Are you sure you want to change the base?
Conversation
Support using the RECORD SEPARATOR (036) control character to split the growl message string into multiple parts to more explicitly control the growl behavior. With this change, the first part is used as the alert title and the second part is the message, mostly backwards-compatible with prior releases: "\e]9;Alert Title \036Growl Notification\007" If no record separator is present, the entire string is used as the user's message as before. Records past the first two are currently ignored for future compatibility.
Why not use newline as the separator? I don't think I've ever seen \036 used for anything. |
\n could conceivably already be in use by someone to create embedded newlines in the alert dialog. To support that case, only the first split should probably be considered with additional newlines kept in the remainder rather than reserving it for future use, and anyone already sending embedded newlines would have to update to add a title. Record Separator seemed to be a harmless, non-printable control character that wouldn't likely be found in existing alerts and was somewhat descriptive, and if it was sent to a prior version (for example, by a script targeting a supporting version) it just results in a longer message. If it doesn't seem likely someone's already using newlines in their alert text, I'm ok with changing it. |
I think the benefit from ease of use exceeds the cost of any possible backward-compatibility breakage (which is trivial) that might ensue. Let's use newline as the separator. As you say, only the first newline would be used to delimit titles, which must be a single line long. |
Ok, I can rework it. |
Change to detecting the first newline sequence in the growl alert message to signify a custom title, rather than RS.
Ok, updated to use newline sequences (As I discovered on my first attempt, \n alone is likely to get turned into \r\n by various things in the pipeline) Tests: |
Looks good. Can you add the tests in your comment to an executable script in tests/growl.sh? I'd pull now but there was a merge conflict, so please rebase. |
Conflicts: VT100Screen.m
Support using the RECORD SEPARATOR (036) control character
to split the growl message string into multiple parts to
more explicitly control the growl behavior. With this change,
the first part is used as the alert title and the second part
is the message, mostly backwards-compatible with prior
releases:
"\e]9;Alert Title \036Growl Notification\007"
If no record separator is present, the entire string is used
as the user's message as before.
Records past the first two are currently ignored for future
compatibility.