Skip to contents

Creates an interactive timer in your R session. I recommend you don't call this function in your current R session, as it will block the console. You may consider running it from the command line in a new terminal window with

R -e "breaktime::breaktime()"

Usage

breaktime(
  work_time = 25,
  short_break_multiplier = 1/5,
  long_break_frequency = 4,
  start_color = "green",
  end_color = "red",
  sound = "ping",
  units = "minutes"
)

Arguments

work_time

[numeric(1)]
The length of time for each working session. Defaults to 25 minutes.

short_break_multiplier

[numeric(1)]
The length of each short break compared to the preceding working session. Defaults to one fifth (for example, a 25 minute working session will be followed by a 5 minute short break).

long_break_frequency

[numeric(1)]
The number of working sessions between each long break. Defaults to 4.

start_color, end_color

[character(1)]
Colors used to display the time. The time is displayed in start_color when there is time remaining, and in end_color when the timer has expired. Passed to cli::make_ansi_style(). Defaults to "green" and "red", respectively.

sound

[numeric(1)] or [character(1)] The sound played by beepr::beep() when a timer ends. See beepr::beep() for possible values.

If NULL, sound is disabled.

If a timer has expired and hasn't been ended, the sound will play again each time one-fifth of the target time passes (for example, if a session lasts 25 minutes, a reminder sound will play every 5 minutes after the session ends).

units

[character(1)]
Units used when interpreting numeric time period arguments. Defaults to "minutes". Accepted units are "seconds", "minutes", "hours", "days", "weeks", "fortnights", "months", "years", "decades", "centuries", or "millennia" (or abbreviations thereof).

Value

Invisibly returns an R6 object of class BreakTime.