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

No change of theme despite successful activation (macOS) #18

Closed
domiden opened this issue Aug 11, 2020 · 7 comments
Closed

No change of theme despite successful activation (macOS) #18

domiden opened this issue Aug 11, 2020 · 7 comments

Comments

@domiden
Copy link

domiden commented Aug 11, 2020

First at all, many thanks for your hard work! Great extension!

I'm running in the issue, that the dark them isn't activate after the installation and activation. I tried reinstallation and different versions of RStudio as well as different dark editor themes (included kiss and chaos).

Before, it actually worked quite fine. Unfortunately, I just recognise today the change. So, I'm not 100% sure what might be the reason. Today I install the update to macOS 10.15.6 and RStudio 1.3.1073 (installed in: ~/Applications). Perhaps anything in RStudio internals changed causing the issue?

If you any further information, just let me know.

@rileytwo
Copy link
Owner

Do you have two RStudios installed, by chance? I'm curious as to why activate() is returning TRUE but isn't actually doing anything.

Can you type this into RStudio's console and check for a darkstudio folder? You'll need fs installed, if you don't already.

system2("/usr/bin/open", args = fs::path_join(c(rstudioapi::dictionariesPath(), "../../www")))

@domiden
Copy link
Author

domiden commented Aug 20, 2020

Yes, I have two version installed. But it haven't been a problem before. About the darstudio folder, there is none in there. Interestingly, the path point to the correct application folder. Unfortunately, I cannot reconstruct what might change to the situation before the issue appeared.

@rileytwo
Copy link
Owner

So there isn't a darkstudio folder in either application? Can you run darkstudio::deactivate() and then remove.packages('darkstudio') for good measure?

Another area that may be causing trouble is the index.htm file. darkstudio works by injecting a <link/> handle to darkstudio/darkstudio.css, which loads the styles. I'm wondering if index.htm was modified incorrectly and wasn't restored properly.

@domiden
Copy link
Author

domiden commented Aug 20, 2020

I just checked the other RStudio version in /Applications, and it work there, however, if I uninstall it, there and install it with the version in ~/Applications it still modified and activate it for the version in /Applications.

Location ~/Applications:

<html lang="en">
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <meta name="gwt:property" content="compiler.stackMode=#compiler_stack_mode#"/>
    #!viewport_tag#
    <meta name="csrf-token" content="#csrf_token#" />
    <link rel="shortcut icon" href="images/favicon.ico" />
    <title>RStudio</title>
    #!head_tags#
    <link type="text/css" rel="stylesheet" href="css/icons.css" />
    <link type="text/css" rel="stylesheet" href="css/focus-visible.css" />
    <script type="text/javascript" language="javascript" src="js/text.min.js"></script>
    <script type="text/javascript" language="javascript" src="js/inert-polyfill.min.js"></script>
    <script type="text/javascript" language="javascript" src="js/focus-visible.min.js"></script>
    <script type="text/javascript" language="javascript" src="#!gwt_prefix#rstudio/rstudio.nocache.js"></script>
  </head>

  <body>
  </body>

</html>

Location /Applications:

<html lang="en">
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <meta name="gwt:property" content="compiler.stackMode=#compiler_stack_mode#"/>
    #!viewport_tag#
    <meta name="csrf-token" content="#csrf_token#" />
    <link rel="shortcut icon" href="images/favicon.ico" />
    <title>RStudio</title>
    #!head_tags#
    <link type="text/css" rel="stylesheet" href="css/icons.css" />
    <link type="text/css" rel="stylesheet" href="css/focus-visible.css" />
    <script type="text/javascript" language="javascript" src="js/text.min.js"></script>
    <script type="text/javascript" language="javascript" src="js/inert-polyfill.min.js"></script>
    <script type="text/javascript" language="javascript" src="js/focus-visible.min.js"></script>
    <script type="text/javascript" language="javascript" src="#!gwt_prefix#rstudio/rstudio.nocache.js"></script>
  </head>

  <body>
  </body>

<link rel="stylesheet" href="darkstudio/darkstudio.css" type="text/css"/>
</html>

So it seems the installation process don't differ between the app locations, and assumed /Applications folder only? Of course I could install the necessary files manually, but it would be nice if the package would do it for me.

@rileytwo
Copy link
Owner

So, it does look for both paths, but will only modify the RStudio.app in /Applications if both are present. I plan on changing the behavior, but haven't found a solution that's reliable.

In a perfect world, I'd be able to detect (using R, only) which RStudio is running when darkstudio::activate() is executed. I haven't found a way to do this yet, unfortunately. The only solutions I've found are workarounds at best, most of which are similar to the rstudioapi::dictionariesPath() function I asked you to run above.

All that being said, you can still "override" the RStudio being changed by providing a path argument in activate(). If you want to activate ~/Applications/RStudio.app, do the following:

darkstudio::activate(path = "~/Applications/RStudio.app/Contents/Resources/www/index.htm")

path lets you control where darkstudio is activated. Can you try running the above, and let me know if that works for you? Sorry for the trouble so far.

@domiden
Copy link
Author

domiden commented Aug 21, 2020

Thanks, that works! It is actually a very nice workaround I haven't considered. Perhaps you may add an option (local = TRUE) looking for a local version of RStudio assuming it at ~/Applications in most cases (at least for macOS), I guess. Alternative you may reduce the path option to just the app location, path = "~/Applications", so it would internally complete the path with "/RStudio.app/Contents/Resources/www/index.htm". Again, many thanks for this awesome extension!

@domiden domiden closed this as completed Aug 21, 2020
@rileytwo
Copy link
Owner

I 100% agree. I wanted an option that worked the same way for both macOS and Windows. macOS is much simpler, as you noted above, since most of the time, user-only installations take place in ~/Applications. I don't know of the user-only equivalent in Windows that's consistent (ie ~/AppData/Local, ~/AppData/LocalLow or ~/AppData/Roaming).

Thanks for being patient!

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