Skip to content

Commit d60ad2f

Browse files
committed
feat(tb): resource usage plugins
1 parent 5fe0158 commit d60ad2f

File tree

86 files changed

+3688
-1786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+3688
-1786
lines changed

Cargo.lock

Lines changed: 18 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ seelen-core = { path = "libs/core" }
6969
slu-ipc = { path = "libs/slu-ipc" }
7070
slu-utils = { path = "libs/utils" }
7171
positioning = { path = "libs/positioning" }
72-
sysinfo = "0.30.13"
72+
sysinfo = "0.38.0"
7373
tauri = "2.10.1"
7474
tauri-build = "2.5.4"
7575
tauri-plugin-autostart = "2.5.1"

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- extended wallpapers across all monitors.
1515
- new start menu widget.
1616
- customizable flyouts (volume, brightness, workspaces, notification, etc)
17+
- resources usage plugins for toolbar.
1718

1819
### enhancements
1920

libs/core/src/handlers/commands.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ slu_commands_declaration! {
256256
GetRadios = get_radios() -> Vec<RadioDevice>,
257257
SetRadioState = set_radios_state(kind: RadioDeviceKind, enabled: bool),
258258

259+
// System Info
260+
GetSystemDisks = get_system_disks() -> Vec<Disk>,
261+
GetSystemNetwork = get_system_network() -> Vec<NetworkStatistics>,
262+
GetSystemMemory = get_system_memory() -> Memory,
263+
GetSystemCores = get_system_cores() -> Vec<Core>,
264+
259265
// Bluetooth
260266
GetBluetoothDevices = get_bluetooth_devices() -> Vec<BluetoothDevice>,
261267
StartBluetoothScanning = start_bluetooth_scanning(),

libs/core/src/handlers/commands.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export enum SeelenCommand {
109109
ActivateNotification = "activate_notification",
110110
GetRadios = "get_radios",
111111
SetRadioState = "set_radios_state",
112+
GetSystemDisks = "get_system_disks",
113+
GetSystemNetwork = "get_system_network",
114+
GetSystemMemory = "get_system_memory",
115+
GetSystemCores = "get_system_cores",
112116
GetBluetoothDevices = "get_bluetooth_devices",
113117
StartBluetoothScanning = "start_bluetooth_scanning",
114118
StopBluetoothScanning = "stop_bluetooth_scanning",

libs/core/src/handlers/events.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ slu_events_declaration! {
102102
// Radios
103103
RadiosChanged(Vec<RadioDevice>) as "radio::changed",
104104

105+
// System Info
106+
SystemDisksChanged(Vec<Disk>) as "system::disks-changed",
107+
SystemNetworkChanged(Vec<NetworkStatistics>) as "system::network-changed",
108+
SystemMemoryChanged(Memory) as "system::memory-changed",
109+
SystemCoresChanged(Vec<Core>) as "system::cores-changed",
110+
105111
BluetoothDevicesChanged(Vec<BluetoothDevice>) as "bluetooth-devices-changed",
106112

107113
// Start Menu

libs/core/src/handlers/events.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export enum SeelenEvent {
4040
StatePerformanceModeChanged = "state::performance-mode-changed",
4141
WidgetTriggered = "widget::triggered",
4242
RadiosChanged = "radio::changed",
43+
SystemDisksChanged = "system::disks-changed",
44+
SystemNetworkChanged = "system::network-changed",
45+
SystemMemoryChanged = "system::memory-changed",
46+
SystemCoresChanged = "system::cores-changed",
4347
BluetoothDevicesChanged = "bluetooth-devices-changed",
4448
StartMenuItemsChanged = "start-menu::items-changed",
4549
}

libs/core/src/state/placeholder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ pub enum ToolbarJsScope {
2020
Power,
2121
FocusedApp,
2222
Workspaces,
23+
Disk,
24+
NetworkStatistics,
25+
Memory,
26+
Cpu,
2327
}
2428

2529
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema, TS)]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
use std::path::PathBuf;
2+
3+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
4+
#[cfg_attr(feature = "gen-binds", ts(export))]
5+
#[serde(rename_all = "camelCase")]
6+
pub struct Disk {
7+
pub name: String,
8+
pub file_system: String,
9+
pub total_space: u64,
10+
pub available_space: u64,
11+
pub mount_point: PathBuf,
12+
pub is_removable: bool,
13+
pub read_bytes: u64,
14+
pub written_bytes: u64,
15+
}
16+
17+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
18+
#[cfg_attr(feature = "gen-binds", ts(export))]
19+
#[serde(rename_all = "camelCase")]
20+
pub struct NetworkStatistics {
21+
pub name: String,
22+
pub received: u64,
23+
pub transmitted: u64,
24+
pub packets_received: u64,
25+
pub packets_transmitted: u64,
26+
}
27+
28+
#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)]
29+
#[cfg_attr(feature = "gen-binds", ts(export))]
30+
#[serde(rename_all = "camelCase")]
31+
pub struct Memory {
32+
pub total: u64,
33+
pub free: u64,
34+
pub swap_total: u64,
35+
pub swap_free: u64,
36+
}
37+
38+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
39+
#[cfg_attr(feature = "gen-binds", ts(export))]
40+
#[serde(rename_all = "camelCase")]
41+
pub struct Core {
42+
pub name: String,
43+
pub brand: String,
44+
pub usage: f32,
45+
pub frequency: u64,
46+
}

libs/core/src/system_state/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mod bluetooth;
2+
mod components;
23
mod language;
34
mod media;
45
mod monitors;
@@ -13,6 +14,7 @@ mod user_apps;
1314
mod win_explorer;
1415

1516
pub use bluetooth::*;
17+
pub use components::*;
1618
pub use language::*;
1719
pub use media::*;
1820
pub use monitors::*;

0 commit comments

Comments
 (0)