rstudio: init
created a module for rStudio. File is really because because all 256 terminal colours need to be maually assigned. If anyone can think of better way to do this please fix it :)
Since our colorscheme currently only provides 16 colors, the 256 colors need to converge to them. Depending on the intended behaviour, the mapping from 256 to 16 can be partially generated.
Btw, the formatting CI is failing.
I don't think thats what should be done, RStudio makes you manually define each colour for the in-built terminal, so these were squashed from 256 into 16 colour you would lose 256 colour support for RStudio. I can do this if you think its right for the project however.
I was going to write a whole long winded explantion of how if i wrote this module without hacky work arounds and permission changing it wouldn't work, in the process i changed my module to be more in line with the stylix ideals and now it works mostly fine.
Without the 256 colour support, the internal terminal doesnt work looking something like this
Does this mean this part can be removed? If we also enable the module by default, we could entirely remove this README.md file.
I think we should enable it by default if either the rStudio package or rStudioWrapper is installed, but im not sure how to do that so any pointers would be nice. Happy to change that
Does this mean this part can be removed? If we also enable the module by default, we could entirely remove this README.md file.
I think we should enable it by default if either the rStudio package or rStudioWrapper is installed, but im not sure how to do that so any pointers would be nice. Happy to change that
Usually, unless we are dealing with external applications we just enable modules by default, except if there are known problems in certain environments. For reference, here is how the NixVim module is only enabled if it has been detected:
https://github.com/danth/stylix/blob/d9df91c55643a8b5229a3ae3a496a30f14965457/modules/nixvim/nixvim.nix#L136-L140
Does this mean this part can be removed? If we also enable the module by default, we could entirely remove this README.md file.
I think we should enable it by default if either the rStudio package or rStudioWrapper is installed, but im not sure how to do that so any pointers would be nice. Happy to change that
Usually, unless we are dealing with external applications we just enable modules by default, except if there are known problems in certain environments. For reference, here is how the NixVim module is only enabled if it has been detected:
https://github.com/danth/stylix/blob/d9df91c55643a8b5229a3ae3a496a30f14965457/modules/nixvim/nixvim.nix#L136-L140
All changes sugested have been pushed. The module is now enabled by default.
you should add a testbed
I added this. For some reason the application doesn't autostart or show in the menu, but it can be launched from the console.
@trueNAHO please can you check whether the conversations from your previous review should be resolved :))
@trueNAHO please can you check whether the conversations from your previous review should be resolved :))
@Mrbroggle, the dark and light themes look the same when starting the application in the testbeds:
Is it possible for the application to be themed dark depending on the theme? Maybe based on the polarity?
I ran the testbeds and selected theme in rstudio and it themes correctly
nix run .#testbed:rstudio:default:dark:image:scheme:cursor
nix run .#testbed:rstudio:default:light:image:scheme:cursorless
Did you apply the theme in settings under Tools > Global Options > Appearence > Editor Theme ?
There is a file under ~/.confg/rstudio/rstudio-prefs.json that stores the editor theme but that would require changing only one line in the file and im not sure how one might do that because that file stores all the other settings for RStudio and needs RW perms which i think is out the scope of stylix?
example of my rstudio-prefs.json:
{
"initial_working_directory": "~/Projects/uni/R",
"pdf_previewer": "none",
"posix_terminal_shell": "custom",
"terminal_bell_style": "none",
"highlight_r_function_calls": true,
"editor_theme": "stylixBase16",
"custom_shell_command": "/run/current-system/sw/bin/fish",
"default_open_project_location": "~/Projects/uni/R",
"relative_line_numbers": true,
"show_diagnostics_other": true,
"editor_keybindings": "vim",
"text_rendering": "geometricPrecision",
"show_rmd_render_command": true,
"rmd_viewer_type": "pane",
"disable_renderer_accessibility": true,
"graphics_backend": "cairo",
"soft_wrap_r_files": true
}
Is it possible for the application to be themed dark depending on the theme? Maybe based on the polarity?
[...]
Did you apply the theme in settings under
Tools > Global Options > Appearence > Editor Theme? There is a file under ~/.confg/rstudio/rstudio-prefs.json that stores the editor theme but that would require changing only one line in the file and im not sure how one might do that because that file stores all the other settings for RStudio and needs RW perms which i think is out the scope of stylix?
@danth, should we use a home.activation script?
@danth, should we use a
home.activationscript?
we could use jq in home.activation script something like
mv rstudio-prefs.json temp.json
jq -r '.editor_theme|= "stylixBase16"' temp.json > rstudio-prefs.json
rm temp.json
Yes, that seems reasonable. We could use sponge to avoid creating a temporary file.
We'd also have to handle the case where the file hasn't been initialised yet.
A simple jq with checking if the file already exists might be simpler.
all seems to be working now and auto setting the theme. It is installing jq and spone however. Which I though in the way implementend should be temporary just for this script? Anyway, let me know if any other changes need to be made.
@Mrbroggle, can you approve commit c680a63 ("rstudio: polish Bash code") and 545f5e3 ("rstudio: add required meta.name attribute")?
changes should be applied.
Can confirm, this is now working.
However, some of the text is difficult to read with a light theme:
I couldn't find which part of the template is causing this.
I couldn't find which part of the template is causing this. I did a test, this issue is here in the mustache file:
/* rs-theme-is-dark: TRUE */
Im not sure how to do this programatically but we'd need to change this with the polarity.
I fixed it in a pretty scuffed way, i wasnt too sure how else to do it other than concat the header with the template but its working.
Im not sure how to do this programatically but we'd need to change this with the polarity.
All of the colors should be coming directly from the theme; the polarity option is only to control the automatically generated default theme and may not be correct otherwise. Its default is either.
If the RStudio theme absolutely must specify whether it is light or dark, this should be done by testing the actual colors in the theme rather than using the polarity value.
If the RStudio theme absolutely must specify whether it is light or dark, this should be done by testing the actual colors in the theme rather than using the
polarityvalue.
To fix the difficulty to read part here
However, some of the text is difficult to read with a light theme:
we must set the /* rs-theme-is-dark: */ to either true or false so it must be set.
Ive used the rgb values from base00 and calculated luminosity to set the theme-is-dark. I think this should be good.
Not sure why this CI/CD is failing, something to do with a failed build of jypter and gyp not being installed, testbed runs on my local machine though.
