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::desktime()"

Usage

desktime(
  work_time = 52,
  break_time = 17,
  start_color = "green",
  end_color = "red",
  sound = "ping",
  units = "minutes"
)

Source

The 52/17 Rule by Julia Gifford.

Arguments

work_time

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

break_time

[numeric(1)]
The length of time for each break. Defaults to 17 minutes.

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 DeskTime.