r-rudra / tidycells

Automatic transformation of untidy spreadsheet-like data into tidy form
https://r-rudra.github.io/tidycells/
Other
83 stars 10 forks source link

Detect screen resolution for better widget preview #15

Open bedantaguru opened 4 years ago

bedantaguru commented 4 years ago

This is for https://github.com/r-rudra/tidycells/blob/3ddcdf6e9f664ffc46f432c57f0eeb4cc9bb13a3/R/shiny_main.R#L22

This may be implemented later if required.

Thanks to this SO

Following code works well :

library(rJava)
.jinit()
toolkit <- J("java.awt.Toolkit")
default_toolkit <- .jrcall(toolkit, "getDefaultToolkit")
dim <- .jrcall(default_toolkit, "getScreenSize")
height <- .jcall(dim, "D", "getHeight")
width <- .jcall(dim, "D", "getWidth")