From 6e83884c0aacef5f2b2941668d42568649646e21 Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Mon, 19 Jan 2026 02:02:37 +0100 Subject: [PATCH] feat: GUI rework --- rog-control-center/src/ui/mod.rs | 5 +- rog-control-center/ui/main_window.slint | 32 +++++-- rog-control-center/ui/pages/gpu.slint | 102 +++++++++++++++++++++++ rog-control-center/ui/pages/system.slint | 98 +++++++++++++--------- 4 files changed, 190 insertions(+), 47 deletions(-) create mode 100644 rog-control-center/ui/pages/gpu.slint diff --git a/rog-control-center/src/ui/mod.rs b/rog-control-center/src/ui/mod.rs index ac1122f0..ae73dced 100644 --- a/rog-control-center/src/ui/mod.rs +++ b/rog-control-center/src/ui/mod.rs @@ -102,8 +102,9 @@ pub fn setup_window(config: Arc>) -> MainWindow { available.contains(&"xyz.ljones.Aura".to_string()), available.contains(&"xyz.ljones.Anime".to_string()), available.contains(&"xyz.ljones.FanCurves".to_string()), - true, - true, + true, // GPU Configuration + true, // App Settings + true, // About ] .into(), ); diff --git a/rog-control-center/ui/main_window.slint b/rog-control-center/ui/main_window.slint index 01b635df..235afc9e 100644 --- a/rog-control-center/ui/main_window.slint +++ b/rog-control-center/ui/main_window.slint @@ -7,6 +7,7 @@ import { PageFans } from "pages/fans.slint"; import { PageAnime, AnimePageData } from "pages/anime.slint"; import { RogItem } from "widgets/common.slint"; import { PageAura } from "pages/aura.slint"; +import { PageGPU } from "pages/gpu.slint"; import { Node } from "widgets/graph.slint"; export { Node } import { FanPageData, FanType, Profile } from "types/fan_types.slint"; @@ -24,7 +25,15 @@ export component MainWindow inherits Window { default-font-size: 14px; default-font-weight: 400; icon: @image-url("../data/rog-control-center.png"); - in property <[bool]> sidebar_items_avilable: [true, true, true, true, true, true]; + in property <[bool]> sidebar_items_avilable: [ + true, + true, + true, + true, + true, // GPU Configuration + true, // App Settings + true, // About + ]; private property show_notif; private property fade_cover; private property toast: false; @@ -58,8 +67,9 @@ export component MainWindow inherits Window { @tr("Menu2" => "Keyboard Aura"), @tr("Menu3" => "AniMe Matrix"), @tr("Menu4" => "Fan Curves"), - @tr("Menu5" => "App Settings"), - @tr("Menu6" => "About"), + @tr("Menu5" => "GPU Configuration"), + @tr("Menu6" => "App Settings"), + @tr("Menu7" => "About"), ]; available: root.sidebar_items_avilable; } @@ -89,26 +99,34 @@ export component MainWindow inherits Window { height: root.height + 12px; } - aura := PageAura { + /*if(side-bar.current-item == 1):*/ aura := PageAura { width: root.width - side-bar.width; visible: side-bar.current-item == 1; } if(side-bar.current-item == 2): PageAnime { width: root.width - side-bar.width; + visible: side-bar.current-item == 2; } - fans := PageFans { + if(side-bar.current-item == 3): fans := PageFans { width: root.width - side-bar.width; visible: side-bar.current-item == 3; } - if(side-bar.current-item == 4): PageAppSettings { + if(side-bar.current-item == 4): PageGPU { width: root.width - side-bar.width; + visible: side-bar.current-item == 4; } - if(side-bar.current-item == 5): PageAbout { + if(side-bar.current-item == 5): PageAppSettings { width: root.width - side-bar.width; + visible: side-bar.current-item == 5; + } + + if(side-bar.current-item == 6): PageAbout { + width: root.width - side-bar.width; + visible: side-bar.current-item == 6; } if toast: Rectangle { diff --git a/rog-control-center/ui/pages/gpu.slint b/rog-control-center/ui/pages/gpu.slint new file mode 100644 index 00000000..6ed13a45 --- /dev/null +++ b/rog-control-center/ui/pages/gpu.slint @@ -0,0 +1,102 @@ +import { Palette, TabWidget, Button, CheckBox } from "std-widgets.slint"; +import { Graph, Node } from "../widgets/graph.slint"; +import { SystemToggle } from "../widgets/common.slint"; +import { Profile, FanType, FanPageData } from "../types/fan_types.slint"; +import { Palette, HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switch, ComboBox, GroupBox, StandardButton} from "std-widgets.slint"; + +export global GPUPageData { + // GPU mode and device state + in-out property gpu_mux_mode: 1; // 0 = Ultra/Discreet, 1 = Integrated/Optimus + in-out property dgpu_disabled: 0; // 1 == dGPU disabled + in-out property egpu_enabled: 0; // 1 == eGPU (XGMobile) enabled + callback cb_gpu_mux_mode(int); + callback cb_dgpu_disabled(int); + callback cb_egpu_enabled(int); +} + +export component PageGPU inherits Rectangle { + + clip: true; + ScrollView { + VerticalLayout { + padding: 10px; + spacing: 10px; + alignment: LayoutAlignment.start; + Rectangle { + background: Palette.alternate-background; + border-color: Palette.accent-background; + border-width: 3px; + border-radius: 10px; + height: 40px; + Text { + font-size: 18px; + color: Palette.control-foreground; + horizontal-alignment: TextHorizontalAlignment.center; + text: @tr("GPU Configuration"); + } + } + } + + GroupBox { + HorizontalLayout { + spacing: 10px; + + // Ultra (discreet) mode button - disabled if dGPU is marked disabled + Rectangle { + width: 120px; + height: 36px; + border-radius: 6px; + border-color: Palette.border; + border-width: 2px; + background: GPUPageData.gpu_mux_mode == 0 ? Palette.accent-background : Palette.control-background; + opacity: GPUPageData.dgpu_disabled == 1 ? 0.5 : 1.0; + + Text { + color: Palette.control-foreground; + horizontal-alignment: TextHorizontalAlignment.center; + vertical-alignment: TextVerticalAlignment.center; + text: @tr("Ultra"); + } + + TouchArea { + width: 100%; + height: 100%; + clicked => { + if (GPUPageData.dgpu_disabled != 1 && GPUPageData.gpu_mux_mode != 0) { + GPUPageData.cb_gpu_mux_mode(0); + } + } + } + } + + // Integrated (Optimus) mode button + Rectangle { + width: 120px; + height: 36px; + border-radius: 6px; + border-color: Palette.border; + border-width: 2px; + background: GPUPageData.gpu_mux_mode == 1 ? Palette.accent-background : Palette.control-background; + + Text { + color: Palette.control-foreground; + horizontal-alignment: TextHorizontalAlignment.center; + vertical-alignment: TextVerticalAlignment.center; + text: @tr("Integrated"); + } + + TouchArea { + width: 100%; + height: 100%; + clicked => { + if (GPUPageData.gpu_mux_mode != 1) { + GPUPageData.cb_gpu_mux_mode(1); + } + } + } + } + } + } + + } +} \ No newline at end of file diff --git a/rog-control-center/ui/pages/system.slint b/rog-control-center/ui/pages/system.slint index 1e8a43d2..b2e91537 100644 --- a/rog-control-center/ui/pages/system.slint +++ b/rog-control-center/ui/pages/system.slint @@ -253,6 +253,66 @@ export component PageSystem inherits Rectangle { } } + if SystemPageData.kbd_leds_awake != -1 || + SystemPageData.kbd_leds_sleep != -1 || + SystemPageData.kbd_leds_boot != -1 || + SystemPageData.kbd_leds_shutdown != -1: VerticalLayout { + padding: 0px; + spacing: 0px; + alignment: LayoutAlignment.start; + Rectangle { + background: Palette.alternate-background; + border-color: Palette.accent-background; + border-width: 3px; + border-radius: 10px; + height: 40px; + Text { + font-size: 18px; + color: Palette.control-foreground; + horizontal-alignment: TextHorizontalAlignment.center; + text: @tr("Keyboard Power Management"); + } + } + + GroupBox { + + HorizontalLayout { + spacing: 10px; + if SystemPageData.kbd_leds_awake != -1: SystemToggleInt { + text: @tr("Keyboard Awake Effect"); + checked_int <=> SystemPageData.kbd_leds_awake; + toggled => { + SystemPageData.cb_kbd_leds_awake(SystemPageData.kbd_leds_awake) + } + } + + if SystemPageData.kbd_leds_sleep != -1: SystemToggleInt { + text: @tr("Keyboard Sleep Effect"); + checked_int <=> SystemPageData.kbd_leds_sleep; + toggled => { + SystemPageData.cb_kbd_leds_sleep(SystemPageData.kbd_leds_sleep) + } + } + + if SystemPageData.kbd_leds_boot != -1: SystemToggleInt { + text: @tr("Keyboard Boot Effect"); + checked_int <=> SystemPageData.kbd_leds_boot; + toggled => { + SystemPageData.cb_kbd_leds_boot(SystemPageData.kbd_leds_boot) + } + } + + if SystemPageData.kbd_leds_shutdown != -1: SystemToggleInt { + text: @tr("Keyboard Shutdown Effect"); + checked_int <=> SystemPageData.kbd_leds_shutdown; + toggled => { + SystemPageData.cb_kbd_leds_shutdown(SystemPageData.kbd_leds_shutdown) + } + } + } + } + } + Rectangle { background: Palette.alternate-background; border-color: Palette.accent-background; @@ -286,44 +346,6 @@ export component PageSystem inherits Rectangle { } } - GroupBox { - title: @tr("Keyboard Power Management"); - HorizontalLayout { - spacing: 10px; - if SystemPageData.kbd_leds_awake != -1: SystemToggleInt { - text: @tr("Keyboard Awake Effect"); - checked_int <=> SystemPageData.kbd_leds_awake; - toggled => { - SystemPageData.cb_kbd_leds_awake(SystemPageData.kbd_leds_awake) - } - } - - if SystemPageData.kbd_leds_sleep != -1: SystemToggleInt { - text: @tr("Keyboard Sleep Effect"); - checked_int <=> SystemPageData.kbd_leds_sleep; - toggled => { - SystemPageData.cb_kbd_leds_sleep(SystemPageData.kbd_leds_sleep) - } - } - - if SystemPageData.kbd_leds_boot != -1: SystemToggleInt { - text: @tr("Keyboard Boot Effect"); - checked_int <=> SystemPageData.kbd_leds_boot; - toggled => { - SystemPageData.cb_kbd_leds_boot(SystemPageData.kbd_leds_boot) - } - } - - if SystemPageData.kbd_leds_shutdown != -1: SystemToggleInt { - text: @tr("Keyboard Shutdown Effect"); - checked_int <=> SystemPageData.kbd_leds_shutdown; - toggled => { - SystemPageData.cb_kbd_leds_shutdown(SystemPageData.kbd_leds_shutdown) - } - } - } - } - HorizontalBox { padding: 0px; spacing: 10px;