notify: Create a desktop notification

View source: R/notify.R

notifyR Documentation

Create a desktop notification

Description

How exactly the notification appears is platform dependent:

  • On macOS, we use the terminal-notifier tool, see https://github.com/julienXX/terminal-notifier

  • On Linux and *BSD systems, including Solaris the notify-send command line tool is used. This requires the libnotify-bin package on Ubuntu/Debian and similar systems, or the libnotify package on RedHat/CentOS/Fedora and similar systems.

  • On Windows 8 or newer Windows versions we use the toaster tool, see https://github.com/nels-o/toaster.

  • On older Windows versions we use the notifu program, see https://www.paralint.com/projects/notifu.

Usage

notify(msg, title = "R notification", image = NULL)

Arguments

msg

Message to show. It may contain newline characters.

title

Message title. Typically shown on the top, with larger font.

image

Image to show in the notification. By default the official R logo is shown on macOS, and an alternative logo is shown on other OSes, because of licensing reasons. You can specify a PNG file here, to show instead of the R logo. This currently does not work on older Windows versions (before Windows 8), which does not allow PNG files, only ICO icons.

Details

All notification systems support showing a title and an image, as part of the notification.

Examples

## Not run: 
notify("Hello world!")
notify("Hello world!", title = "Introduction")
notify("Hello world!", title = "Introduction", image = "mylogo.png")

## End(Not run)

gaborcsardi/notifier documentation built on Feb. 10, 2024, 4:44 p.m.