i have a sh script. i want libnotify to call that script instead of dunst or anything

thanks

  • rxxrc
    link
    fedilink
    English
    arrow-up
    8
    ·
    edit-2
    1 month ago

    Libnotify backends are D-Bus services, which isn’t really something you’d want to implement in a shell script. Going by some source code I just found, it looks pretty straightforward to do in Python, so that’s one option.

    The easier option would be to use an existing notification daemon that lets you disable the default GUI and specify a script to run as a hook, but I don’t actually know of any like that.

  • Magitian@fedia.social
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    @t0mri you would require a notification daemon - what do you mean by “calling libnotify”? You can use notify-send, which under-the-hood sends a notification, displayed by the daemon

  • jacky@sopuli.xyz
    link
    fedilink
    arrow-up
    0
    ·
    26 days ago

    tiramisu sends notification to stdout, so you can write a wrapper around it to call any program or script you want.

    e.g. (using herbe to display notifications):

    #!/bin/bash
    buf=''
    /usr/bin/tiramisu -j | while read -r line; do
            buf="${buf}${line}"
            jq -e <<< "${buf}"
            if [[ $? -ne 4 ]]; then
                    /usr/bin/herbe "$(/usr/bin/jq -cMr '.summary' <<< "$buf")" "$(/usr/bin/jq -cMr '.body' <<< "$buf")"
                    buf=''
            else
                    buf="${buf}\\n"
            fi
    done