Red Hat Bugzilla – Bug 689903
Feature Request: Make Newt's system-wide palette configurable at run time
Last modified: 2011-06-27 08:59:43 EDT
Created attachment 486874 [details]
Make newt's system-wide palette configurable at run time
We are carrying a small patch in Ubuntu that makes Newt's default color palette configurable, by optionally placing a configuration file at /etc/newt/palette.
If no file exists at that path, then newt's operation proceeds as normal.
If, on the other hand, a file does exist at that admin-owned location, a list of color values is read from that file and overloaded into the newtColors struct and set with newtSetColors().
I've tested it pretty well and seems to work quite nicely here.
For testing purposes, you can use these two sets of contents for your /etc/newt/palette values. The contents of the file is expected to contain newt's color keywords, all on a single line, comma-separate, no whitespace, and a total of 44 values. For example:
Please consider committing this patch against your upstream newt branch. Thanks.
Dustin Kirkland <email@example.com>
Instead of requiring all 44 colors on one line I think it would be better to specify color of each item separately. For items which are not specified in the config the default would be used.
Few more things:
- the default path should be configurable in the configure script, /etc/newt/colors by default?
- perhaps it would be useful to be able to override the colors also via getenv("NEWT_COLORS"), e.g. NEWT_COLORS=root=white,black:border=,yellow
I can look into it if you want.
Awesome! Thanks for the response. I was worried this bug/patch might have gotten dumped into the bit bucket.
Regarding the format of the file, I just went for the simplest approach, from the perspective of reading the values in the C code. I didn't expect this to be something that people changed often, frequently, or on their own. I expected more that a distro or a packager would do this, and probably only ever do it once or twice, so I didn't really think about it in terms of a user-friendly interface, but instead, just as a "functional" one.
Regarding the default path, yes, of course, that could (and should?) very well be configurable. /etc/newt/colors seemed to me like a simple, straightforward, obvious default.
Regarding a "NEWT_COLORS" environment variable, that's an excellent idea, such that the color scheme could even be modified on an application-by-application, or process-by-process basis (rather than system wide).
I'm concerned a little bit by the complexity of the code necessary to process the descriptive configuration file and/or environment variable. At this point, I would prefer for you to point me to a git branch with your implementation of these, and I'll gladly build/test that, and port over Ubuntu's use of this functionality to your new implementation.
Ok, I've pushed a patch implementing that to git (git://git.fedorahosted.org/git/newt), please let me know how it works for you.
Awesome, thanks! I'll get this tested...
It is in newt-0.52.13.