From 667b4cd2d9dabcd6625eaad5294f4a2ed007d8cc Mon Sep 17 00:00:00 2001 From: stjet <49297268+stjet@users.noreply.github.com> Date: Mon, 21 Apr 2025 06:57:42 +0000 Subject: [PATCH] change project structure to make more sense (move wm only stuff to wm dir) --- Cargo.toml | 14 +++++--------- ming-wm-lib/Cargo.toml | 2 +- .../src}/components/highlight_button.rs | 8 ++++---- {src => ming-wm-lib/src}/components/mod.rs | 6 +++--- .../src}/components/paragraph.rs | 11 +++++------ .../src}/components/press_button.rs | 8 ++++---- .../src}/components/toggle_button.rs | 8 ++++---- ming-wm-lib/src/lib.rs | 1 + ming-wm-lib/src/utils.rs | 13 +++++++++++++ src/bin/audio_player.rs | 3 +-- src/bin/{main.rs => wm.rs} | 18 +++++++++++------- wm/Cargo.toml | 14 ++++++++++++++ {linux => wm/linux}/Cargo.toml | 0 {linux => wm/linux}/src/fb.rs | 0 {linux => wm/linux}/src/keys.rs | 0 {linux => wm/linux}/src/lib.rs | 0 {linux => wm/linux}/src/raw.rs | 0 {src => wm/src}/essential/about.rs | 4 ++-- .../src}/essential/desktop_background.rs | 0 {src => wm/src}/essential/help.rs | 4 ++-- {src => wm/src}/essential/lock_screen.rs | 8 ++++---- {src => wm/src}/essential/mod.rs | 0 {src => wm/src}/essential/onscreen_keyboard.rs | 4 ++-- {src => wm/src}/essential/start_menu.rs | 4 ++-- {src => wm/src}/essential/taskbar.rs | 4 ++-- .../src}/essential/workspace_indicator.rs | 0 {src => wm/src}/framebuffer.rs | 0 {src => wm/src}/fs.rs | 14 -------------- {src => wm/src}/lib.rs | 4 +++- {src => wm/src}/proxy_window_like.rs | 0 {src => wm/src}/window_manager.rs | 6 ++++-- 31 files changed, 87 insertions(+), 71 deletions(-) rename {src => ming-wm-lib/src}/components/highlight_button.rs (91%) rename {src => ming-wm-lib/src}/components/mod.rs (81%) rename {src => ming-wm-lib/src}/components/paragraph.rs (90%) rename {src => ming-wm-lib/src}/components/press_button.rs (90%) rename {src => ming-wm-lib/src}/components/toggle_button.rs (92%) rename src/bin/{main.rs => wm.rs} (93%) create mode 100644 wm/Cargo.toml rename {linux => wm/linux}/Cargo.toml (100%) rename {linux => wm/linux}/src/fb.rs (100%) rename {linux => wm/linux}/src/keys.rs (100%) rename {linux => wm/linux}/src/lib.rs (100%) rename {linux => wm/linux}/src/raw.rs (100%) rename {src => wm/src}/essential/about.rs (95%) rename {src => wm/src}/essential/desktop_background.rs (100%) rename {src => wm/src}/essential/help.rs (97%) rename {src => wm/src}/essential/lock_screen.rs (95%) rename {src => wm/src}/essential/mod.rs (100%) rename {src => wm/src}/essential/onscreen_keyboard.rs (98%) rename {src => wm/src}/essential/start_menu.rs (98%) rename {src => wm/src}/essential/taskbar.rs (97%) rename {src => wm/src}/essential/workspace_indicator.rs (100%) rename {src => wm/src}/framebuffer.rs (100%) rename {src => wm/src}/fs.rs (88%) rename {src => wm/src}/lib.rs (74%) rename {src => wm/src}/proxy_window_like.rs (100%) rename {src => wm/src}/window_manager.rs (99%) diff --git a/Cargo.toml b/Cargo.toml index 57e098c..889c445 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ default-run = "ming" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [workspace] -members = [ "linux" ] +members = [ "wm", "wm/linux" ] [build-dependencies] bmp-rust = "0.5.0" @@ -17,20 +17,16 @@ blake2 = { version = "0.10.6", default-features = false } [dependencies] ming-wm-lib = { path = "ming-wm-lib" } -blake2 = { version = "0.10.6", default-features = false } -linux = { path = "linux" } -termion = { version = "4.0.3", optional = true } +wm = { path = "wm", optional = true } rodio = { version = "0.19.0", default-features = false, features = [ "flac", "mp3", "symphonia-vorbis", "wav" ], optional = true } rand = { version = "0.9.0", default-features = false, features = [ "small_rng" ], optional = true } id3 = { version = "1.10.0", optional = true } mp4ameta = { version = "0.11.0", optional = true } metaflac = { version = "0.2.5", optional = true } -bmp-rust = "0.5.0" pty-process = { version = "0.5.1", optional = true } [features] -default = [ "main", "terminal" ] -main = [ "termion" ] +default = [ "wm", "terminal" ] terminal = [ "pty-process" ] audio_player = [ "id3", "mp4ameta", "metaflac", "rand", "rodio" ] @@ -39,8 +35,8 @@ lto = true [[bin]] name = "ming" -path = "src/bin/main.rs" -required-features = [ "main" ] +path = "src/bin/wm.rs" +required-features = [ "wm" ] [[bin]] name = "mingFiles_Audio_Player" diff --git a/ming-wm-lib/Cargo.toml b/ming-wm-lib/Cargo.toml index 99c25f9..c821a1c 100644 --- a/ming-wm-lib/Cargo.toml +++ b/ming-wm-lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ming-wm-lib" -version = "0.1.6" +version = "0.1.7" repository = "https://github.com/stjet/ming-wm" description = "library for building windows for ming-wm in rust" readme = "README.md" diff --git a/src/components/highlight_button.rs b/ming-wm-lib/src/components/highlight_button.rs similarity index 91% rename from src/components/highlight_button.rs rename to ming-wm-lib/src/components/highlight_button.rs index e00368d..4f9cfa6 100644 --- a/src/components/highlight_button.rs +++ b/ming-wm-lib/src/components/highlight_button.rs @@ -2,10 +2,10 @@ use std::vec; use std::vec::Vec; use crate::components::Component; -use ming_wm_lib::framebuffer_types::{ Dimensions, Point }; -use ming_wm_lib::themes::ThemeInfo; -use ming_wm_lib::messages::WindowMessage; -use ming_wm_lib::window_manager_types::DrawInstructions; +use crate::framebuffer_types::{ Dimensions, Point }; +use crate::themes::ThemeInfo; +use crate::messages::WindowMessage; +use crate::window_manager_types::DrawInstructions; pub struct HighlightButton { name_: String, diff --git a/src/components/mod.rs b/ming-wm-lib/src/components/mod.rs similarity index 81% rename from src/components/mod.rs rename to ming-wm-lib/src/components/mod.rs index 4a64068..a9e1e43 100644 --- a/src/components/mod.rs +++ b/ming-wm-lib/src/components/mod.rs @@ -1,8 +1,8 @@ use std::vec::Vec; -use ming_wm_lib::themes::ThemeInfo; -use ming_wm_lib::messages::WindowMessage; -use ming_wm_lib::window_manager_types::DrawInstructions; +use crate::themes::ThemeInfo; +use crate::messages::WindowMessage; +use crate::window_manager_types::DrawInstructions; pub mod toggle_button; pub mod highlight_button; diff --git a/src/components/paragraph.rs b/ming-wm-lib/src/components/paragraph.rs similarity index 90% rename from src/components/paragraph.rs rename to ming-wm-lib/src/components/paragraph.rs index 0102fea..19b3366 100644 --- a/src/components/paragraph.rs +++ b/ming-wm-lib/src/components/paragraph.rs @@ -1,12 +1,11 @@ use std::vec; use std::vec::Vec; - -use ming_wm_lib::framebuffer_types::{ Dimensions, Point }; -use ming_wm_lib::themes::ThemeInfo; -use ming_wm_lib::messages::WindowMessage; -use ming_wm_lib::window_manager_types::DrawInstructions; -use ming_wm_lib::utils::calc_actual_lines; +use crate::framebuffer_types::{ Dimensions, Point }; +use crate::themes::ThemeInfo; +use crate::messages::WindowMessage; +use crate::window_manager_types::DrawInstructions; +use crate::utils::calc_actual_lines; use crate::components::Component; const MONO_WIDTH: u8 = 10; diff --git a/src/components/press_button.rs b/ming-wm-lib/src/components/press_button.rs similarity index 90% rename from src/components/press_button.rs rename to ming-wm-lib/src/components/press_button.rs index 8151db9..d907779 100644 --- a/src/components/press_button.rs +++ b/ming-wm-lib/src/components/press_button.rs @@ -2,10 +2,10 @@ use std::vec; use std::vec::Vec; use crate::components::Component; -use ming_wm_lib::framebuffer_types::{ Dimensions, Point }; -use ming_wm_lib::themes::ThemeInfo; -use ming_wm_lib::messages::WindowMessage; -use ming_wm_lib::window_manager_types::DrawInstructions; +use crate::framebuffer_types::{ Dimensions, Point }; +use crate::themes::ThemeInfo; +use crate::messages::WindowMessage; +use crate::window_manager_types::DrawInstructions; const MONO_WIDTH: u8 = 10; diff --git a/src/components/toggle_button.rs b/ming-wm-lib/src/components/toggle_button.rs similarity index 92% rename from src/components/toggle_button.rs rename to ming-wm-lib/src/components/toggle_button.rs index 105258c..dce7653 100644 --- a/src/components/toggle_button.rs +++ b/ming-wm-lib/src/components/toggle_button.rs @@ -2,10 +2,10 @@ use std::vec; use std::vec::Vec; use crate::components::Component; -use ming_wm_lib::framebuffer_types::{ Dimensions, Point }; -use ming_wm_lib::themes::ThemeInfo; -use ming_wm_lib::messages::WindowMessage; -use ming_wm_lib::window_manager_types::DrawInstructions; +use crate::framebuffer_types::{ Dimensions, Point }; +use crate::themes::ThemeInfo; +use crate::messages::WindowMessage; +use crate::window_manager_types::DrawInstructions; pub struct ToggleButton { name_: String, diff --git a/ming-wm-lib/src/lib.rs b/ming-wm-lib/src/lib.rs index 5ff514f..96cb963 100644 --- a/ming-wm-lib/src/lib.rs +++ b/ming-wm-lib/src/lib.rs @@ -4,6 +4,7 @@ pub mod themes; pub mod serialize; pub mod messages; pub mod ipc; +pub mod components; pub mod dirs; pub mod utils; pub mod logging; diff --git a/ming-wm-lib/src/utils.rs b/ming-wm-lib/src/utils.rs index e32a4d8..68f4dd3 100644 --- a/ming-wm-lib/src/utils.rs +++ b/ming-wm-lib/src/utils.rs @@ -214,3 +214,16 @@ pub fn path_autocomplete(current_path: &str, partial_path: &str) -> Option Vec { + let mut files = Vec::new(); + for entry in read_dir(dir).unwrap() { + let path = entry.unwrap().path(); + if path.is_dir() { + files.extend(get_all_files(path)); + } else { + files.push(path); + } + } + files +} diff --git a/src/bin/audio_player.rs b/src/bin/audio_player.rs index e940b98..e560293 100644 --- a/src/bin/audio_player.rs +++ b/src/bin/audio_player.rs @@ -17,10 +17,9 @@ use ming_wm_lib::window_manager_types::{ DrawInstructions, WindowLike, WindowLik use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse }; use ming_wm_lib::framebuffer_types::Dimensions; use ming_wm_lib::themes::ThemeInfo; -use ming_wm_lib::utils::{ concat_paths, path_autocomplete, format_seconds, Substring }; +use ming_wm_lib::utils::{ concat_paths, get_all_files, path_autocomplete, format_seconds, Substring }; use ming_wm_lib::dirs::home; use ming_wm_lib::ipc::listen; -use ming_wm::fs::get_all_files; fn get_artist(path: &PathBuf) -> Option { let ext = path.extension().unwrap(); diff --git a/src/bin/main.rs b/src/bin/wm.rs similarity index 93% rename from src/bin/main.rs rename to src/bin/wm.rs index abf8280..b639d13 100644 --- a/src/bin/main.rs +++ b/src/bin/wm.rs @@ -6,15 +6,19 @@ use std::io::{ stdin, stdout, BufReader, BufRead, Write }; use std::process::exit; use std::env; -use linux::fb::Framebuffer; -use linux::raw::RawStdout; -use termion::input::TermRead; -use termion::event::Key; +//termion is an external dep, will be removed eventually +use wm::termion::input::TermRead; +use wm::termion::event::Key; + +use wm::linux::fb::Framebuffer; +use wm::linux::raw::RawStdout; +use wm::framebuffer::{ FramebufferWriter, FramebufferInfo }; +use wm::window_manager::WindowManager; use ming_wm_lib::window_manager_types::KeyChar; use ming_wm_lib::messages::*; -use ming_wm::framebuffer::{ FramebufferWriter, FramebufferInfo }; -use ming_wm::window_manager::WindowManager; + +include!(concat!(env!("OUT_DIR"), "/password.rs")); const CLEAR_ALL: &'static str = "\x1b[2J"; const HIDE_CURSOR: &'static str = "\x1b[?25l"; @@ -71,7 +75,7 @@ fn init(framebuffer: Framebuffer, framebuffer_info: FramebufferInfo) { writer.init(framebuffer_info.clone()); - let mut wm: WindowManager = WindowManager::new(writer, framebuffer, dimensions, rotate, grayscale); + let mut wm: WindowManager = WindowManager::new(writer, framebuffer, dimensions, rotate, grayscale, PASSWORD_HASH); let mut stdout = RawStdout::new(stdout()); stdout.enter_raw_mode().unwrap(); diff --git a/wm/Cargo.toml b/wm/Cargo.toml new file mode 100644 index 0000000..8f99de7 --- /dev/null +++ b/wm/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "wm" +version = "1.0.3" +repository = "https://github.com/stjet/ming-wm" +license = "GPL-3.0-or-later" +edition = "2021" + +[dependencies] +ming-wm-lib = { path = "../ming-wm-lib" } +linux = { path = "linux" } +blake2 = { version = "0.10.6", default-features = false } +termion = { version = "4.0.3" } +bmp-rust = "0.5.0" + diff --git a/linux/Cargo.toml b/wm/linux/Cargo.toml similarity index 100% rename from linux/Cargo.toml rename to wm/linux/Cargo.toml diff --git a/linux/src/fb.rs b/wm/linux/src/fb.rs similarity index 100% rename from linux/src/fb.rs rename to wm/linux/src/fb.rs diff --git a/linux/src/keys.rs b/wm/linux/src/keys.rs similarity index 100% rename from linux/src/keys.rs rename to wm/linux/src/keys.rs diff --git a/linux/src/lib.rs b/wm/linux/src/lib.rs similarity index 100% rename from linux/src/lib.rs rename to wm/linux/src/lib.rs diff --git a/linux/src/raw.rs b/wm/linux/src/raw.rs similarity index 100% rename from linux/src/raw.rs rename to wm/linux/src/raw.rs diff --git a/src/essential/about.rs b/wm/src/essential/about.rs similarity index 95% rename from src/essential/about.rs rename to wm/src/essential/about.rs index fd00b48..b2bf7f1 100644 --- a/src/essential/about.rs +++ b/wm/src/essential/about.rs @@ -7,8 +7,8 @@ use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse }; use ming_wm_lib::framebuffer_types::Dimensions; use ming_wm_lib::themes::ThemeInfo; use ming_wm_lib::dirs::exe_dir; -use crate::components::Component; -use crate::components::paragraph::Paragraph; +use ming_wm_lib::components::Component; +use ming_wm_lib::components::paragraph::Paragraph; pub struct About { dimensions: Dimensions, diff --git a/src/essential/desktop_background.rs b/wm/src/essential/desktop_background.rs similarity index 100% rename from src/essential/desktop_background.rs rename to wm/src/essential/desktop_background.rs diff --git a/src/essential/help.rs b/wm/src/essential/help.rs similarity index 97% rename from src/essential/help.rs rename to wm/src/essential/help.rs index 9e5786c..c4ddcbf 100644 --- a/src/essential/help.rs +++ b/wm/src/essential/help.rs @@ -8,8 +8,8 @@ use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse }; use ming_wm_lib::dirs::exe_dir; use ming_wm_lib::framebuffer_types::Dimensions; use ming_wm_lib::themes::ThemeInfo; -use crate::components::paragraph::Paragraph; -use crate::components::Component; +use ming_wm_lib::components::paragraph::Paragraph; +use ming_wm_lib::components::Component; pub struct Help { dimensions: Dimensions, diff --git a/src/essential/lock_screen.rs b/wm/src/essential/lock_screen.rs similarity index 95% rename from src/essential/lock_screen.rs rename to wm/src/essential/lock_screen.rs index dc42165..a508a87 100644 --- a/src/essential/lock_screen.rs +++ b/wm/src/essential/lock_screen.rs @@ -7,13 +7,12 @@ use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse, WindowManager use ming_wm_lib::window_manager_types::{ DrawInstructions, WindowLike, WindowLikeType }; use blake2::{ Blake2b512, Digest }; -include!(concat!(env!("OUT_DIR"), "/password.rs")); - //const PASSWORD_HASH: [u8; 64] = [220, 88, 183, 188, 240, 27, 107, 181, 58, 191, 198, 170, 114, 38, 7, 148, 6, 179, 75, 128, 231, 171, 172, 220, 85, 38, 36, 113, 116, 146, 70, 197, 163, 179, 158, 192, 130, 53, 247, 48, 47, 209, 95, 96, 179, 211, 4, 122, 254, 127, 21, 165, 139, 199, 151, 226, 216, 176, 123, 41, 194, 221, 58, 69]; pub struct LockScreen { dimensions: Dimensions, input_password: String, + password_hash: [u8; 64], } impl WindowLike for LockScreen { @@ -28,7 +27,7 @@ impl WindowLike for LockScreen { //check password let mut hasher = Blake2b512::new(); hasher.update((self.input_password.clone() + "salt?sorrycryptographers").as_bytes()); - if hasher.finalize() == PASSWORD_HASH.into() { + if hasher.finalize() == self.password_hash.into() { WindowMessageResponse::Request(WindowManagerRequest::Unlock) } else { self.input_password = String::new(); @@ -73,10 +72,11 @@ impl WindowLike for LockScreen { } impl LockScreen { - pub fn new() -> Self { + pub fn new(password_hash: [u8; 64]) -> Self { Self { dimensions: [0, 0], input_password: String::new(), + password_hash, } } } diff --git a/src/essential/mod.rs b/wm/src/essential/mod.rs similarity index 100% rename from src/essential/mod.rs rename to wm/src/essential/mod.rs diff --git a/src/essential/onscreen_keyboard.rs b/wm/src/essential/onscreen_keyboard.rs similarity index 98% rename from src/essential/onscreen_keyboard.rs rename to wm/src/essential/onscreen_keyboard.rs index 3284677..68ac6a7 100644 --- a/src/essential/onscreen_keyboard.rs +++ b/wm/src/essential/onscreen_keyboard.rs @@ -7,8 +7,8 @@ use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse, WindowManager use ming_wm_lib::framebuffer_types::Dimensions; use ming_wm_lib::themes::ThemeInfo; use ming_wm_lib::utils::point_inside; -use crate::components::Component; -use crate::components::press_button::PressButton; +use ming_wm_lib::components::Component; +use ming_wm_lib::components::press_button::PressButton; //seems like framebuffer only updates if (real) key is pressed... //on mobile, volume down button seems to work but is annoying diff --git a/src/essential/start_menu.rs b/wm/src/essential/start_menu.rs similarity index 98% rename from src/essential/start_menu.rs rename to wm/src/essential/start_menu.rs index 30e517b..972e928 100644 --- a/src/essential/start_menu.rs +++ b/wm/src/essential/start_menu.rs @@ -7,9 +7,9 @@ use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse, WindowManager use ming_wm_lib::framebuffer_types::Dimensions; use ming_wm_lib::themes::ThemeInfo; use ming_wm_lib::dirs::exe_dir; +use ming_wm_lib::components::Component; +use ming_wm_lib::components::highlight_button::HighlightButton; use crate::fs::{ ExeWindowInfos, get_all_executable_windows }; -use crate::components::Component; -use crate::components::highlight_button::HighlightButton; static CATEGORIES: [&'static str; 9] = ["About", "Utils", "Games", "Editing", "Files", "Internet", "Misc", "Help", "Lock"]; diff --git a/src/essential/taskbar.rs b/wm/src/essential/taskbar.rs similarity index 97% rename from src/essential/taskbar.rs rename to wm/src/essential/taskbar.rs index 478eace..f806590 100644 --- a/src/essential/taskbar.rs +++ b/wm/src/essential/taskbar.rs @@ -6,8 +6,8 @@ use ming_wm_lib::window_manager_types::{ DrawInstructions, WindowLike, WindowLik use ming_wm_lib::messages::{ WindowMessage, WindowMessageResponse, WindowManagerRequest, ShortcutType, InfoType, WindowsVec }; use ming_wm_lib::framebuffer_types::Dimensions; use ming_wm_lib::themes::ThemeInfo; -use crate::components::Component; -use crate::components::toggle_button::ToggleButton; +use ming_wm_lib::components::Component; +use ming_wm_lib::components::toggle_button::ToggleButton; const PADDING: usize = 4; const META_WIDTH: usize = 175; //of the window button diff --git a/src/essential/workspace_indicator.rs b/wm/src/essential/workspace_indicator.rs similarity index 100% rename from src/essential/workspace_indicator.rs rename to wm/src/essential/workspace_indicator.rs diff --git a/src/framebuffer.rs b/wm/src/framebuffer.rs similarity index 100% rename from src/framebuffer.rs rename to wm/src/framebuffer.rs diff --git a/src/fs.rs b/wm/src/fs.rs similarity index 88% rename from src/fs.rs rename to wm/src/fs.rs index 2b9e0c5..30a3185 100644 --- a/src/fs.rs +++ b/wm/src/fs.rs @@ -1,5 +1,4 @@ use std::fs::{ read_dir, File }; -use std::path::PathBuf; use std::io::Read; use std::collections::HashMap; @@ -34,19 +33,6 @@ pub fn get_font_char_from_fonts(fonts: &[String], c: char) -> (char, Vec get_font_char(&p, '?').unwrap_or(('?', vec![vec![0]], 0)) } -pub fn get_all_files(dir: PathBuf) -> Vec { - let mut files = Vec::new(); - for entry in read_dir(dir).unwrap() { - let path = entry.unwrap().path(); - if path.is_dir() { - files.extend(get_all_files(path)); - } else { - files.push(path); - } - } - files -} - //Category, Vec pub type ExeWindowInfos = HashMap>; diff --git a/src/lib.rs b/wm/src/lib.rs similarity index 74% rename from src/lib.rs rename to wm/src/lib.rs index 6564cee..4b3edaa 100644 --- a/src/lib.rs +++ b/wm/src/lib.rs @@ -1,6 +1,8 @@ +pub use linux; +pub use termion; + pub mod framebuffer; pub mod window_manager; -pub mod components; pub mod fs; mod proxy_window_like; mod essential; diff --git a/src/proxy_window_like.rs b/wm/src/proxy_window_like.rs similarity index 100% rename from src/proxy_window_like.rs rename to wm/src/proxy_window_like.rs diff --git a/src/window_manager.rs b/wm/src/window_manager.rs similarity index 99% rename from src/window_manager.rs rename to wm/src/window_manager.rs index 0b5d09c..272d568 100644 --- a/src/window_manager.rs +++ b/wm/src/window_manager.rs @@ -65,12 +65,13 @@ pub struct WindowManager { current_workspace: u8, framebuffer: Framebuffer, clipboard: Option, + password_hash: [u8; 64], } //1 is up, 2 is down impl WindowManager { - pub fn new(writer: FramebufferWriter, framebuffer: Framebuffer, dimensions: Dimensions, rotate: bool, grayscale: bool) -> Self { + pub fn new(writer: FramebufferWriter, framebuffer: Framebuffer, dimensions: Dimensions, rotate: bool, grayscale: bool, password_hash: [u8; 64]) -> Self { //println!("bg: {}x{}", dimensions[0], dimensions[1] - TASKBAR_HEIGHT - INDICATOR_HEIGHT); let mut wm = WindowManager { writer: RefCell::new(writer), @@ -86,6 +87,7 @@ impl WindowManager { current_workspace: 0, framebuffer, clipboard: None, + password_hash, }; wm.lock(); wm.change_theme(); @@ -136,7 +138,7 @@ impl WindowManager { fn lock(&mut self) { self.locked = true; self.window_infos = Vec::new(); - self.add_window_like(Box::new(LockScreen::new()), [0, 0], None); + self.add_window_like(Box::new(LockScreen::new(self.password_hash)), [0, 0], None); } fn unlock(&mut self) {