Skip to content

Start another notification from "--action=" and newline is not inserted #18

@MR-Diamond

Description

@MR-Diamond

Hi, I have a bash script which does some actions and then display a notification which contains the --action= flag, which does other actions, is set as follow:

notify-send.sh -u critical -t 0 -o Execute:'command1; command2' --icon=/path/to/icon/icon.png " " "<span color='#F6FF45' font='16px'><b>$processname\nThe commands has been executed</b></span>"

After 'command1; command2' I would like to add another notification, so I tried:

notify-send.sh -u critical -t 0 -o Execute:'command1; command2; notify-send.sh -u critical -t 0 --icon=/path/to/icon/icon.png "$processname\nrestored"' --icon=/path/to/icon/icon.png " " "<span color='#F6FF45' font='16px'><b>$processname\nThe commands has been executed</b></span>"

Which half-works: the fact is that in the second notification, the new line parameter "\n" is not applyed and furthermore $processname\nrestored is not displayed at all, when in the first notification, is properly displayed. And if I execute notify-send.sh -u critical -t 0 --icon=/path/to/icon/icon.png "$processname\nrestored" alone, works as expected.
What I am missing?

What I have been able to achieve for now is:

notify-send.sh -u critical -t 0 \
 --icon=/path/to/icon/icon.png \
"$processname\nhas been paused and minimized" \
-o \
Resume:'notify-send.sh -u critical -t 0  --icon=/path/to/icon/icon.png \
"$processname \
Restored"'

In this way the second notification display the message, but the newline is not inserted (only in the first notification, the new line is inserted).

EDIT:

Well, I needed to escape the new line as follow:

"$processname \
\\n\
has been restored"'

Feel free to close this ticket, or to say anything about, if there is another way to achieve the aim :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions