LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 03-05-2010, 08:21 AM   #1
Mleahy
Member
 
Registered: Jan 2004
Posts: 43

Rep: Reputation: 15
Question Using notify-send with multiple lines in body


Hey all,

I'm trying to setup a hotkey in KDE that will popup a notification with the current playlist I have running in an xmms2 server.

I currently have some hotkeys such as the following actions, which work fine:

Code:
xmms2 prev; notify-send "Currently Playing" "`xmms2 current`"
xmms2 next; notify-send "Currently Playing" "`xmms2 current`"
That works fine. However, if I want to popup the current playlist, I would want to do something like the following:

Code:
notify-send "Current Playlist" "`xmms2 list`"
But the playlist has newline characters, which apparently notify-send doesn't like...so I've been looking for a way to clear out the newline characters - and ideally replace them with something notify-send can display as newlines (e.g., HTML with <br> tags?).

I've tried using sed to do this, but I don't know enough about it. From what I can tell, the following has no effect on the output (nor do any variations I have tried thus far):

Code:
xmms2 list | sed '{s/\n/<br>/g}'
I've searched around online, but there are far too many examples of what I don't want to do that are drowning out what I do want to do. I'm pretty sure I've even asked something very similar myself, but can't find where that was.

Anyone have any recommendations?
 
Old 03-06-2010, 07:53 PM   #2
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
I think xmms2 has configuration options to modify the output of the list command, maybe it has an html/xml option
 
Old 03-10-2010, 04:09 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
I've never seen any problem when dealing with notify-send in this regard.

Can you test something simple like this and see if it works?

Code:
$ notify-send foo "bar
moo
cow"
 
Old 08-14-2021, 07:06 PM   #4
jg70
LQ Newbie
 
Registered: Dec 2008
Location: Central America
Distribution: CentOS, Ubuntu
Posts: 2

Rep: Reputation: 1
Quote:
Originally Posted by i92guboj View Post
I've never seen any problem when dealing with notify-send in this regard.

Can you test something simple like this and see if it works?

Code:
$ notify-send foo "bar
moo
cow"
That does work on the command line but might not do so well in a script.
 
Old 08-15-2021, 03:15 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
It depends on which program provides the notifications!
Which notification daemon does your system use?
Code:
dpkg -l | grep -i notfication
should answer that question.

FWIW, I use dunst and something like
Code:
notify-send Title "$(mpc)"
works as expected, and so does e.g.
Code:
notify-send Title "bla\nbla\nbla"
 
Old 08-16-2021, 10:01 AM   #6
jg70
LQ Newbie
 
Registered: Dec 2008
Location: Central America
Distribution: CentOS, Ubuntu
Posts: 2

Rep: Reputation: 1
Thumbs up Summary required

OMG, I had tried using \n already but with no luck. Since you posted using the same I tried again and it failed... then I tried with Title and it worked. That is called {summary} in the man page and otherwise doesn't seem to be required but it did make \n work.

notify-send "bla\nbla" puts bla\nbla on the screen

notify-send Title "bla\nbla" puts on the screen:
Title
bla
bla

OS = Linux Mint 20.2

Thank you Ondoho
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Libnotify and notify-send problems J_Humphrey Slackware 8 07-27-2010 04:43 PM
Due to the animosity to undescriptive subject lines, little now is left for the body mark_alfred LQ Suggestions & Feedback 12 08-16-2009 01:01 PM
using notify-send ashikahamed Ubuntu 0 05-02-2008 06:09 AM
can some body send me the linux video classes satishchilur Linux - Server 8 04-30-2008 05:31 AM
log send, sendrec, recv and notify system calls xeon123 Other *NIX 1 02-04-2008 05:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 03:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration