Display interactive notifications (with buttons) via Terminal

I'd like to let my bash shell scripts to display gui notifications with two buttons that the user can click and then execute some commands depending on the button pressed.

What options exist?


Solution 1:

I'm a big fan of Tkinter since it has far more tutorials that help a new person solve real problems and python/tk ship with all Macs and the versions have been stable for years of OS X releases.

To get started, run this command:

python -c "import Tkinter;Tkinter._test()"

If the free tutorials linked above aren't working for your needs, the professional ones on lynda and python classes like https://www.coursera.org/learn/python are fairly easy to get started with limited time or limited funds.

You could also start from the GUI with Platypus and have it call your desired bash scripts for each button that's pressed. You could then open the "app" with open -a to get things started.

Solution 2:

I use a small command line "alerter" to display Alerts notifications from terminal.

i code this tool, feel free to contribute : https://github.com/vjeantet/alerter

enter image description here