Page 1 of 1
Line returns in Growl Messages?
Posted: Tue Feb 27, 2007 6:38 pm
by peteo
Any idea how to create a line return or paragraph break in Growl messages that are displayed on-screen? I'm using Growl in a college setting to display a message of the day when students log in. Knowing how to format these messages to add line breaks would help a lot!
- Pete O
Posted: Tue Feb 27, 2007 8:48 pm
by evands
Have you tried inserting the line break escape code, \n, in your message string?
Also, I'd love to hear more about how you're coding this -- retrieving a MOTD and displaying it, I mean. The implementation might be useful to others in other contexts, as well.
Nope, \n doesn't work
Posted: Fri Mar 02, 2007 2:41 am
by peteo
\n doesn't work, it just prints out as visible "\n" along with the rest of the text of the message. I've also tried web-type html formatting using <p> or <br /> and they just print visibly too, so apparently there is no html interpreter in Growl.
Any other ideas?
Posted: Fri Mar 02, 2007 2:50 am
by bgannin
I think \n should have been respected, HTML would not as there's not going to be HTML support in notification text and titles.
Newline
Posted: Tue Mar 06, 2007 1:41 pm
by ICHIV
Hi,
Try this :
Code: Select all
echo -e "Test \nNewline" | growlnotify
HTH
Posted: Sat Mar 10, 2007 1:44 am
by DeltaTee
What method are you using to post the messages?
Got it!
Posted: Tue Mar 13, 2007 9:18 pm
by peteo
Finally was able to figure this out. What I needed to insert into the text string was a *literal line return*. I did this by editing my text message in vi (or vim) and placing literal line returns wherever I need them. "i" to enter insert mode, "control-v" to insert a literal character, and then hit the "return" key to place the return character into the text string. Then "esc" to exit insert mode, and ":wq" to write the file and quit out of vim. I don't completely understand why this works and "\n" doesn't, but it solves my problem. I can also use two literal line returns in a row to create a paragraph break and begin a new paragraph in my message.
For those who are interested, we're using Growl to display a "message of the day" on Macintosh screens in a school lab setting when students log in. The message file is stored on a Macintosh OS X Server. Students are logging into network (roaming) home directories. We use a login hook on the Lab Macs to curl retrieve the file from the server and then Growl handles a nice display of the message in upper right corner of the screen. Message stays there until student clicks to dismiss it. We're also using Growl to display remaining quota space available to student on the server.
Posted: Tue Mar 13, 2007 9:37 pm
by evands
Ah. When you load that file, those line returns are converted to an internal representation of \n by whatever is reading it, as that's how line breaks are stored in strings. We all assumed you were doing this message programatically.