leftwm / leftwm-theme

A tool to help manage themes for LeftWM
BSD 3-Clause "New" or "Revised" License
117 stars 12 forks source link

Add Theme.apply_changes() for any theme changes #34

Closed darkowlzz closed 2 years ago

darkowlzz commented 2 years ago

NOTE: This is based on the ideas discussed in #9 to implement a migration path to fix issues in the theme definitions of existing themes. It implements:

Write a function that can be called that will move old directory (probably accept either Path or PathBuf) to a new one that matches the name (see install for how that's done). -- @mautamu https://github.com/leftwm/leftwm-theme/issues/9#issuecomment-817098792

23 added name validation for new themes. This change is for migrating

the existing themes. This change doesn't add the changes repo field as discussed in #9 but prepares for the structure to implement it.

This introduces a public method apply_changes() on the Theme type to apply various changes to an existing theme. The theme changes field will be added later in the Theme struct. This is a preparation for the theme changes feature.

The first type of change implemented here is the directory rename change as Theme::apply_change_rename_dir(). It takes an old theme name and a new theme name and renames the theme directory if found. This is called by Theme.apply_changes() when the theme name is not the same after applying the rename change.

Theme.get_name() returns the effectual name of the theme after applying any rename change. The implementation will change once the changes fields are added in Theme struct.

mautamu commented 2 years ago

Nice work! Glad to see that we're slowly getting to the 0.2.0 release :).

I have a POC for the remainder, but large pieces are dysfunctional. Might push to my tree in a bit.

Thanks for tackling this!!