-
-
Notifications
You must be signed in to change notification settings - Fork 18
Implement Theme Packs #79
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
base: main
Are you sure you want to change the base?
Conversation
I have some cosmetic changes I've made and forgot to push up that I'll get in the branch tomorrow. Basically labels that I forgot to change. I also have to make the page scrollable so the things aren't squashed in a shorter window resize. I also want to fix up the README to reflect the updated labels, remove anything I thought I'd need but didn't, and move the files being saved to the right directory instead of my debug directory. Other than those things, the functionality is there and can be tested. |
I have finished the implementation for theme packs. However, I did find a bug that I will file in the issues where Color Schemes are not being saved as system themes that the actual COSMIC config files do not match what is happening in Tweaks. The theme packs are grabbing the system panel layout as well as the system color scheme and saving them. When they are reapplied they're applying them as if they were the actual config files. This means I didn't find a way to have the color scheme get applied in the theme pack from a Tweaks applied color scheme and it saves what COSMIC has applied, not Tweaks. The two test theme packs are available in the attached .zip file. The directory they should be placed in is |
Thanks for working on this, I'll review it as soon as I can. |
You're welcome. Also, just want to make sure it doesn't stall. Is there anything you need me to do for this? |
I'll review the code tonight and get back to you on that. |
As far as the color scheme goes it is the same data, the theme pack idea is also combining the panel layout and settings. Packaging them all in one file and unpacking them out of that one file. |
Gotcha, what I would suggest in order to avoid code repetition is that you leverage the functionality already implemented by the other pages and use that to create a theme pack file that simply points to existing files instead of saving that data again. A more resilient approach would be to copy the config files from other pages and save them into a theme pack folder, and simply point to that data, this would avoid the issue of having corrupt theme packs if the data from other pages ever goes missing. |
That's kind of what it does already, just into its own file instead of a directory. It doesn't rely on any other files. It combines the currently set color scheme and layout into a single file. You can see in the screenshot of the Gotham theme pack file the highlighted part is the layout. The cool thing about this method is that a Custom Layout, as long as it's currently set, can be captured within the theme pack file, and it doesn't have to be one of the default Tweaks layouts. In fact, that's what you're seeing in the Gotham theme pack file screenshot. It includes my custom apps as well. |
Theme Packs
The idea of a theme pack is that it bundles the color scheme and layout together in one package to be applied together into one coherent theme.
Implementation
Theme Pack Page
Consists of a form for creating a new theme pack at the top of the page. Underneath the
Create New Theme
section is theAvailable Themes
section where the user can import a theme pack or apply a theme pack that has been either created or imported.Created and imported theme packs can also be deleted/removed from the page.
Export Theme
After the user gives the theme a name, author, and description they click the export theme button. From here it exports the theme into the theme_packs directory of the application and becomes available in the
Available Themes
section.Import Theme Pack
This button opens a native file dialog and allows the user to navigate to and select the theme pack file. COSMIC theme pack files are basically .ron with a
.ctp
extension to clearly define they are COSMIC theme pack files.