Skip to content

Instantly share code, notes, and snippets.

@eliocamp
Created May 18, 2018 18:28
Show Gist options
  • Save eliocamp/9f625fe133e5d714a9c00d5a7255d9ec to your computer and use it in GitHub Desktop.
Save eliocamp/9f625fe133e5d714a9c00d5a7255d9ec to your computer and use it in GitHub Desktop.
Notifications from R (only for linux)
notify <- function(title = "title", text = NULL, time = 2) {
time <- time*1000
system(paste0("notify-send ", title, " ", text, "-t ", time, " -a rstudio"))
}
notify_after <- function(expression, ...) {
expression <- eval(expression)
notify(title = "Run\\ ended", ...)
return(expression)
}
notify_after(Sys.sleep(4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment