cargo fmt
Pure formatting, no functional change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
856f8d8bf4
commit
42ffe9c492
@@ -6,8 +6,8 @@ use std::{
|
||||
};
|
||||
|
||||
use dbus::blocking::{
|
||||
stdintf::org_freedesktop_dbus::{Properties, PropertiesPropertiesChanged},
|
||||
LocalConnection,
|
||||
stdintf::org_freedesktop_dbus::{Properties, PropertiesPropertiesChanged},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -64,7 +64,10 @@ fn battery_present() -> Result<bool, Box<dyn Error>> {
|
||||
Ok(present)
|
||||
}
|
||||
|
||||
fn monitor(inner: Arc<Mutex<InnerBattery>>, events: Arc<Mutex<Events>>) -> Result<(), Box<dyn Error>> {
|
||||
fn monitor(
|
||||
inner: Arc<Mutex<InnerBattery>>,
|
||||
events: Arc<Mutex<Events>>,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let conn = LocalConnection::new_system()?;
|
||||
let proxy = conn.with_proxy(
|
||||
"org.freedesktop.UPower",
|
||||
|
||||
@@ -323,7 +323,7 @@ impl<'a> Widget for Calendar {
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
x => x,
|
||||
};
|
||||
@@ -335,7 +335,7 @@ impl<'a> Widget for Calendar {
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
y => y,
|
||||
};
|
||||
|
||||
+9
-13
@@ -1,10 +1,10 @@
|
||||
use std::{
|
||||
cmp::{max, min, Ordering},
|
||||
cmp::{Ordering, max, min},
|
||||
collections::HashMap,
|
||||
default::Default,
|
||||
fs::{read_to_string, File},
|
||||
fs::{File, read_to_string},
|
||||
io::Write,
|
||||
process::{exit, Command},
|
||||
process::{Command, exit},
|
||||
sync::{Arc, Mutex},
|
||||
thread,
|
||||
};
|
||||
@@ -14,18 +14,18 @@ use crate::{
|
||||
color::Color,
|
||||
event::{Event, Events, PointerButton, PointerEvent},
|
||||
fonts::FontMap,
|
||||
keyboard::{keysyms, KeyEvent},
|
||||
keyboard::{KeyEvent, keysyms},
|
||||
utils::{
|
||||
desktop::{load_desktop_cache, load_desktop_files, write_desktop_cache, Desktop},
|
||||
desktop::{Desktop, load_desktop_cache, load_desktop_files, write_desktop_cache},
|
||||
xdg,
|
||||
},
|
||||
widgets::{Geometry, Widget},
|
||||
};
|
||||
|
||||
use fuzzy_matcher::skim::SkimMatcherV2;
|
||||
use fuzzy_matcher::FuzzyMatcher;
|
||||
use fuzzy_matcher::skim::SkimMatcherV2;
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use wayland_client::{protocol::wl_keyboard, WEnum};
|
||||
use wayland_client::{WEnum, protocol::wl_keyboard};
|
||||
|
||||
struct Matcher {
|
||||
matches: HashMap<Desktop, i64>,
|
||||
@@ -692,11 +692,7 @@ impl Interface {
|
||||
if line_height == 0 {
|
||||
return;
|
||||
}
|
||||
let height = self
|
||||
.inner
|
||||
.geometry
|
||||
.height
|
||||
.saturating_sub(line_height + 8);
|
||||
let height = self.inner.geometry.height.saturating_sub(line_height + 8);
|
||||
let lines = height / line_height;
|
||||
|
||||
let offset = height % line_height;
|
||||
@@ -847,7 +843,7 @@ impl Widget for Interface {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{strip_field_codes, Prompt, PromptMode};
|
||||
use super::{Prompt, PromptMode, strip_field_codes};
|
||||
|
||||
#[test]
|
||||
fn prompt_cursor_is_grapheme_based() {
|
||||
|
||||
@@ -113,7 +113,7 @@ impl Layout for VerticalLayout {
|
||||
|
||||
pub trait WidgetUpdater {
|
||||
fn geometry_update(&mut self, idx: usize, fonts: &mut FontMap, geometry: &Geometry)
|
||||
-> Geometry;
|
||||
-> Geometry;
|
||||
fn minimum_size(&mut self, idx: usize, fonts: &mut FontMap) -> Geometry;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ fn monitor(
|
||||
use libpulse_binding::{
|
||||
callbacks::ListResult,
|
||||
context::{
|
||||
subscribe::{Facility, InterestMaskSet},
|
||||
Context, FlagSet, State,
|
||||
subscribe::{Facility, InterestMaskSet},
|
||||
},
|
||||
mainloop::{
|
||||
self, api::Mainloop, events::io::FlagSet as IoFlagSet, standard::IterateResult,
|
||||
},
|
||||
proplist::{properties, Proplist},
|
||||
proplist::{Proplist, properties},
|
||||
volume::Volume,
|
||||
};
|
||||
|
||||
@@ -50,14 +50,14 @@ fn monitor(
|
||||
loop {
|
||||
match mainloop.iterate(true) {
|
||||
IterateResult::Quit(_) | IterateResult::Err(_) => {
|
||||
return Err("pulseaudio mainloop quit while connecting".into())
|
||||
return Err("pulseaudio mainloop quit while connecting".into());
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
match context.borrow().get_state() {
|
||||
State::Ready => break,
|
||||
State::Failed | State::Terminated => {
|
||||
return Err("could not connect to pulseaudio".into())
|
||||
return Err("could not connect to pulseaudio".into());
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
@@ -88,6 +88,9 @@ mod tests {
|
||||
assert_eq!(e.x + e.width, 15);
|
||||
assert_eq!(e.y + e.height, 102);
|
||||
let e2 = b.expand(a);
|
||||
assert_eq!((e2.x, e2.y, e2.width, e2.height), (e.x, e.y, e.width, e.height));
|
||||
assert_eq!(
|
||||
(e2.x, e2.y, e2.width, e2.height),
|
||||
(e.x, e.y, e.width, e.height)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user