[SOLVED] Actions in notifications with notify-send

Using notify-send, is there a way to associate a notification with some action (e.g. execution of a script) when clicking on it? Or is it possible to include a button within the notification? To better understand what I mean, please have a look the below image depicting a notification sent by Rhythmbox that contains some buttons.
Last edited by ibes (2013-11-16 08:00:58)

You might be interested in "dunstify" which is a part of the dunst daemon, but is not installed with the AUR package. It is a more fleshed out interface for libnotify than notify-send.
dunstify -A yes,ACCEPT -A no,DECLINE "Call waiting"
https://github.com/knopwob/dunst
Last edited by progandy (2013-11-15 21:31:33)

Similar Messages

  • [SOLVED] notify-send from a daemon

    Hi,
    I have configured halevt (a HAL device manager) to run notify-send so I get a notification every time I insert or remove a drive. The thing is, since halevt runs as a daemon at boot, every time it runs notify-send I get this error:
    libnotify-Message: Unable to get session bus: /usr/bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed.
    What I don't really understand is why if I restart de daemon from my Xorg session (with sudo) it works fine. Any ideas?
    Thanks
    UPDATE
    I resolved the issue with a different approach.
    The solution, for those interested, is in post #8.
    Last edited by johanbcn (2010-07-12 22:27:14)

    Berseker wrote:I've seen only now your post.. great job, this is very useful and pretty for those that doesn't use a complete DE.
    It would be great to translate your file in different languages (I'll try to translate this in italian if I find some spare time)
    Thank you
    If you are interested I have an updated version of the config file that more or less accomplishes what I wanted at the beginning.
    First, there is the daemon config (only mounts the filesystems): /etc/halevt/halevt.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE halevt:Configuration [
    <!ENTITY HAS-LABEL "hal.volume.label & !hal.volume.label = ">
    <!ENTITY DEVICE "hal.block.device & hal.volume.is_disc = false">
    <!ENTITY CDROM "hal.block.device & hal.volume.is_disc & hal.volume.disc.is_blank = false & hal.volume.disc.has_data & hal.volume.disc.is_videodvd = false">
    <!ENTITY CDROM.SIGNAL "hal.block.device & hal.storage.drive_type = cdrom">
    <!ENTITY DVD "hal.block.device & hal.volume.is_disc & hal.volume.disc.is_blank = false & hal.volume.disc.has_data & hal.volume.disc.is_videodvd = true">
    ]>
    <halevt:Configuration version="0.1" xmlns:halevt="http://www.environnement.ens.fr/perso/dumas/halevt.html">
    <!-- Mount CDRom devices -->
    <halevt:Device match="&CDROM; & hal.volume.is_mounted = false;">
    <halevt:OnInit exec="halevt-mount -u $hal.udi$ -p cdrom$hal.block.minor$"/>
    <halevt:Insertion exec="halevt-mount -u $hal.udi$ -p cdrom$hal.block.minor$"/>
    </halevt:Device>
    <!-- Mount non-CDRom labeled devices -->
    <halevt:Device match="&DEVICE; & &HAS-LABEL; & hal.volume.is_mounted = false;">
    <halevt:OnInit exec="halevt-mount -u $hal.udi$ -p $hal.volume.label$"/>
    <halevt:Insertion exec="halevt-mount -u $hal.udi$ -p $hal.volume.label$"/>
    </halevt:Device>
    <!-- Mount non-CDRom non-labeled devices -->
    <halevt:Device match="&DEVICE; & hal.volume.is_mounted = false; & hal.volume.label = ">
    <halevt:OnInit exec="halevt-mount -u $hal.udi$ -p disk$hal.block.minor$"/>
    <halevt:Insertion exec="halevt-mount -u $hal.udi$ -p disk$hal.block.minor$"/>
    </halevt:Device>
    <!-- Handle CDRom eject button signal -->
    <halevt:Device match="&CDROM.SIGNAL;">
    <halevt:Condition name="EjectPressed" exec="halevt-umount $hal.block.device$; eject $hal.block.device$"/>
    </halevt:Device>
    </halevt:Configuration>
    (Notice that I have removed the -o sync parameter from the mount commands. Writing operations in automounted devices were ridiculously slower)
    And then, there is the user config file (only manages the notify-send commands): $HOME/.halevt/halevt.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE halevt:Configuration [
    <!ENTITY HAS-LABEL "hal.volume.label & !hal.volume.label = ">
    <!ENTITY DEVICE "hal.block.device & hal.volume.is_disc = false">
    <!ENTITY CDROM "hal.block.device & hal.volume.is_disc & hal.volume.disc.is_blank = false & hal.volume.disc.has_data & hal.volume.disc.is_videodvd = false">
    <!ENTITY CDROM.SIGNAL "hal.block.device & hal.storage.drive_type = cdrom">
    <!ENTITY DVD "hal.block.device & hal.volume.is_disc & hal.volume.disc.is_blank = false & hal.volume.disc.has_data & hal.volume.disc.is_videodvd = true">
    ]>
    <halevt:Configuration version="0.1" xmlns:halevt="http://www.environnement.ens.fr/perso/dumas/halevt.html">
    <!-- Notify CDRom labeled mounts/umounts -->
    <halevt:Device match="hal.block.device & hal.volume.is_disc = true & !hal.volume.label = ">
    <halevt:Property name="hal.volume.is_mounted">
    <halevt:Action value="true" exec="notify-send --icon=gtk-cdrom --expire-time=3000 'Device mounted' '$hal.volume.label$ has been mounted in $hal.volume.mount_point$.'"/>
    <halevt:Action value="false" exec="notify-send --icon=gtk-cdrom --expire-time=3000 'Device unmounted' '$hal.volume.label$ has been unmounted.'"/>
    </halevt:Property>
    </halevt:Device>
    <!-- Notify non-CDRom labeled mounts/umounts -->
    <halevt:Device match="hal.block.device & hal.volume.is_disc = false & !hal.volume.label = ">
    <halevt:Property name="hal.volume.is_mounted">
    <halevt:Action value="true" exec="notify-send --icon=gtk-harddisk --expire-time=3000 'Device mounted' '$hal.volume.label$ has been mounted in $hal.volume.mount_point$.'"/>
    <halevt:Action value="false" exec="notify-send --icon=gtk-harddisk --expire-time=3000 'Device unmounted' '$hal.volume.label$ has been unmounted.'"/>
    </halevt:Property>
    </halevt:Device>
    <!-- Notify non-CDRom non-labeled mounts/umounts -->
    <halevt:Device match="hal.block.device & hal.volume.label = ">
    <halevt:Property name="hal.volume.is_mounted">
    <halevt:Action value="true" exec="notify-send --icon=gtk-harddisk --expire-time=3000 'Device mounted' '$hal.block.device$ has been mounted in $hal.volume.mount_point$.'"/>
    <halevt:Action value="false" exec="notify-send --icon=gtk-harddisk --expire-time=3000 'Device unmounted' '$hal.block.device$ has been unmounted.'"/>
    </halevt:Property>
    </halevt:Device>
    </halevt:Configuration>
    This way, you have the daemon automounting at boot, without needing an X session, and a second instance of the daemon that only executes the notify-send messages once you enter xorg
    Last edited by johanbcn (2010-07-12 22:37:43)

  • Reg: PO release notification needs to send to the PR Creater with PO num

    HI Gurus,
    Iam new to workfow. I have one senario in workflow.
    Requirement: when ever PO release notification needs to send to the PR Creater with PO number and corresponding PR number.
    Please guide how to do this .
    My questions :
    1.How can we can get the PR Creater user id to send notification mail
    Thanks & Regards
    Ramesh

    Hi Ramesh ,
    Which workflow you are using for PO . If it is the standard one , there is a rule used in the worklfow called 20000027.
    In this there is an USer exit . In this exit , you can write your code for sending the workitem to the PR creator.
    If you are using a custom workflow for this , then create a new rule and in that write the code for fetching the PR Creator and assign the user ro the actor tab. Incluse this rule in ur task .
    This will solve your problem.

  • [SOLVED] No icon or progress bar with notify-osd-customizable

    Hello,
    I just reinstalled my system; I use a script to know my brightness and audio volume but I can't get it working anymore.
    With this
    notify-send 'Hello world!' -i dialog-information
    I only get the text. If I try this to have a progress bar
    notify-send 'Hello world!' -i dialog-information -h int:value:50
    I just get a notification with 1px height.
    I installed notify-osd-icons to have more icons, but it didn't help.
    The arguements have changed?
    Last edited by Dreamkey (2013-02-13 13:02:29)

    Ok, I'm not sure if it's because of that, but I installed human-icon-theme and after a reboot, it worked.

  • [Solved] Dwm and notify-send

    Hello. I've recently changed my WM from Awesome to DWM and I have a problem with it. Namely, notify-send doesn't work. It doesn't show any popup  or error message. It worked well in Awesome. How to fix it?
    Last edited by changs (2009-05-25 16:53:21)

    I believe awesome uses it's own notification library, "naughty". I haven't used dwm to know how notify-send works, but maybe that's the problem?

  • Notifications failed to send mail for journal approval with attachments

    Issue : Notifications failed to send mail for journals sent for approvals with attachments.
    Error :
    [WF_ERROR] ERROR_MESSAGE=3835: Error '-6502 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small' encountered during execution of Generate function 'WF_XML.Generate' for event 'oracle.apps.wf.notification.send'. ERROR_STACK=
    WF_XML.GetAttachments(71009549, http://vfilvappclone.verifone.com:8000/pls/EBIZRPT, 13525)
    WF_XML.GenerateDoc(oracle.apps.wf.notification.send, 71009549)
    WF_XML.Generate(oracle.apps.wf.notification.send, 71009549)
    WF_XML.Generate(oracle.apps.wf.notification.send, 71009549)
    Wf_Event.setMessage(oracle.apps.wf.notification.send, 71009549, WF_XML.Generate)
    Wf_Event.dispatch_internal()
    Cause : Above error is thrown for Journals with attachment of file type Microsoft Office Excel Macro-Enabled Worksheet (.xlsm)
    Can anybody help with this?

    Please post the details of the application release, database version and OS.
    Please see if these docs help.
    ORA-20001 & ORA-06502 Workflow Errors [ID 761638.1]
    Manager Approval Notification Gives Error: Ora-O6502: Pl/Sql: Numeric Or Value Error: Character String Buffer Too Small [ID 352213.1]
    Approval Confirmation Email Is Not Received By Preparer - ERROR_MESSAGE=3835 ORA-20001 ORA-6502 [ID 465146.1]
    Notification Fails To Be Generated When A DOCX Document Is Attached [ID 1058183.1]
    Not Able To Send Multiple E-Mails Upon Approval Of Purchase Order [ID 333719.1]
    Expenses Workflow Error: "ORA-06502: PL/SQL: numeric or value error: associative array shape is not consistent with session parameters has been detected in fnd_global.put(CONC_LOGIN_ID,-1)" [ID 455882.1]
    Using Microsoft Office 2007 and 2010 with Oracle E-Business Suite 11i and R12 [ID 1077728.1] -- Notification Generation Fails
    ORA-06502 Buffer Too Small Error in Contracts Workflow Notification [ID 870712.1]
    Thanks,
    Hussein

  • Is it ok to have a interactive notification with an action , which initiates a phone call

    Is it ok to have a interactive notification with an action , which initiates a phone call

    BPerlman wrote:
    1.  I can't choose fixed point representation when I have a dial or knob control.  the "FXP" option is disabled.
    2.  The help tells me to set the range and desired delta, but they seem to be read only!
    3.  Why do you suggest a range of 0..1 and multiply by 360, rather than a range of 0..360 in the first place?
    Interesting. I wasn't aware if this limitation. I guess it only works for simple controls. (Here's an idea!)
    You cannot set the range and delta, they are the results of the "word lenght" and "integer word lenght". These are tightly limited by the underlying binary representation.
    In this particular case, you could chose a word lenght of 12 bits and integer word lenght of zero bits, giving you an increment of exactly 1/4096 (The display is unfortunately rounded to four decimal digits and does not show the full resolution) (Here's another idea!)
    LabVIEW Champion . Do more with less code and in less time .

  • Send RAW notification with template

    Hi all,
    I'm building an app and I'm using Azure Notification Hub to send notification to several devices (Windows Phone/Android/iOS),
    I would like to use templates when I'm sending the notifications,
    I could find an example how to register the device for RAW notification :-(
    when I'm calls the method RegisterTemplateAsync, I get the following error "The payload is not in accepted XML format. The first node should be Badge/Tile/Toast. If want to send raw notification, please set header to wns/raw."
    Does anyone know how to solve that issue?
    Thanks

    Where do you put all of this? The error only says to set header to wns/raw. Can we just set the WindowsNotification() header like so:
    Notification notification = new WindowsNotification("test message from AZURE");
    notification.Headers.Add("X-WNS-Type", @"wns/raw");
    Also, I spent a long time looking for a simple solution to sending raw push notifications from Azure Mobile Services and thanks to this post I figured it out. Here's my example ScheduledTask showing how to send a raw push notification.
    public class SyncPhoneDatabaseJob : ScheduledJob
    public ApiServices Services { get; set; }
    protected override void Initialize(ScheduledJobDescriptor scheduledJobDescriptor, CancellationToken cancellationToken)
    base.Initialize(scheduledJobDescriptor, cancellationToken);
    public async override Task ExecuteAsync()
    try
    NotificationHubClient hubclient = Services.Push.HubClient;
    Notification notification = new WindowsNotification("Raw test message from Zumo.");
    notification.Headers.Add("X-WNS-Type", @"wns/raw");
    var outcome = await hubclient.SendNotificationAsync(notification);
    catch (Exception e)
    Services.Log.Error(e.ToString());
    protected override void Dispose(bool disposing)
    base.Dispose(disposing);
    if (disposing)
    // Run disposal code

  • Prevent notify-send from grabbing focus in xmonad

    I just started using xmonad, and I've got most of the wrinkles ironed out, but this one still bugs me. I use pidgin + libnotify, and whenever a notification pops up, it grabs focus, meaning I can't type anything for a minute (unless I move my mouse and close it). This is particularly annoying when I'm having a chat back-and-forth, and I get notifications from that window/another chat window.
    (I know I can turn off the notifications when the window is currently open, but it doesn't solve the larger problem of notifications grabbing focus when I'm typing in a separate screen).

    That was not a conscious choice; I just switched from xfce, so that makes sense.
    I uninstalled xfce4-notifyd, installed notification-daemon, and reinstalled pidgin-libnotify (for good measure). The notifications still work, so I'm assuming notification-daemon is working properly, but the focus still gets grabbed.
    Do you use pidgin as well, or just notification-daemon? I still get the same issue when I do notify-send, which makes me believe it's not pidgin's problem, but maybe not.
    This website seems to imply that it's an xmonad configuration issue, but I'm not that familiar with Haskell/xmonad's configurations. Is it possible to alter this behavior *only* for notify-send events, but not anything else that might display an urgent window?

  • How to make use of notify-send to get alerted when a chat-message arrives?

    I would like to get notified, if a chat-message arrives. I tried two add-ons, both will play a sound, but not show a notification-window, as promised, so I'd like to do it myself, using `notify-send`. I suppose, that'll take to listen to a fitting event and execute notify-send, can someone please give me a hint, how to do that? Docs are rare.
    Using Thunderbird 24.4.0 on Ubuntu 12.04
    TIA, ida

    Hi Matt and sfhowes,
    I have tried several-addons with no success and suspect a problem with my Ubuntu, as they don't show any problem-reports of other users.
    Writing a Thunderbird-add-on is a little bit challenging and not as well supported than writing a Firefox-Add-on. Also the used JS-func for alerting, when messages arrive, shows a lot of bug reports.
    So I decided to go for a shell-script-solution now, listening to a fitting child-process and sent notificia. I will post it , when it's finished.
    Thanks for your replies
    Ida

  • Customize the notify-send window

    Hello. I tried to customize notify-send's window by creating a ~/.notify-osd file with this code in it, as i read somewhere on the net. The problem is that it doesn't seem to work. Is there any other way to customize it ? Im using XFCE 4.
    slot-allocation = fixed
    bubble-expire-timeout = 10sec
    bubble-vertical-gap = 5px
    bubble-horizontal-gap = 5px
    bubble-corner-radius = 37,5%
    bubble-icon-size = 30px
    bubble-gauge-size = 6px
    bubble-width = 240px
    bubble-background-color = 131313
    bubble-background-opacity = 90%
    text-margin-size = 10px
    text-title-size = 100%
    text-title-weight = bold
    text-title-color = ffffff
    text-title-opacity = 100%
    text-body-size = 90%
    text-body-weight = normal
    text-body-color = eaeaea
    text-body-opacity = 100%
    text-shadow-opacity = 100%

    If you installed the xfce4 and xfce4-goodies package groups as recommended by the wiki and aren't sure what notification daemon you have, it's probably xfce4-notifyd.  For that,
    xfce4-notifyd-config
    will bring up the settings window for it, but it doesn't have all that many options.  As the xfce website puts it, "There aren't any other tunables; if you do not see it in the settings dialog, it's not changeable.", so if that isn't enough options for you, you may want to look at switching to notify-osd or something like dunst, depending on what kind of features and options you're looking for.

  • Running notify-send via cron

    I've written a script, that monitors battery state and shuts down netbook when power is low to prevent hot power off. I've tested the script before running it in cron - everything works as it must: notification pops up, system shuts down. But when I'm trying to run it from cron - everything ok expect notify-send command.
    Config scripts:
    # crontab -e
    # root crontab
    # DO NOT EDIT THIS FILE MANUALLY! USE crontab -e INSTEAD
    # man 1 crontab for acceptable formats:
    # <minute> <hour> <day> <month> <dow> <tags and command>
    # <@freq> <tags and command>
    DISPLAY=:0.0
    SHELL=/bin/bash
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    # SYSTEM DAILY/WEEKLY/... FOLDERS
    @hourly ID=sys-hourly /usr/sbin/run-cron /etc/cron.hourly
    @daily ID=sys-daily /usr/sbin/run-cron /etc/cron.daily
    @weekly ID=sys-weekly /usr/sbin/run-cron /etc/cron.weekly
    @monthly ID=sys-monthly /usr/sbin/run-cron /etc/cron.monthly
    * * * * * /etc/cron.hourly/powersave
    $ cat /etc/cron.hourly/powersave
    PasteBin
    $ cat /etc/X11/xorg.conf | head -n 6
    Section "ServerLayout"
    Identifier "X.org Configured"
    Screen 0 "Screen0" 0 0
    InputDevice "LG_Touchpad" "CorePointer"
    InputDevice "LG_Keyboard" "CoreKeyboard"
    EndSection
    $ echo $DISPLAY
    I thought that running one more external script will solve the problem, but it didn't work.
    Tried also this command in cron:
    * * * * * DISPLAY=:0.0 /etc/cron.hourly/powersave
    But also without result.
    Anyone found a solution to this problem?

    You may also need to have the DBUS_SESSION_BUS_ADDRESS environment variable set.  I have a script that does something like this:
    PIDS=$(pgrep urxvtd)
    for p in $PIDS; do
    dbus=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$p/environ | sed 's/DBUS_SESSION_BUS_ADDRESS=//')
    user=$(grep -z USER /proc/$p/environ | sed 's/USER=//')
    dply=$(grep -z DISPLAY /proc/$p/environ | sed 's/DISPLAY=//')
    sudo -u $user sh -c "DBUS_SESSION_BUS_ADDRESS=\"$dbus\" DISPLAY=\"$dply\" /usr/bin/notify-send -i \"$ICON\" \"$TITLE\" \"$BODY\""
    done
    I chose urxvtd, b/c it's guaranteed to be running... but you can choose another progam.
    Last edited by pnutzh4x0r (2011-07-02 02:32:16)

  • Notify-send in StumpWM?

    Does anyone know how to configure StumpWM to work with the notify-send command from the notification-daemon package?
    Any help will be greatly appreciated.

    dice wrote:Please post the actual content of your resume script and not the script which generates your resume script.
    EDIT: And check if you are escaping correctly. Why don't you use a text editor to produce your script?
    Did you make it executable?
    Im making it as practice. Script is not issue, implementing it into service is.
    Yes its executable and works when excecuting from terminal
    Last edited by kiryo (2015-04-25 10:21:50)

  • Integrate KDE notifications with Openbox?

    Hi,
    I'm using openbox with whole set of KDE programs (I prefer it this way over KDE with OB as WM).
    Is there any way of integrating KDE notifications with OB to make it look neat?
    Cheers
    vi3dr0

    What do you mean "integrating KDE notifications with OB" ?
    If it's related to launching KDE applications from OB menu, you can have entries like that :
    <menu id="apps-editors-menu" label="Editors">
      <item label="Kwrite">
        <action name="Execute">
          <command>kwrite</command>
          <startupnotify>
            <enabled>yes</enabled>
          </startupnotify>
        </action>
      </item>
    </menu>
    in your ~/.config/openbox/menu.xml
    If it's something else, explain and give an example of what you want.

  • Problem with file sender adapter and endSeparator

    Hy,
    have the following situation: with a sender File adpater i have to receive the same structure of data but in two mode.
    1) First mode : each recorset is defined as a file line
       Example (not fields separator):
       fielda,fieldb,fieldc
       field2a,field2b,field2c
    2) Second mode : recorset of the same line without end
        separator and fieldseparator
       Example (not fields separator):
       fielda,fieldb,fieldc,field2a,field2b,field2c,......
    I configured the adapter as follow.
    structure.fieldFixedLengths      1,2,3
    structure.fieldNames             field1,field2,field3
    structure.lastFieldsOptional     YES
    structure.processFieldNames      fromConfiguration
    structure.endSeparator           'nl'
    PROBLEM
    Mode 1) works but mode 2) doesn't work.
    Could anyone solve my problem??
    Thank's
    Mati

    Hi,
    Try using two differnt record structure name for each mode.for eg give it as structure1 and structure2.then u give the content conversion parameter for both the recordset depending on ur requirement i.e, with and without end seperator.
    regards
    jithesh

Maybe you are looking for