Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Reload or restart RStudio #259

Open
jmgirard opened this issue Jul 17, 2022 · 2 comments
Open

Feature Request: Reload or restart RStudio #259

jmgirard opened this issue Jul 17, 2022 · 2 comments

Comments

@jmgirard
Copy link

I am creating an addin that allows users to save and load RStudio preferences (inspired by rstudio/rstudio#4276). Although I can use applyTheme() to update the theme, I am struggling to get RStudio to update its font (to match changes to desktop.ini) without restarting. I can ask the user to restart RStudio manually, but I think it would be ideal if I could initiate a refresh from {rstudioapi} like occurs when exiting the Global Options menu.

@jennybc
Copy link
Member

jennybc commented Aug 14, 2022

IIUC this is already possible. We do it in usethis like so:

https://github.com/r-lib/usethis/blob/7c8e0049a1e40e6dcabbde069bb29576215a11b6/R/rstudio.R#L141-L163

@jmgirard
Copy link
Author

jmgirard commented Aug 15, 2022

@jennybc Thanks for the pointer. IIUC, the approach you linked (essentially calling rstudioapi::openProject()) will work but only if the user has a project open. I get why this is a fine assumption for {usethis}, because if you're working on a package then you have a project open. But for my use case, it would be better to be able to restart RStudio even with no projects open. I considered initializing a new project, restarting, and then closing the current project, but there doesn't appear to be a way to close the current project in {rstudioapi}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants