Skip to content

Commit

Permalink
run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinAskestad committed Jul 22, 2023
1 parent a95bfc7 commit 77a4f4a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
26 changes: 21 additions & 5 deletions src/appwindow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use windows::{
},
};

use grout_wm::{Result, HIWORD, LOWORD, to_wide_arr};
use grout_wm::{to_wide_arr, Result, HIWORD, LOWORD};

use crate::{
win32::{
Expand Down Expand Up @@ -142,10 +142,26 @@ impl AppWindow {
let dw_mask = windows::Win32::UI::Shell::THB_ICON
| windows::Win32::UI::Shell::THB_TOOLTIP
| windows::Win32::UI::Shell::THB_FLAGS;
let dwindle_icon = if is_light_theme { w!("dwindle-blk") } else { w!("dwindle-wht") };
let monocle_icon = if is_light_theme { w!("monocle-blk") } else { w!("monocle-wht") };
let columns_icon = if is_light_theme { w!("columns-blk") } else { w!("columns-wht") };
let focus_icon = if is_light_theme { w!("focus-blk") } else { w!("focus-wht") };
let dwindle_icon = if is_light_theme {
w!("dwindle-blk")
} else {
w!("dwindle-wht")
};
let monocle_icon = if is_light_theme {
w!("monocle-blk")
} else {
w!("monocle-wht")
};
let columns_icon = if is_light_theme {
w!("columns-blk")
} else {
w!("columns-wht")
};
let focus_icon = if is_light_theme {
w!("focus-blk")
} else {
w!("focus-wht")
};
let buttons: Vec<windows::Win32::UI::Shell::THUMBBUTTON> = vec![
windows::Win32::UI::Shell::THUMBBUTTON {
dwMask: dw_mask,
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ macro_rules! to_wide_arr {
($input:expr) => {{
let mut result: [u16; 260] = [0; 260];
let chars = $input.chars().take(260);
for(i, ch) in chars.enumerate() {
for (i, ch) in chars.enumerate() {
result[i] = ch as u16;
}
result
}};
}
}

pub struct Error {
pub(crate) message: String,
Expand Down
6 changes: 2 additions & 4 deletions src/win32/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ pub fn is_light_theme() -> bool {
Some(&mut size),
)
};
if res != ERROR_SUCCESS {
if res == ERROR_FILE_NOT_FOUND {
return true;
}
if res != ERROR_SUCCESS && res == ERROR_FILE_NOT_FOUND {
return true;
}
i32::from_le_bytes(buffer) == 1
}

0 comments on commit 77a4f4a

Please sign in to comment.