refactor: remove embedded wallpaper from binary (v0.6.2)
Wallpaper is installed by moonarch to /usr/share/moonarch/wallpaper.jpg. Embedding a 374K JPEG in the binary was redundant. Without a wallpaper file, GTK background color (Catppuccin Mocha base) shows through.
This commit is contained in:
+15
-15
@@ -44,7 +44,7 @@ struct LockscreenState {
|
||||
/// The `blur_cache` and `avatar_cache` are shared across monitors for multi-monitor
|
||||
/// setups, avoiding redundant GPU renders and SVG rasterizations.
|
||||
pub fn create_lockscreen_window(
|
||||
bg_texture: &gdk::Texture,
|
||||
bg_texture: Option<&gdk::Texture>,
|
||||
config: &Config,
|
||||
app: >k::Application,
|
||||
unlock_callback: Rc<dyn Fn()>,
|
||||
@@ -86,9 +86,11 @@ pub fn create_lockscreen_window(
|
||||
let overlay = gtk::Overlay::new();
|
||||
window.set_child(Some(&overlay));
|
||||
|
||||
// Background wallpaper
|
||||
let background = create_background_picture(bg_texture, config.background_blur, blur_cache);
|
||||
overlay.set_child(Some(&background));
|
||||
// Background wallpaper (if available — otherwise GTK background color shows through)
|
||||
if let Some(texture) = bg_texture {
|
||||
let background = create_background_picture(texture, config.background_blur, blur_cache);
|
||||
overlay.set_child(Some(&background));
|
||||
}
|
||||
|
||||
// Centered vertical box
|
||||
let main_box = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
||||
@@ -430,18 +432,16 @@ pub fn start_fingerprint(
|
||||
}
|
||||
|
||||
/// Load the wallpaper as a texture once, for sharing across all windows.
|
||||
/// Returns None if no wallpaper path is provided or the file cannot be loaded.
|
||||
/// Blur is applied at render time via GPU (GskBlurNode), not here.
|
||||
pub fn load_background_texture(bg_path: &Path) -> gdk::Texture {
|
||||
let fallback = "/dev/moonarch/moonlock/wallpaper.jpg";
|
||||
|
||||
if bg_path.starts_with("/dev/moonarch/moonlock") {
|
||||
let resource_path = bg_path.to_str().unwrap_or(fallback);
|
||||
gdk::Texture::from_resource(resource_path)
|
||||
} else {
|
||||
let file = gio::File::for_path(bg_path);
|
||||
gdk::Texture::from_file(&file).unwrap_or_else(|_| {
|
||||
gdk::Texture::from_resource(fallback)
|
||||
})
|
||||
pub fn load_background_texture(bg_path: &Path) -> Option<gdk::Texture> {
|
||||
let file = gio::File::for_path(bg_path);
|
||||
match gdk::Texture::from_file(&file) {
|
||||
Ok(texture) => Some(texture),
|
||||
Err(e) => {
|
||||
log::warn!("Failed to load wallpaper {}: {e}", bg_path.display());
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user