aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ya/yambar-modules/src
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-05-30 18:13:20 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-05-30 18:13:20 +0200
commit2783d1b3f76dfae4232cea35308481b544c24db9 (patch)
tree15a7bfc25f75c55de6dd4d7618eb34d34e02ef3f /pkgs/by-name/ya/yambar-modules/src
parentmodules/i3status-rust: Use correct `cfg` value (diff)
downloadnixos-config-2783d1b3f76dfae4232cea35308481b544c24db9.zip
pkgs/yambar-modules: Drop
I migrated away from yambar, and i3status-rust provides a batter alternative for these anyways.
Diffstat (limited to 'pkgs/by-name/ya/yambar-modules/src')
-rw-r--r--pkgs/by-name/ya/yambar-modules/src/cpu.rs31
-rw-r--r--pkgs/by-name/ya/yambar-modules/src/main.rs36
-rw-r--r--pkgs/by-name/ya/yambar-modules/src/memory.rs39
3 files changed, 0 insertions, 106 deletions
diff --git a/pkgs/by-name/ya/yambar-modules/src/cpu.rs b/pkgs/by-name/ya/yambar-modules/src/cpu.rs
deleted file mode 100644
index f53107a8..00000000
--- a/pkgs/by-name/ya/yambar-modules/src/cpu.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// nixos-config - My current NixOS configuration
-//
-// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
-// SPDX-License-Identifier: GPL-3.0-or-later
-//
-// This file is part of my nixos-config.
-//
-// You should have received a copy of the License along with this program.
-// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-
-use std::{thread, time::Duration};
-
-use sysinfo::{CpuExt, System, SystemExt};
-
-pub fn cpu() {
- let mut sys = System::new();
-
- loop {
- sys.refresh_cpu();
- let cpu_usage: f32 = sys.cpus().iter().map(|cpu| cpu.cpu_usage()).sum();
- println!(
- "cpu|range:0-100|{:.0}",
- cpu_usage / sys.cpus().iter().count() as f32
- );
- println!();
-
- // Sleeping to give the system time to run for long
- // enough to have useful information.
- thread::sleep(Duration::from_secs(3));
- }
-}
diff --git a/pkgs/by-name/ya/yambar-modules/src/main.rs b/pkgs/by-name/ya/yambar-modules/src/main.rs
deleted file mode 100644
index 03bafadf..00000000
--- a/pkgs/by-name/ya/yambar-modules/src/main.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// nixos-config - My current NixOS configuration
-//
-// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
-// SPDX-License-Identifier: GPL-3.0-or-later
-//
-// This file is part of my nixos-config.
-//
-// You should have received a copy of the License along with this program.
-// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-
-use std::{env::args, process};
-
-mod cpu;
-mod memory;
-
-fn main() {
- let args: Vec<String> = args().collect();
-
- if args.len() != 2 {
- eprintln!("Usage: yambar-modules cpu|memory");
- process::exit(1);
- }
-
- match args[1].as_str() {
- "cpu" => {
- cpu::cpu();
- }
- "memory" => {
- memory::memory();
- }
- other => {
- eprintln!("'{other}' is not a valid command. Only 'cpu' or 'memory'.");
- process::exit(1);
- }
- }
-}
diff --git a/pkgs/by-name/ya/yambar-modules/src/memory.rs b/pkgs/by-name/ya/yambar-modules/src/memory.rs
deleted file mode 100644
index 7c2c4669..00000000
--- a/pkgs/by-name/ya/yambar-modules/src/memory.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// nixos-config - My current NixOS configuration
-//
-// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
-// SPDX-License-Identifier: GPL-3.0-or-later
-//
-// This file is part of my nixos-config.
-//
-// You should have received a copy of the License along with this program.
-// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-
-use std::{thread, time::Duration};
-
-use sysinfo::{System, SystemExt};
-
-pub fn memory() {
- let mut sys = System::new();
-
- loop {
- sys.refresh_memory();
-
- let memory_percentage: f64 =
- 100 as f64 * (sys.used_memory() as f64 / sys.total_memory() as f64);
-
- println!("memperc|string|{:.0}", memory_percentage);
- if sys.total_swap() > 0 {
- let swap_percentage: f64 =
- 100 as f64 * (sys.used_swap() as f64 / sys.total_swap() as f64);
- println!("swapperc|string|{:.0}", swap_percentage);
- println!("swapstate|bool|true");
- } else {
- println!("swapstate|bool|false");
- }
- println!("");
-
- // Sleeping to give the system time to run for long
- // enough to have useful information.
- thread::sleep(Duration::from_secs(3));
- }
-}