Skip to contents

Makes the shortcuts that start tflplanner in the browser with a double click, without R or RStudio open:

Usage

add_shortcut(
  port = NULL,
  desktop = TRUE,
  start_menu = TRUE,
  update = FALSE,
  ask = interactive()
)

remove_shortcut(launcher = TRUE, ask = interactive())

Arguments

port

The port the app runs on. NULL keeps the setting (setup_tflplanner(port = ), default 7470); a number is saved as the setting.

desktop

Make the desktop shortcut (Windows).

start_menu

Make the Start menu entries (Windows).

update

Also make "update and launch" (FALSE by default: tflplanner is never updated unless you ask – with this shortcut, made when update = TRUE, or update_tflplanner()).

ask

Ask before making them. FALSE makes them without asking (scripts); outside an interactive session nothing is made unless ask = FALSE.

launcher

Also remove the launcher files tflplanner keeps.

Value

The shortcuts made, invisibly.

Details

  • Windows: "tflplanner" on the desktop and in the Start menu, and "tflplanner (update and launch)" in the Start menu. To pin tflplanner to the taskbar, right-click it in the Start menu and choose Pin to taskbar (Windows does not let a program do it).

  • macOS: tflplanner.app and tflplanner (update).app in ~/Applications.

  • Linux: a tflplanner.desktop menu entry in ~/.local/share/applications, with an Update and launch action.

A shortcut runs a small launcher that tflplanner keeps in tools::R_user_dir("tflplanner", "config"). The launcher finds R each time it starts (on Windows from the registry entry the R installer writes), so updating R does not break the shortcut, and it shows no console window. It starts the app, and closing the browser stops it. When the port is taken:

  • by this version of tflplanner, it opens that one;

  • by another version, or a tflplanner that does not answer, it asks whether to stop that one and start again (an official run goes on by itself: run_batch());

  • by another program, it starts on the next free port.

Each start is noted in the launcher's launcher.log.

"Update and launch" first updates rtfreporter, tflspec and tflplanner (update_tflplanner(), on the channel last used), then starts the app; while an official run goes on it does not update (the run has loaded the packages) and starts the app as it is.

On Windows the shortcuts are written by a VBScript, and one it could not write again by PowerShell: security software may stop a script from writing to the desktop without a message. If neither can, the error says how to allow it or to make the shortcut by hand.

See also

remove_shortcut(), launch_app(), setup_tflplanner().

Examples

if (FALSE) { # \dontrun{
# not run: writes a shortcut on your desktop and in the start menu
add_shortcut()
add_shortcut(port = 7480)
} # }