system settings
git clone https://git.lucas.co/cce-system-interface.git
Rename project to cce-system-settings and add Force Shutdown action
Cargo.toml | 4 ++--
Makefile | 2 +-
src/main.rs | 2 +-
src/pages/notifications.rs | 2 +-
src/pages/system_info.rs | 17 +++++++++++++++++
5 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index aacea48..7f0a033 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "cce-settings"
+name = "cce-system-settings"
version = "0.1.0"
edition = "2021"
@@ -32,4 +32,4 @@ path = "src/lib.rs"
[[bin]]
path = "src/main.rs"
-name = "cce-settings"
+name = "cce-system-settings"
diff --git a/Makefile b/Makefile
index a9efa49..a046f21 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ build:
install: build
mkdir -p ~/.local/bin
- install -m 755 ../target/release/cce-settings ~/.local/bin/cce-settings
+ install -m 755 ../target/release/cce-system-settings ~/.local/bin/cce-system-settings
run:
cargo run
diff --git a/src/main.rs b/src/main.rs
index 41208a1..5b065de 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -336,7 +336,7 @@ impl cce_ui::engine::Application for SystemInterface {
fn settings(&self) -> cce_ui::engine::WindowSettings {
cce_ui::engine::WindowSettings {
title: "CCE System Settings".to_string(),
- app_id: "cce-settings".to_string(),
+ app_id: "cce-system-settings".to_string(),
width: 820,
height: 680,
fullscreen: false,
diff --git a/src/pages/notifications.rs b/src/pages/notifications.rs
index a87d7c7..9c75266 100644
--- a/src/pages/notifications.rs
+++ b/src/pages/notifications.rs
@@ -87,7 +87,7 @@ pub fn update(state: &mut NotificationsState, msg: NotificationsMessage) {
Some("org.freedesktop.Notifications"),
"Notify",
&(
- "cce-settings",
+ "cce-system-settings",
0u32,
"",
"Test Notification",
diff --git a/src/pages/system_info.rs b/src/pages/system_info.rs
index 10b0b3e..4f54a72 100644
--- a/src/pages/system_info.rs
+++ b/src/pages/system_info.rs
@@ -90,6 +90,7 @@ pub enum SystemMessage {
Hibernate,
Reboot,
PowerOff,
+ ForceShutdown,
// Moved variants
SetCpuPerformance,
@@ -267,6 +268,14 @@ fn spawn_systemctl(action: &str) {
let _ = cce_ui::process::spawn_detached(cmd);
}
+fn spawn_systemctl_force(action: &str) {
+ let mut cmd = std::process::Command::new("systemctl");
+ cmd.arg(action);
+ cmd.arg("-f");
+ cmd.arg("-f");
+ let _ = cce_ui::process::spawn_detached(cmd);
+}
+
pub async fn fetch_system_state() -> SystemState {
let hostname = tokio::process::Command::new("hostname")
.output().await.ok()
@@ -448,6 +457,13 @@ pub fn view(state: &mut SystemState, cx: f32, cy: f32, cw: f32, ch: f32, _root_f
_ => {}
}
}
+
+ let yt2 = yt + act_btn_h + 8.0;
+ let cols2 = sec.row_layout(1, 0.0);
+ if let Some(&(x, w)) = cols2.first() {
+ sec.button("Force Shutdown", x, yt2, w, act_btn_h,
+ DANGER_BG, BTN_HOVER, WHITE, AppAction::SystemInfo(SystemMessage::ForceShutdown));
+ }
});
// ── 3. CPU Section ──
@@ -616,6 +632,7 @@ pub fn update(state: &mut SystemState, msg: SystemMessage) {
SystemMessage::Hibernate => spawn_systemctl("hibernate"),
SystemMessage::Reboot => spawn_systemctl("reboot"),
SystemMessage::PowerOff => spawn_systemctl("poweroff"),
+ SystemMessage::ForceShutdown => spawn_systemctl_force("poweroff"),
SystemMessage::SetCpuPerformance => {
state.cpu_powersave = false;