diff --git a/R/beepr.R b/R/beepr.R index cf03be8..b0df662 100644 --- a/R/beepr.R +++ b/R/beepr.R @@ -182,4 +182,16 @@ play_file <- function(fname) { } else { play_audio(fname) } +} + +beeprAddin <- function() { + if (requireNamespace("rstudioapi", quietly = TRUE)) { + rstudioapi::sendToConsole("beepr::beep()", focus=FALSE) + } else { + stop( + "Package \"rstudioapi\" must be installed to use the beepr addin.", + call. = FALSE + ) + } + } \ No newline at end of file diff --git a/inst/rstudio/addins.dcf b/inst/rstudio/addins.dcf new file mode 100644 index 0000000..c0003cd --- /dev/null +++ b/inst/rstudio/addins.dcf @@ -0,0 +1,4 @@ +Name: Play beep +Description: Run the function `beepr::beep()` in the command line. +Binding: beeprAddin +Interactive: false \ No newline at end of file