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

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

Merged
merged 2 commits into from
Sep 20, 2021

Conversation

darkowlzz
Copy link
Contributor

@darkowlzz darkowlzz commented Sep 19, 2021

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 #9 (comment)

#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.

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.
This fixes test failure due to indeterministic directory traversal
results by sorting the results.
@mautamu
Copy link
Member

mautamu commented Sep 20, 2021

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!!

@mautamu mautamu merged commit 30f5f49 into leftwm:master Sep 20, 2021
@darkowlzz darkowlzz deleted the theme-apply-changes branch September 20, 2021 05:00
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

Successfully merging this pull request may close these issues.

2 participants