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 image filter to cache #372

Merged
merged 4 commits into from
Oct 27, 2024
Merged

Add image filter to cache #372

merged 4 commits into from
Oct 27, 2024

Conversation

kerty0
Copy link
Contributor

@kerty0 kerty0 commented Oct 24, 2024

I primary use pixel art wallpapers, so the default filter for all restored images was annoying.
I modified cache so it stores filter and path to image separated by '\n' (I couldn't think of anything better). It can work with old version of cache if it doesn't contain '\n' using default filter.
I also fixed a crash that occurred when using a solid color on my system (EndevourOS + Hyprland): the drawable surface required RGBA image but was only provided with RGB.
I'm still learning Rust and English is not my native language, so sorry if anything is wrong.

@LGFae
Copy link
Owner

LGFae commented Oct 24, 2024

It can work with old version of cache if it doesn't contain '\n'

We don't need this. Instead, increase the cargo version from masterV2 to masterV3. The cache will won't consider files with older versions.

@kerty0
Copy link
Contributor Author

kerty0 commented Oct 25, 2024

Now get_previous_image_path returns error to the old version of cache and users will be forced to set the wallpaper again to update cache.

Copy link
Owner

@LGFae LGFae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Just two small things and we can merge this.

let mut filepath = cache_dir()?;
clean_previous_verions(&filepath);

filepath.push(output_name);
if !filepath.is_file() {
return Ok("".to_string());
return Ok(("Lanczos3".to_string(), "".to_string()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really get what this gives us. Is it just to improve the error messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and it makes it easy to force swww-daemon ignore missing cache files.

@kerty0
Copy link
Contributor Author

kerty0 commented Oct 27, 2024

How swww restore don't stop half done if one of the outputs don't have cache file and print name of the output for all errors

@LGFae
Copy link
Owner

LGFae commented Oct 27, 2024

Thanks!

@LGFae LGFae merged commit 36808df into LGFae:main Oct 27, 2024
10 checks passed
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