Skip to content

Commit e9e43db

Browse files
committed
Always invalidate fastfetch logo cache
1 parent a520b5a commit e9e43db

5 files changed

Lines changed: 17 additions & 17 deletions

File tree

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ build = "build.rs"
88
chrono = "0.4.42"
99
clap = { version = "4.5.53", features = ["derive", "string"] }
1010
clap_complete = "4.5.61"
11+
chrono = "0.4.42"
12+
clap = { version = "4.5.53", features = ["derive", "string"] }
13+
clap_complete = "4.5.61"
1114
crossterm = "0.29.0"
1215
dirs = "6.0.0"
1316
fast_image_resize = { version = "5.3.0", features = ["image", "rayon"] }
1417
image = "0.25.9"
18+
fast_image_resize = { version = "5.3.0", features = ["image", "rayon"] }
19+
image = "0.25.9"
1520
nix = { version = "0.30.1", features = ["process"] }
16-
rexiv2 = { version = "0.10.0", optional = true }
21+
rexiv2 = { version = "0.10.0" }
1722
serde = { version = "1.0.228", features = ["derive"] }
1823
serde_json = "1.0.145"
1924
signal-hook = "0.3.18"
@@ -28,7 +33,6 @@ clap_mangen = "0.2.31"
2833
[features]
2934
default = ["nixos"]
3035
nixos = []
31-
iynaixos = ["rexiv2"]
3236

3337
[lints.rust]
3438
unsafe_code = "forbid"

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.nix

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
fastfetch,
1010
glib,
1111
gexiv2,
12-
iynaixos ? false,
1312
}:
1413
rustPlatform.buildRustPackage {
1514
pname = "wfetch";
@@ -32,7 +31,7 @@ rustPlatform.buildRustPackage {
3231
cargoLock.lockFile = ./Cargo.lock;
3332

3433
buildNoDefaultFeatures = true;
35-
buildFeatures = [ "nixos" ] ++ lib.optionals iynaixos [ "iynaixos" ];
34+
buildFeatures = [ "nixos" ];
3635

3736
# create files for shell autocomplete
3837
nativeBuildInputs = [
@@ -41,7 +40,7 @@ rustPlatform.buildRustPackage {
4140
pkg-config
4241
];
4342

44-
buildInputs = lib.optionals iynaixos [
43+
buildInputs = [
4544
glib
4645
gexiv2
4746
];

src/logos.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use crate::{
1414
asset_path,
1515
cli::WFetchArgs,
1616
colors::{self, Rgba8, Rgba8Ext},
17-
create_output_file, wallpaper,
17+
create_output_file,
18+
wallpaper::{self, detect_iynaixos},
1819
};
1920
use crate::{colors::get_term_colors, wallpaper::geom_from_str};
2021

@@ -130,7 +131,6 @@ pub fn resize_wallpaper(args: &WFetchArgs, term: &str, image_arg: &Option<String
130131
.decode()
131132
.expect("could not decode image");
132133

133-
#[cfg_attr(not(feature = "iynaixos"), allow(unused_mut))]
134134
let mut fallback_geometry = {
135135
let (width, height) =
136136
image::image_dimensions(&wall).expect("could not get image dimensions");
@@ -144,8 +144,7 @@ pub fn resize_wallpaper(args: &WFetchArgs, term: &str, image_arg: &Option<String
144144
}
145145
};
146146

147-
#[cfg(feature = "iynaixos")]
148-
{
147+
if detect_iynaixos().is_some() {
149148
fallback_geometry = wallpaper::info(&wall, fallback_geometry);
150149
}
151150

@@ -256,6 +255,7 @@ impl Logo {
256255
json!({
257256
"type": logo_backend,
258257
"source": source,
258+
"recache": true,
259259
"preserveAspectRatio": true,
260260
})
261261
}

src/wallpaper.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ use std::{
33
process::{Command, Stdio},
44
};
55

6-
use crate::{full_path, CommandUtf8};
6+
use crate::{CommandUtf8, full_path};
77

8-
#[cfg(feature = "iynaixos")]
98
/// detect wallpaper using current-wallpaper file in tmpfs
10-
fn detect_iynaixos() -> Option<String> {
9+
pub fn detect_iynaixos() -> Option<String> {
1110
std::fs::read_to_string(
1211
dirs::runtime_dir()
1312
.expect("could not get XDG_RUNTIME_DIR")
@@ -29,7 +28,6 @@ pub fn geom_from_str(crop: &str) -> Option<(f64, f64, f64, f64)> {
2928
}
3029
}
3130

32-
#[cfg(feature = "iynaixos")]
3331
/// reads the wallpaper info from image xmp metadata (w, h, x, y)
3432
pub fn info(image: &str, fallback: (f64, f64, f64, f64)) -> (f64, f64, f64, f64) {
3533
use rexiv2::Metadata;
@@ -131,7 +129,6 @@ where
131129
wallpaper_arg
132130
.as_ref()
133131
.and_then(|s| s.as_ref().to_str().map(std::string::ToString::to_string)),
134-
#[cfg(feature = "iynaixos")]
135132
detect_iynaixos(),
136133
detect_swww(),
137134
detect_swaybg(),

0 commit comments

Comments
 (0)