Score:1

How do i send notifications with buttons from bash script?

ch flag

I want a script to send a notification that asks something and i want the notification to have a button. notify-send doesn't seem to support this or i can't see the function. I'm using Plasma.

lnee avatar
td flag
theres dunstify
lnee avatar
td flag
@lnee thank you for writing that commit
Score:0
in flag

It looks like dunstify, part of the dunst notification daemon, may do what you want:

dunstify -A yes.ACCEPT -A no,DECLINE "A message"

Dunst is available on Ubuntu, but apparently doesn't integrate very well with Plasma on KDE or Unity. You should still be able to use it though if it integrates well enough for your needs and you manage to install it.

I came acrosss dunstify on the Arch Wiki when searching for an answer to a similar problem but haven't managed to get it working. You might have more luck.

Score:0
gb flag

In my system(ubuntu 20.04 gnome shell 3.36.9) following works.

#/usr/bin/env bash
gdialog --msgbox 'Hi'

gdialog is wrapper of zenity in gnome shell environment. For detailed use, run zenity --help

zenity --info --text='Hi' equals above gdialog command

Please refer https://help.gnome.org/users/zenity/3.32/

Caleb McKay avatar
ca flag
OP is using Plasma, not Gnome, so kdialog would be more appropriate.
Azarilh avatar
ch flag
Ye, I specified Plasma. Also i need a "notification" not a dialog.
gb flag
@Azarilh notify-send do notification and Caleb McKay 's solution will give dialog with button I can't imagine what you want. Do you have any feagure what you want?
Score:0
ca flag

Something like in a bash file?...

#! /bin/sh
kdialog --msgbox 'Test Message' Details

Take a look at https://develop.kde.org/deploy/kdialog/ for more options and examples.

Azarilh avatar
ch flag
I want a classic notification, not a dialog popup, it gets on the way.
Caleb McKay avatar
ca flag
Can you give an example of what you mean by "classic notification?" That is a bit vague. You can send notifications using --passivepopup that will show up like standard Plasma notifications. But you aren't going to be able to have buttons on them. That link above gives you numerous examples of what can be done with Plasma's notification system.
Azarilh avatar
ch flag
Ye, the standard Plasma notification is what i want. So i'm asking too much?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.