Set specific window size for RStudio shiny app on all screen types

Viewed 232

I'm trying to set a specific window size for a shiny app. The app will only be run in RStudio, and not in a browser.

This post suggests to use a runGadget call, in place of shinyApp(ui, server) at the end of app.R - for example:

runGadget(ui, server, viewer = dialogViewer("Window Title",
                                            width = 1200, height = 700))

But, I get different results depending on whether the screen is internal (i.e. laptop) or external (i.e. a separate monitor).

For example, on a 1280 x 800 non-retina MacBook screen, the above settings only give 1083 x 558, despite there apparently being enough space for a 1200 x 700 window.

And, on a 2560 x 1600 retina MacBook screen, the window size is 2166 x 1098 – a similar proportion of the screen as for the non-retina MacBook.

However, on an external 1680 x 1050 monitor, I get exactly 1200 x 700, as specified.

Is there a way to force an exact window size across all situations? I would also prefer the window style output by shinyApp(ui, server), rather than an RStudio dialog if possible.

0 Answers
Related