Skip to content

Commit

Permalink
also clean bin(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Tricoire committed Apr 14, 2024
1 parent 5e97cf6 commit b4614b0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bin/acpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main() -> Result<()> {
let (output, _) = local_block_on(async {
let mut acpi = netlink_acpi_listen().await?;
while let Some(event) = acpi.recv().await {
let line = format!("{}", serde_json::to_string(&event)?);
let line = serde_json::to_string(&event)?;

// flush output each time to facilitate common usage patterns, such as
// `i3stat-acpi | while read x; do ... done`, etc.
Expand Down
30 changes: 16 additions & 14 deletions bin/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ fn main() -> Result<()> {
match theme.pointer_mut(&pointer) {
Some(value) => {
let trimmed = json_value.trim();
let new_value = match serde_json::from_str::<Value>(&trimmed) {
let new_value = match serde_json::from_str::<Value>(trimmed) {
// passed a direct JSON value
Ok(value) => Ok(value),
// assume string if it doesn't definitely look like some JSON value
Err(_) if !trimmed.starts_with(&['[', '{', '\'', '"']) => {
Err(_) if !trimmed.starts_with(['[', '{', '\'', '"']) => {
Ok(Value::String(trimmed.into()))
}
// pass through any other error
Expand Down Expand Up @@ -273,18 +273,20 @@ fn main() -> Result<()> {
width,
height,
} => {
let mut click = I3ClickEvent::default();
click.button = button.0;
click.instance = Some(target.clone());
click.modifiers = modifiers.into_iter().map(|m| m.0).collect();
x.map(|x| click.x = x);
y.map(|y| click.y = y);
relative_x.map(|relative_x| click.relative_x = relative_x);
relative_y.map(|relative_y| click.relative_y = relative_y);
output_x.map(|output_x| click.output_x = output_x);
output_y.map(|output_y| click.output_y = output_y);
width.map(|width| click.width = width);
height.map(|height| click.height = height);
let click = I3ClickEvent {
name: None,
button: button.0,
instance: Some(target.clone()),
modifiers: modifiers.into_iter().map(|m| m.0).collect(),
x: x.unwrap_or_default(),
y: y.unwrap_or_default(),
relative_x: relative_x.unwrap_or_default(),
relative_y: relative_y.unwrap_or_default(),
output_x: output_x.unwrap_or_default(),
output_y: output_y.unwrap_or_default(),
width: width.unwrap_or_default(),
height: height.unwrap_or_default(),
};

let event = IpcBarEvent::Click(click);
send_and_print_response(
Expand Down
2 changes: 1 addition & 1 deletion bin/sensors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() {

let sys = System::new_with_specifics(RefreshKind::new().with_components_list());
sys.components()
.into_iter()
.iter()
.for_each(|c| println!("{:>width$.2}°C:{}", c.temperature(), c.label(), width = 6));
}

Expand Down

0 comments on commit b4614b0

Please sign in to comment.