From 8c089345ed1dc926a04abcf3abc8f547cac9ad41 Mon Sep 17 00:00:00 2001 From: Sandeep Bist Date: Sat, 17 Oct 2026 21:06:07 +0530 Subject: [PATCH] feat(controls): simplify footer and compact performance rows --- modules/island/ControlCenter.qml | 54 ++++--- modules/island/PerformanceMenu.qml | 147 +++++++++++-------- modules/settings/SettingsCatalog.js | 2 +- scripts/luma/actions.py | 2 +- services/ControlLayout.qml | 3 +- services/DesktopActions.qml | 2 +- services/Preferences.qml | 5 +- setup/state/modesty/preferences.json | 3 - tests/check.py | 1 + tests/control-center-ui.py | 203 +++++++++++++++++++++++++++ tests/notes-ui.py | 2 +- tests/settings.py | 2 +- 12 files changed, 334 insertions(+), 92 deletions(-) create mode 100644 tests/control-center-ui.py diff --git a/modules/island/ControlCenter.qml b/modules/island/ControlCenter.qml index 7dea726..3bd9cb8 100644 --- a/modules/island/ControlCenter.qml +++ b/modules/island/ControlCenter.qml @@ -1,5 +1,6 @@ import QtQuick import QtQuick.Effects +import QtQuick.Layouts import Quickshell.Widgets import qs.components import qs.services @@ -53,34 +54,55 @@ Item { } } Item { - id:footer;z:11 + id:footer;objectName:"controlFooter";z:11 opacity:!root.modal&&ControlLayout.footerShown&&root.apertureHeight>=root.overviewHeight+Preferences.innerPadding*2-2?1:0 visible:opacity>0;enabled:!root.modal&&opacity>.7 Behavior on opacity {NumberAnimation {duration:Tokens.animFast;easing.type:Easing.OutCubic}} readonly property bool showTray:Preferences.footerVisible&&Preferences.footerTray&&Tray.items.length>0 - readonly property real dividerWidth:showTray&&footerButtons.width>0?21:0 - width:footerButtons.width+dividerWidth+(showTray?footerTray.width:0);height:38 - anchors.horizontalCenter:parent.horizontalCenter;y:root.overviewHeight-height - Row { - id:footerButtons;spacing:10;anchors.verticalCenter:parent.verticalCenter - IconButton {visible:ControlLayout.notesEntryShown;icon:"edit_note";label:"Quick Notes";size:19;implicitWidth:38;implicitHeight:38;color:Theme.accent;onClicked:{Tray.close();IslandState.openMenu("notes");}} + readonly property bool showActions:Preferences.footerVisible&&(Preferences.footerSettings||Preferences.footerPerformance) + readonly property real dividerWidth:showTray&&showActions?13:0 + width:parent.width;height:38 + y:root.overviewHeight-height + Rectangle {width:parent.width;height:1;y:-5;color:Theme.withAlpha(Theme.text,.06)} + RowLayout { + id:footerButtons;spacing:6;anchors.verticalCenter:parent.verticalCenter + width:footer.width-footer.dividerWidth-(footer.showTray?footerTray.width:0) + visible:footer.showActions Repeater { - model:[{key:"footerPerformance",icon:"monitoring",label:"Performance",panel:"performance"},{key:"footerThemes",icon:"palette",label:"Themes",panel:"themes"},{key:"footerWallpapers",icon:"wallpaper",label:"Wallpapers",panel:"wallpapers"},{key:"footerPower",icon:"power_settings_new",label:"Power",panel:"power"},{key:"footerSettings",icon:"settings",label:"Settings",panel:"settings"}] - IconButton { + model:[{key:"footerSettings",icon:"settings",label:"Settings",panel:"settings"},{key:"footerPerformance",icon:"monitoring",label:"Performance",panel:"performance"}] + ActionButton { + id:action required property var modelData - visible:Preferences.footerVisible&&Preferences[modelData.key];icon:modelData.icon;label:modelData.label;size:19 - implicitWidth:38;implicitHeight:38;color:Theme.subtext - background:"transparent" + objectName:modelData.key + visible:Preferences.footerVisible&&Preferences[modelData.key] + Layout.fillWidth:true;Layout.preferredWidth:1;Layout.minimumWidth:0 + implicitHeight:38;text:modelData.label + focusPolicy:Qt.StrongFocus + Accessible.name:text + Keys.onReturnPressed:clicked() + Keys.onEnterPressed:clicked() + contentItem:Item { + Row { + anchors.centerIn:parent;spacing:6 + Icon {icon:action.modelData.icon;size:17;color:Theme.subtext} + PanelText {objectName:action.modelData.key+"Label";text:action.text;width:Math.min(implicitWidth,Math.max(0,action.availableWidth-23));font.pixelSize:11;color:Theme.subtext;anchors.verticalCenter:parent.verticalCenter} + } + } + background:Rectangle { + radius:10 + color:Theme.withAlpha(Theme.text,action.pressed?.1:action.hovered?.055:0) + border.width:action.activeFocus?1:0;border.color:Theme.accent + } onClicked:{Tray.close();IslandState.openMenu(modelData.panel);} } } } - Rectangle {x:footerButtons.width+10;anchors.verticalCenter:parent.verticalCenter;width:1;height:16;visible:footer.dividerWidth>0;color:Theme.withAlpha(Theme.text,.1)} + Rectangle {x:footerButtons.width+6;anchors.verticalCenter:parent.verticalCenter;width:1;height:16;visible:footer.dividerWidth>0;color:Theme.withAlpha(Theme.text,.1)} TrayIcons { - id:footerTray;inFooter:true - maximumWidth:Math.max(0,root.width-footerButtons.width-footer.dividerWidth) + id:footerTray;objectName:"footerTray";inFooter:true + maximumWidth:footer.showActions?Math.max(0,footer.width*.28):footer.width visible:footer.showTray - x:footerButtons.width+footer.dividerWidth;anchors.verticalCenter:parent.verticalCenter + anchors.right:parent.right;anchors.verticalCenter:parent.verticalCenter } } MouseArea {anchors.fill:parent;z:9;visible:Tray.open&&Tray.inFooter;onClicked:Tray.close();hoverEnabled:true;onWheel:event=>event.accepted=true} diff --git a/modules/island/PerformanceMenu.qml b/modules/island/PerformanceMenu.qml index f1acfc8..ab4a575 100644 --- a/modules/island/PerformanceMenu.qml +++ b/modules/island/PerformanceMenu.qml @@ -32,6 +32,7 @@ ColumnLayout { history=next; } Process { + objectName:"performanceCollector" running: IslandState.menu === "performance" && !Preferences.preview && !Session.locked command: ["python3", Qt.resolvedUrl("../../scripts/performance.py").toString().replace("file://", "")] stdout: SplitParser { onRead: line => { @@ -41,101 +42,123 @@ ColumnLayout { } PanelHeader { title:"Performance" - Rectangle {width:5;height:5;radius:2.5;color:Theme.accent;visible:!!root.sample.memoryTotal&&!root.error} + Rectangle {objectName:"performanceLive";width:5;height:5;radius:2.5;color:Theme.accent;visible:!!root.sample.memoryTotal&&!root.error} } Flickable { + id:scroll;objectName:"performanceScroll" Layout.fillWidth:true;Layout.fillHeight:true;Layout.minimumHeight:0;implicitHeight:metrics.implicitHeight;clip:true contentHeight:metrics.implicitHeight;boundsBehavior:Flickable.StopAtBounds + activeFocusOnTab:true + Keys.onPressed:event=>{ + if(event.key===Qt.Key_Down||event.key===Qt.Key_PageDown) contentY=Math.min(Math.max(0,contentHeight-height),contentY+(event.key===Qt.Key_Down?40:height)); + else if(event.key===Qt.Key_Up||event.key===Qt.Key_PageUp) contentY=Math.max(0,contentY-(event.key===Qt.Key_Up?40:height)); + else if(event.key===Qt.Key_Home) contentY=0; + else if(event.key===Qt.Key_End) contentY=Math.max(0,contentHeight-height); + else return; + event.accepted=true; + } ScrollBar.vertical:ScrollBar {} ColumnLayout { - id:metrics;width:parent.width;spacing:12 + id:metrics;width:scroll.width;spacing:10 RowLayout { - Layout.fillWidth:true;spacing:10 + Layout.fillWidth:true;spacing:18 Repeater { model:["CPU","Memory"] - Rectangle { + ColumnLayout { id:summary required property string modelData readonly property var value:modelData==="CPU"?root.sample.cpu:root.sample.memoryUsed/root.sample.memoryTotal - Layout.fillWidth:true;Layout.preferredWidth:1;implicitHeight:116 - radius:18;color:Theme.withAlpha(Theme.text,.035) - border.width:1;border.color:Theme.withAlpha(Theme.text,.045) - Column { - anchors.left:parent.left;anchors.right:parent.right;anchors.top:parent.top;anchors.margins:14;spacing:5 - PanelText {text:summary.modelData==="Memory"?"RAM used":summary.modelData;font.pixelSize:12;color:Theme.subtext} - Row {spacing:3 - PanelText {text:Number.isFinite(summary.value)?Math.round(summary.value*100):"—";font.pixelSize:30;font.weight:Font.Medium;font.letterSpacing:-1;font.features:({tnum:1})} - PanelText {text:"%";font.pixelSize:13;color:Theme.subtext;anchors.baseline:parent.children[0].baseline} - } - PanelText {text:summary.modelData==="Memory"?root.bytes(root.sample.memoryUsed)+" / "+root.bytes(root.sample.memoryTotal):"All cores";font.pixelSize:10;color:Theme.subtext} + Layout.fillWidth:true;Layout.preferredWidth:1;spacing:3 + PanelText {text:summary.modelData==="Memory"?"RAM used":summary.modelData;font.pixelSize:11;color:Theme.subtext} + Row {spacing:3 + PanelText {objectName:summary.modelData+"Percent";text:Number.isFinite(summary.value)?Math.round(summary.value*100):"—";font.pixelSize:28;font.weight:Font.Medium;font.letterSpacing:-1;font.features:({tnum:1})} + PanelText {text:"%";font.pixelSize:13;color:Theme.subtext;anchors.baseline:parent.children[0].baseline} } - MetricTrace {anchors.left:parent.left;anchors.right:parent.right;anchors.bottom:parent.bottom;anchors.margins:10;height:23;values:root.history[summary.modelData==="CPU"?"cpu":"memory"]||[]} + PanelText {objectName:summary.modelData+"Detail";Layout.fillWidth:true;text:summary.modelData==="Memory"?root.bytes(root.sample.memoryUsed)+" / "+root.bytes(root.sample.memoryTotal):"All cores";font.pixelSize:10;color:Theme.subtext} + MetricTrace {objectName:summary.modelData+"History";Layout.fillWidth:true;implicitHeight:18;values:root.history[summary.modelData==="CPU"?"cpu":"memory"]||[]} } } } - Repeater { - model:root.deviceNames - Rectangle { - id:drive - required property string modelData - readonly property var reading:(root.sample.diskIo||[]).find(d=>d.name===modelData)||({}) - Layout.fillWidth:true;implicitHeight:100;radius:18 - color:Theme.withAlpha(Theme.text,.035);border.width:1;border.color:Theme.withAlpha(Theme.text,.045) + ColumnLayout { + Layout.fillWidth:true;spacing:6;visible:root.deviceNames.length>0 + Rectangle {Layout.fillWidth:true;implicitHeight:1;color:Theme.withAlpha(Theme.text,.07)} + PanelText {text:"Disk activity";font.pixelSize:11;color:Theme.subtext} + Repeater { + model:root.deviceNames ColumnLayout { - anchors.fill:parent;anchors.margins:12;spacing:6 - RowLayout {Layout.fillWidth:true - PanelText {text:"Disk";font.pixelSize:13;font.weight:Font.Medium} - PanelText {Layout.fillWidth:true;text:drive.modelData;font.pixelSize:10;color:Theme.subtext} - PanelText {text:drive.reading.busy==null?"—":Math.round(drive.reading.busy*100)+"% active";font.pixelSize:11;color:Theme.subtext;font.features:({tnum:1})} + id:drive + required property string modelData + objectName:"drive-"+modelData + readonly property var reading:(root.sample.diskIo||[]).find(d=>d.name===modelData)||({}) + Layout.fillWidth:true;spacing:3 + RowLayout {Layout.fillWidth:true;spacing:8 + PanelText { + objectName:"driveName-"+drive.modelData;Layout.fillWidth:true;text:drive.modelData;font.pixelSize:12;font.weight:Font.Medium + HoverHandler {id:driveHover} + ToolTip.visible:driveHover.hovered;ToolTip.text:text + } + PanelText {objectName:"driveBusy-"+drive.modelData;text:drive.reading.busy==null?"—":Math.round(drive.reading.busy*100)+"% active";font.pixelSize:11;color:Theme.subtext;font.features:({tnum:1})} } - RowLayout {Layout.fillWidth:true;spacing:14 + RowLayout {Layout.fillWidth:true;spacing:10 Repeater {model:["read","write"] - Column {required property string modelData;Layout.fillWidth:true;Layout.preferredWidth:1;spacing:4 + RowLayout { + required property string modelData + Layout.fillWidth:true;Layout.preferredWidth:1;spacing:5 PanelText {text:modelData==="read"?"Read":"Write";font.pixelSize:10;color:Theme.subtext} - PanelText {width:parent.width;text:root.bytes(drive.reading[modelData])+"/s";font.pixelSize:14;font.weight:Font.Medium;font.features:({tnum:1})} + PanelText {objectName:drive.modelData+"-"+modelData;Layout.fillWidth:true;text:root.bytes(drive.reading[modelData])+"/s";font.pixelSize:11;font.features:({tnum:1})} } } } - MetricTrace {Layout.fillWidth:true;Layout.fillHeight:true;Layout.minimumHeight:12;values:root.history[drive.modelData]||[]} + MetricTrace {objectName:"driveHistory-"+drive.modelData;Layout.fillWidth:true;implicitHeight:12;values:root.history[drive.modelData]||[]} } } } - Rectangle { - Layout.fillWidth:true;implicitHeight:116;radius:18 - color:Theme.withAlpha(Theme.text,.035);border.width:1;border.color:Theme.withAlpha(Theme.text,.045) - ColumnLayout {anchors.fill:parent;anchors.margins:14;spacing:10 - PanelText {text:"Network";font.pixelSize:13;font.weight:Font.Medium} - RowLayout {Layout.fillWidth:true;spacing:14 - Repeater {model:["download","upload"] - Column {required property string modelData;Layout.fillWidth:true;Layout.preferredWidth:1;spacing:4 - PanelText {text:modelData==="download"?"↓ Download":"↑ Upload";font.pixelSize:10;color:Theme.subtext} - PanelText {width:parent.width;text:root.bytes(root.sample[modelData])+"/s";font.pixelSize:14;font.weight:Font.Medium;font.features:({tnum:1})} - } + ColumnLayout { + id:network + readonly property real peak:Math.max(1024,...root.history.download,...root.history.upload) + Layout.fillWidth:true;spacing:6 + Rectangle {Layout.fillWidth:true;implicitHeight:1;color:Theme.withAlpha(Theme.text,.07)} + PanelText {text:"Network";font.pixelSize:11;color:Theme.subtext} + RowLayout {Layout.fillWidth:true;spacing:18 + Repeater {model:["download","upload"] + ColumnLayout { + required property string modelData + Layout.fillWidth:true;Layout.preferredWidth:1;spacing:4 + PanelText {text:modelData==="download"?"↓ Download":"↑ Upload";font.pixelSize:10;color:Theme.subtext} + PanelText {objectName:modelData+"Rate";Layout.fillWidth:true;text:root.bytes(root.sample[modelData])+"/s";font.pixelSize:14;font.weight:Font.Medium;font.features:({tnum:1})} + MetricTrace {objectName:modelData+"History";Layout.fillWidth:true;implicitHeight:18;values:root.history[modelData];ceiling:network.peak;stroke:modelData==="download"?Theme.accent:Theme.subtext} } } - Item {Layout.fillWidth:true;Layout.fillHeight:true;Layout.minimumHeight:20 - readonly property real peak:Math.max(1024,...root.history.download,...root.history.upload) - MetricTrace {anchors.fill:parent;values:root.history.download;ceiling:parent.peak} - MetricTrace {anchors.fill:parent;values:root.history.upload;ceiling:parent.peak;stroke:Theme.subtext} - } } } - Repeater { - model:root.diskPaths - ColumnLayout { - required property string modelData - readonly property var disk:(root.sample.disks||[]).find(d=>d.path===modelData)||({used:0,total:1}) - Layout.fillWidth:true;Layout.leftMargin:3;Layout.rightMargin:3;spacing:7 - RowLayout {Layout.fillWidth:true - PanelText {Layout.fillWidth:true;text:modelData==="/"?"System storage":"Home storage";font.pixelSize:11;color:Theme.subtext} - PanelText {text:root.bytes(disk.used)+" / "+root.bytes(disk.total);font.pixelSize:10;color:Theme.subtext} - } - Rectangle {Layout.fillWidth:true;height:3;radius:1.5;color:Theme.withAlpha(Theme.text,.08) - Rectangle {height:3;radius:1.5;width:parent.width*Math.min(1,disk.used/disk.total);color:Theme.withAlpha(Theme.accent,.65)} + ColumnLayout { + Layout.fillWidth:true;spacing:6;visible:root.diskPaths.length>0 + Rectangle {Layout.fillWidth:true;implicitHeight:1;color:Theme.withAlpha(Theme.text,.07)} + PanelText {text:"Storage";font.pixelSize:11;color:Theme.subtext} + Repeater { + model:root.diskPaths + ColumnLayout { + id:storage + required property string modelData + objectName:"storage-"+modelData + readonly property var disk:(root.sample.disks||[]).find(d=>d.path===modelData)||({}) + Layout.fillWidth:true;spacing:3 + RowLayout {Layout.fillWidth:true;spacing:8 + PanelText {Layout.fillWidth:true;text:storage.modelData==="/"?"System storage":"Home storage";font.pixelSize:11} + PanelText {objectName:"storageUsage-"+storage.modelData;text:root.bytes(storage.disk.used)+" / "+root.bytes(storage.disk.total);font.pixelSize:10;color:Theme.subtext;font.features:({tnum:1})} + } + PanelText { + objectName:"storagePath-"+storage.modelData;Layout.fillWidth:true;text:storage.modelData;font.pixelSize:10;color:Theme.subtext + HoverHandler {id:pathHover} + ToolTip.visible:pathHover.hovered;ToolTip.text:text + } + Rectangle {Layout.fillWidth:true;implicitHeight:3;radius:1.5;color:Theme.withAlpha(Theme.text,.08) + Rectangle {objectName:"storageFill-"+storage.modelData;height:3;radius:1.5;width:parent.width*(storage.disk.total>0&&storage.disk.used!=null?Math.max(0,Math.min(1,storage.disk.used/storage.disk.total)):0);color:Theme.withAlpha(Theme.accent,.65)} + } } } } - PanelText {Layout.fillWidth:true;visible:!!root.error;text:root.error;wrapMode:Text.Wrap;color:Theme.subtext;font.pixelSize:12} + PanelText {objectName:"performanceStatus";Layout.fillWidth:true;visible:!!root.error||!root.sample.memoryTotal;text:root.error||"Waiting for metrics…";wrapMode:Text.Wrap;color:Theme.subtext;font.pixelSize:12} } } } diff --git a/modules/settings/SettingsCatalog.js b/modules/settings/SettingsCatalog.js index 93b2090..c18b266 100644 --- a/modules/settings/SettingsCatalog.js +++ b/modules/settings/SettingsCatalog.js @@ -25,7 +25,7 @@ var pages=[ {id:"controls",group:"island",title:"Control center",icon:"tune",blocks:[ block("editor","Tile layout",[],"controls","drag drop resize reorder tiles controls"), block("style","Tile appearance",[slider("controlGap","Space between tiles",4,16,1," px"),slider("controlRadius","Corner radius",8,24,1," px"),slider("controlIconSize","Icon size",18,30,1," px"),slider("sliderThickness","Slider thickness",4,14,1," px")]), - block("footer","Footer & tray",[toggle("footerVisible","Show footer"),toggle("footerTray","Application tray"),toggle("footerPerformance","Performance shortcut"),toggle("footerThemes","Themes shortcut"),toggle("footerWallpapers","Wallpaper shortcut"),toggle("footerPower","Power shortcut"),toggle("footerSettings","Settings shortcut"),slider("trayIconSize","Tray icon size",16,24,1," px"),slider("traySpacing","Tray icon spacing",0,12,1," px")])]}, + block("footer","Footer & tray",[toggle("footerVisible","Show footer"),toggle("footerTray","Application tray"),toggle("footerPerformance","Performance shortcut"),toggle("footerSettings","Settings shortcut"),slider("trayIconSize","Tray icon size",16,24,1," px"),slider("traySpacing","Tray icon spacing",0,12,1," px")])]}, {id:"appearance",group:"personal",title:"Colors & typography",icon:"palette",blocks:[ block("interface","Interface",[choice("themeMode","Color mode",[{value:"light",label:"Light"},{value:"dark",label:"Dark"}],{service:"Theme"}),choice("fontFamily","Interface font",fonts),slider("uiScale","Interface scale",.85,1.25,.05,"×"),toggle("crispText","Precise text rendering"),toggle("shadows","Soft shadows"),action("themes","Choose theme")]), block("palette","Wallpaper palette",[toggle("wallpaperColors","Colors from wallpaper"),toggle("matugenAutomatic","Automatic palette","Faithful wallpaper tones with balanced contrast."),choice("matugenScheme","Color scheme",["tonal-spot","content","expressive","fidelity","fruit-salad","monochrome","neutral","rainbow","vibrant","smart"].map(s=>({value:"scheme-"+s,label:s.replace(/-/g," ")})),{when:"matugenAutomatic",values:[false]}),slider("matugenContrast","Contrast",-1,1,.1,"",{when:"matugenAutomatic",values:[false]}),choice("matugenSource","Source color",[0,1,2,3,4].map(n=>({value:n,label:n?"Color "+(n+1):"Recommended"})),{when:"matugenAutomatic",values:[false]})]), diff --git a/scripts/luma/actions.py b/scripts/luma/actions.py index aab55c2..753b486 100644 --- a/scripts/luma/actions.py +++ b/scripts/luma/actions.py @@ -15,7 +15,7 @@ B = {"type": "BOOLEAN"} REPEAT_SCHEMA = {"type":"OBJECT", "properties":{"kind":{"type":"STRING","enum":["none","daily","weekly","monthly"]},"interval":I,"weekdays":{"type":"ARRAY","items":I},"anchorDay":I}, "required":["kind"]} PREFERENCES = { - **{key: B for key in ("remindersEnabled", "deviceIndicator", "contextDevices", "contextBattery", "compactMissingLyrics", "launcherCalculator", "launcherDescriptions", "matugenAutomatic", "themeGtk", "themeFolders", "themeQt", "themeFoot", "themeSpotify", "footerTray", "footerVisible", "footerThemes", "footerWallpapers", "footerPower", "footerSettings", "recordCursor", "crispText", "liveMedia", "mediaAutoHide", "focusQuiet", "footerPerformance", "mediaVisualizer", "mediaLyrics", "fuzzyApps", "rememberApps", "terminalGreeting", "terminalArtFavoritesOnly", "terminalArtMinimal", "companionEnabled", "companionZen", "companionTerminal", "agentFeedback", "contextWorkspace", "contextVolume", "contextBrightness", "welcomeAtLogin", "contextEvents", "wallpaperColors", "use24Hour", "showSeconds", "showAlbum", "showStatus", "shadows")}, + **{key: B for key in ("remindersEnabled", "deviceIndicator", "contextDevices", "contextBattery", "compactMissingLyrics", "launcherCalculator", "launcherDescriptions", "matugenAutomatic", "themeGtk", "themeFolders", "themeQt", "themeFoot", "themeSpotify", "footerTray", "footerVisible", "footerSettings", "recordCursor", "crispText", "liveMedia", "mediaAutoHide", "focusQuiet", "footerPerformance", "mediaVisualizer", "mediaLyrics", "fuzzyApps", "rememberApps", "terminalGreeting", "terminalArtFavoritesOnly", "terminalArtMinimal", "companionEnabled", "companionZen", "companionTerminal", "agentFeedback", "contextWorkspace", "contextVolume", "contextBrightness", "welcomeAtLogin", "contextEvents", "wallpaperColors", "use24Hour", "showSeconds", "showAlbum", "showStatus", "shadows")}, **{key: {"type":"NUMBER","minimum":low,"maximum":high} for key, low, high in (("focusMinutes",1,120),("breakMinutes",1,60),("recordCountdown",0,5),("matugenContrast",-1,1),("matugenSource",0,4),("wallpaperDuration",.2,.7),("windowGap",-32,40),("trayIconSize",16,24),("traySpacing",0,12),("controlGap",4,16),("controlRadius",8,24),("controlIconSize",18,30),("sliderThickness",4,14),("terminalArtSize",24,60),("launcherVisibleRows",3,8),("companionSize",40,90),("companionInset",0,160),("contextDuration",800,4000),("tooltipDelay",150,1000),("hoverLift",0,10),("motionSpeed",.65,1.5),("notificationDuration",2000,12000),("uiScale",.85,1.25),("topMargin",0,32),("barHeight",28,44),("collapsedWidth",72,150),("clusterGap",6,28),("expandedRadius",16,36),("innerPadding",6,16),("mediaWidth",300,440),("controlsWidth",340,440),("launcherWidth",420,680),("calendarWidth",280,400))}, **{key:{"type":"STRING","enum":values} for key,values in {"motion":["fluid","gentle","instant"],"wallpaperTransition":["none","fade"],"fontFamily":["Instrument Sans","Inter Variable","Adwaita Sans"],"clockFontFamily":["Instrument Sans","Inter Variable","Adwaita Sans"],"companionSide":["left","right"],"terminal":["foot","kitty","alacritty","wezterm"],"terminalArtMode":["original","theme"],"terminalArtFormat":["image","ascii"],"terminalArtCollection":["atelier","portraits","legends","all"],"matugenScheme":["scheme-content","scheme-expressive","scheme-fidelity","scheme-fruit-salad","scheme-monochrome","scheme-neutral","scheme-rainbow","scheme-tonal-spot","scheme-vibrant","scheme-smart"]}.items()}, "recordFps":{"type":"INTEGER","enum":[30,60]} diff --git a/services/ControlLayout.qml b/services/ControlLayout.qml index cf6d7ff..9e50597 100644 --- a/services/ControlLayout.qml +++ b/services/ControlLayout.qml @@ -12,8 +12,7 @@ Singleton { readonly property var shapes: Grid.shapes readonly property int rows: Math.max(1,...items.map(a=>a.y+a.h)) readonly property real cell: (Preferences.controlsWidth-Preferences.innerPadding*2-(columns-1)*Preferences.controlGap)/columns - readonly property bool notesEntryShown: !items.some(a=>a.id==="notes") - readonly property bool footerShown:notesEntryShown||Preferences.footerVisible&&(Preferences.footerPerformance||Preferences.footerThemes||Preferences.footerWallpapers||Preferences.footerPower||Preferences.footerSettings||(Preferences.footerTray&&Tray.items.length>0)) + readonly property bool footerShown:Preferences.footerVisible&&(Preferences.footerPerformance||Preferences.footerSettings||(Preferences.footerTray&&Tray.items.length>0)) readonly property int panelHeight: Math.ceil(rows*(cell+Preferences.controlGap)-Preferences.controlGap+Preferences.innerPadding*2+(footerShown?48:0)) function snapshot(): var { return {version:2,columns,items}; } function commit(next: var, count: int): bool { diff --git a/services/DesktopActions.qml b/services/DesktopActions.qml index eae498d..318ddb5 100644 --- a/services/DesktopActions.qml +++ b/services/DesktopActions.qml @@ -11,7 +11,7 @@ Singleton { property var pending: ({}) property int sequence: 0 PwObjectTracker { objects: Audio.outputs.concat(Audio.inputs) } - readonly property var preferenceKeys: ["remindersEnabled","deviceIndicator","contextDevices","contextBattery","compactMissingLyrics","launcherCalculator","launcherDescriptions","matugenAutomatic","themeGtk","themeFolders","themeQt","themeFoot","themeSpotify","footerTray","footerVisible","footerThemes","footerWallpapers","footerPower","footerSettings","recordCursor","crispText","liveMedia","mediaAutoHide","focusQuiet","footerPerformance","mediaVisualizer","mediaLyrics","fuzzyApps","rememberApps","terminalGreeting","terminalArtFavoritesOnly","terminalArtMinimal","companionEnabled","companionZen","companionTerminal","agentFeedback","contextWorkspace","contextVolume","contextBrightness","welcomeAtLogin","contextEvents","wallpaperColors","use24Hour","showSeconds","showAlbum","showStatus","shadows","focusMinutes","breakMinutes","recordCountdown","matugenContrast","matugenSource","wallpaperDuration","windowGap","trayIconSize","traySpacing","controlGap","controlRadius","controlIconSize","sliderThickness","terminalArtSize","launcherVisibleRows","companionSize","companionInset","contextDuration","tooltipDelay","hoverLift","motionSpeed","notificationDuration","uiScale","topMargin","barHeight","collapsedWidth","clusterGap","expandedRadius","innerPadding","mediaWidth","controlsWidth","launcherWidth","calendarWidth","motion","wallpaperTransition","fontFamily","clockFontFamily","companionSide","terminal","terminalArtMode","terminalArtFormat","terminalArtCollection","matugenScheme","recordFps"] + readonly property var preferenceKeys: ["remindersEnabled","deviceIndicator","contextDevices","contextBattery","compactMissingLyrics","launcherCalculator","launcherDescriptions","matugenAutomatic","themeGtk","themeFolders","themeQt","themeFoot","themeSpotify","footerTray","footerVisible","footerSettings","recordCursor","crispText","liveMedia","mediaAutoHide","focusQuiet","footerPerformance","mediaVisualizer","mediaLyrics","fuzzyApps","rememberApps","terminalGreeting","terminalArtFavoritesOnly","terminalArtMinimal","companionEnabled","companionZen","companionTerminal","agentFeedback","contextWorkspace","contextVolume","contextBrightness","welcomeAtLogin","contextEvents","wallpaperColors","use24Hour","showSeconds","showAlbum","showStatus","shadows","focusMinutes","breakMinutes","recordCountdown","matugenContrast","matugenSource","wallpaperDuration","windowGap","trayIconSize","traySpacing","controlGap","controlRadius","controlIconSize","sliderThickness","terminalArtSize","launcherVisibleRows","companionSize","companionInset","contextDuration","tooltipDelay","hoverLift","motionSpeed","notificationDuration","uiScale","topMargin","barHeight","collapsedWidth","clusterGap","expandedRadius","innerPadding","mediaWidth","controlsWidth","launcherWidth","calendarWidth","motion","wallpaperTransition","fontFamily","clockFontFamily","companionSide","terminal","terminalArtMode","terminalArtFormat","terminalArtCollection","matugenScheme","recordFps"] function refused(error:string):var { return {ok:false,status:"refused",error}; } function level(value:var):bool { return typeof value==="number"&&Number.isFinite(value)&&value>=0&&value<=100; } function deviceId(node:var):string { return node?String(node.id):""; } diff --git a/services/Preferences.qml b/services/Preferences.qml index c9eae50..97aeb66 100644 --- a/services/Preferences.qml +++ b/services/Preferences.qml @@ -27,9 +27,6 @@ Singleton { property bool themeSpotify: true property bool footerTray:true property bool footerVisible: true - property bool footerThemes: true - property bool footerWallpapers: true - property bool footerPower: true property bool footerSettings: true property string wallpaperTransition: "fade" property real wallpaperDuration: .35 @@ -142,7 +139,7 @@ Singleton { property string saveError: "" readonly property bool preview: Quickshell.env("MODESTY_PREVIEW") === "1" readonly property string stateDir: (Quickshell.env("XDG_STATE_HOME") || Quickshell.env("HOME") + "/.local/state") + "/modesty" - readonly property var defaults: ({companionSide:"right",companionInset:36,companionEnabled:true,companionZen:true,companionTerminal:true,companionSize:64,agentFeedback:true,privacyRadar:true,privacyIndicatorGap:25,privacyIndicatorRightPadding:19,remindersEnabled:true,deviceIndicator:true,focusMinutes:25,breakMinutes:5,recordCountdown:3,recordFps:60,recordCursor:true,contextDevices:true,contextBattery:true,footerTray:true,compactMissingLyrics:true,launcherCalculator:true,launcherDescriptions:false,matugenAutomatic:true,matugenScheme:"scheme-tonal-spot",matugenContrast:0,matugenSource:0,themeGtk:true,themeFolders:false,themeQt:true,themeFoot:true,themeSpotify:true,footerVisible:true,footerThemes:true,footerWallpapers:true,footerPower:true,footerSettings:true,wallpaperTransition:"fade",wallpaperDuration:.35,windowGap:0,trayIconSize:20,traySpacing:5,crispText:true,controlGap:9,controlRadius:16,controlIconSize:24,sliderThickness:8,lockDuration:520,lockBlur:.6,lockDim:.36,lockClockSize:124, fontFamily:"Inter Variable",clockFontFamily:"Inter Variable",profileImage:"",liveMedia:true,mediaAutoHide:true,focusQuiet:true,footerPerformance:true,lockClockStyle:"soft",mediaVisualizer:true,mediaLyrics:true,welcomeAtLogin: true, fuzzyApps: true, rememberApps: true, terminal: "foot", terminalGreeting:true, terminalArtFormat:"image", terminalArtMode:"original", terminalArtCollection:"portraits", terminalArtPinned:"", terminalArtFavorites:[], terminalArtHidden:[], terminalArtFavoritesOnly:false, terminalArtMinimal:false, terminalArtSize:36, launcherVisibleRows: 5, agentActivity:true, agentActivityInterval:5, contextWorkspace: true, contextVolume: true, contextBrightness: true, contextDuration: 1500, tooltipDelay: 500, hoverLift: 5, motionSpeed: 1.0, notificationDuration: 6000, notificationBody: true, wallpaperColors: true, contextEvents: true, use24Hour: true, showSeconds: false, motion: "fluid", uiScale: 1, topMargin: 11, barHeight: 33, collapsedWidth: 90, clusterGap: 14, expandedRadius: 28, innerPadding: 10, showAlbum: true, showStatus: true, shadows: true, mediaWidth: 360, controlsWidth: 370, launcherWidth: 550, searchWidth:700, searchBarHeight:80, searchMaxHeight:560, searchRows:5, searchX:50, searchY:50, searchRadius:24, searchMotion:210, searchTravelDuration:620, searchWebPrefix:"web", searchFilePrefix:"file", lumaJev:true,lumaVoice:true,lumaVoiceWarm:false,lumaLocalFiles:true,lumaKnowledgeRoots:[],lumaWeb:true,lumaDesktop:true,lumaSystem:true,lumaAccess:"review",lumaEffects:true,lumaActionDetails:false,lumaTextSize:14,lumaWindowContext:true,lumaRemember:true,lumaAutoAnswer:true,lumaAnswerDelay:1500,searchAiEnabled:true, searchAiModel:"gemini-3.5-flash-lite", calendarWidth: 320 }) + readonly property var defaults: ({companionSide:"right",companionInset:36,companionEnabled:true,companionZen:true,companionTerminal:true,companionSize:64,agentFeedback:true,privacyRadar:true,privacyIndicatorGap:25,privacyIndicatorRightPadding:19,remindersEnabled:true,deviceIndicator:true,focusMinutes:25,breakMinutes:5,recordCountdown:3,recordFps:60,recordCursor:true,contextDevices:true,contextBattery:true,footerTray:true,compactMissingLyrics:true,launcherCalculator:true,launcherDescriptions:false,matugenAutomatic:true,matugenScheme:"scheme-tonal-spot",matugenContrast:0,matugenSource:0,themeGtk:true,themeFolders:false,themeQt:true,themeFoot:true,themeSpotify:true,footerVisible:true,footerSettings:true,wallpaperTransition:"fade",wallpaperDuration:.35,windowGap:0,trayIconSize:20,traySpacing:5,crispText:true,controlGap:9,controlRadius:16,controlIconSize:24,sliderThickness:8,lockDuration:520,lockBlur:.6,lockDim:.36,lockClockSize:124, fontFamily:"Inter Variable",clockFontFamily:"Inter Variable",profileImage:"",liveMedia:true,mediaAutoHide:true,focusQuiet:true,footerPerformance:true,lockClockStyle:"soft",mediaVisualizer:true,mediaLyrics:true,welcomeAtLogin: true, fuzzyApps: true, rememberApps: true, terminal: "foot", terminalGreeting:true, terminalArtFormat:"image", terminalArtMode:"original", terminalArtCollection:"portraits", terminalArtPinned:"", terminalArtFavorites:[], terminalArtHidden:[], terminalArtFavoritesOnly:false, terminalArtMinimal:false, terminalArtSize:36, launcherVisibleRows: 5, agentActivity:true, agentActivityInterval:5, contextWorkspace: true, contextVolume: true, contextBrightness: true, contextDuration: 1500, tooltipDelay: 500, hoverLift: 5, motionSpeed: 1.0, notificationDuration: 6000, notificationBody: true, wallpaperColors: true, contextEvents: true, use24Hour: true, showSeconds: false, motion: "fluid", uiScale: 1, topMargin: 11, barHeight: 33, collapsedWidth: 90, clusterGap: 14, expandedRadius: 28, innerPadding: 10, showAlbum: true, showStatus: true, shadows: true, mediaWidth: 360, controlsWidth: 370, launcherWidth: 550, searchWidth:700, searchBarHeight:80, searchMaxHeight:560, searchRows:5, searchX:50, searchY:50, searchRadius:24, searchMotion:210, searchTravelDuration:620, searchWebPrefix:"web", searchFilePrefix:"file", lumaJev:true,lumaVoice:true,lumaVoiceWarm:false,lumaLocalFiles:true,lumaKnowledgeRoots:[],lumaWeb:true,lumaDesktop:true,lumaSystem:true,lumaAccess:"review",lumaEffects:true,lumaActionDetails:false,lumaTextSize:14,lumaWindowContext:true,lumaRemember:true,lumaAutoAnswer:true,lumaAnswerDelay:1500,searchAiEnabled:true, searchAiModel:"gemini-3.5-flash-lite", calendarWidth: 320 }) function set(key: string, value: var): void { if (!(key in defaults)) return; if (typeof defaults[key] === "boolean" && typeof value !== "boolean") return; diff --git a/setup/state/modesty/preferences.json b/setup/state/modesty/preferences.json index 25cda85..6074711 100644 --- a/setup/state/modesty/preferences.json +++ b/setup/state/modesty/preferences.json @@ -28,9 +28,6 @@ "themeFoot": true, "themeSpotify": true, "footerVisible": true, - "footerThemes": true, - "footerWallpapers": true, - "footerPower": false, "footerSettings": true, "wallpaperTransition": "fade", "wallpaperDuration": 0.35, diff --git a/tests/check.py b/tests/check.py index 0080eff..abc7ecb 100644 --- a/tests/check.py +++ b/tests/check.py @@ -19,6 +19,7 @@ [sys.executable, 'tests/notes.py'], [sys.executable, 'tests/notes-qml.py'], [sys.executable, 'tests/notes-ui.py'], + [sys.executable, 'tests/control-center-ui.py'], [sys.executable, 'tests/notes-popup.py'], [sys.executable, 'tests/notes-bindings.py'], [sys.executable, 'tests/reminders.py'], diff --git a/tests/control-center-ui.py b/tests/control-center-ui.py new file mode 100644 index 0000000..ca0ed15 --- /dev/null +++ b/tests/control-center-ui.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python3 +"""Exercise the production control center and performance rows offscreen.""" +from qml import run + +FOOTER = '''import QtQuick +import QtTest +import Quickshell +import "modules/island" as Island +import qs.services +import qs.theme +ShellRoot { + id:test + property int phase:0 + property real withoutFooter:0 + property var custom:[{id:"wifi",x:0,y:0,w:3,h:1}] + FloatingWindow { + visible:true;implicitWidth:700;implicitHeight:800 + Island.ControlCenter {id:center;width:Preferences.controlsWidth-Preferences.innerPadding*2;height:ControlLayout.panelHeight-Preferences.innerPadding*2} + } + TestCase {id:input;when:false} + function check(value,message) {if(!value)throw new Error(message);} + function child(name) {const item=input.findChild(center,name);check(!!item,"Missing "+name);return item;} + Component.onCompleted: { + Preferences.set("motion","instant");Theme.setMode("TEST_MODE"); + Preferences.footerTray=false;Preferences.footerSettings=true;Preferences.footerPerformance=true; + IslandState.openMenu("quicksettings"); + } + Timer {id:steps;interval:160;running:true;repeat:false;onTriggered:{try { + const footer=child("controlFooter"),settings=child("footerSettings"),performance=child("footerPerformance"); + if(phase===0) { + check(Theme.mode==="TEST_MODE","Requested footer color mode not active"); + check(footer.visible&&footer.enabled&&ControlLayout.footerShown,"Default footer unavailable"); + check(settings.text==="Settings"&&performance.text==="Performance"&&settings.x100&&performance.width>100&&performance.x+performance.width<=center.width+.1,"Actions do not share footer width"); + settings.forceActiveFocus();check(settings.activeFocus&&settings.background.border.width===1,"Settings has no visible native focus"); + input.keyClick(Qt.Key_Tab);check(performance.activeFocus,"Tab does not reach Performance"); + input.keyClick(Qt.Key_Space); + check(IslandState.menu==="performance","Keyboard Performance route failed"); + } else if(phase===1) { + check(!footer.enabled,"Detail leaves footer interactive"); + IslandState.openMenu("quicksettings"); + } else if(phase===2) { + input.mouseClick(settings,settings.width/2,settings.height/2); + } else if(phase===3) { + check(IslandState.settingsOpen&&IslandState.menu==="none","Click Settings route failed"); + IslandState.settingsOpen=false;IslandState.openMenu("quicksettings"); + settings.forceActiveFocus();input.keyClick(Qt.Key_Return); + } else if(phase===4) { + check(IslandState.settingsOpen,"Keyboard Settings route failed"); + IslandState.settingsOpen=false;IslandState.openMenu("quicksettings"); + } else if(phase===5) { + input.mouseClick(performance,performance.width/2,performance.height/2); + check(IslandState.menu==="performance","Click Performance route failed"); + IslandState.openMenu("quicksettings");Preferences.footerSettings=false; + } else if(phase===6) { + check(!settings.visible&&performance.visible&&Math.abs(performance.width-center.width)<1,"Hidden Settings reserves space"); + Preferences.footerSettings=true;Preferences.footerPerformance=false; + } else if(phase===7) { + check(settings.visible&&!performance.visible&&Math.abs(settings.width-center.width)<1,"Hidden Performance reserves space"); + Preferences.footerSettings=false; + } else if(phase===8) { + check(!ControlLayout.footerShown&&!footer.visible&&!footer.enabled,"Empty footer remains visible"); + withoutFooter=ControlLayout.panelHeight; + Preferences.footerTray=true; + check(ControlLayout.footerShown===(Tray.items.length>0),"Tray visibility does not follow actual items"); + Preferences.footerTray=false;Preferences.footerSettings=true; + check(ControlLayout.panelHeight===withoutFooter+48,"Footer allocation differs from 48px"); + Preferences.footerVisible=false; + } else if(phase===9) { + check(!footer.visible&&!ControlLayout.footerShown&&ControlLayout.panelHeight===withoutFooter,"Global footer toggle leaves ghost space"); + ControlLayout.items=custom;Preferences.footerVisible=true; + } else if(phase===10) { + check(ControlLayout.footerShown&&footer.visible,"Custom layout lost enabled footer"); + check(JSON.stringify(ControlLayout.items)===JSON.stringify(custom),"Footer mutated custom layout"); + center.width=256; + } else if(phase===11) { + const label=child("footerSettingsLabel"); + check(label.mapToItem(settings,0,0).x>=0&&label.mapToItem(settings,label.width,0).x<=settings.width,"Narrow footer label escapes action"); + Preferences.footerVisible=false; + } else if(phase===12) { + check(!ControlLayout.footerShown&&!footer.visible,"Custom layout creates Notes fallback"); + const height=ControlLayout.panelHeight; + ControlLayout.items=custom.concat([{id:"notes",x:3,y:0,w:1,h:1}]); + check(ControlLayout.panelHeight===height&&!ControlLayout.footerShown,"Notes tile changes footer allocation"); + console.log("CONTROL FOOTER TEST_MODE PASS");Qt.quit();return; + } + phase++;steps.restart(); + }catch(error){console.error(error);Qt.exit(1);}}} +} +''' + +PERFORMANCE = '''import QtQuick +import QtTest +import Quickshell +import "modules/island" as Island +import qs.services +import qs.theme +ShellRoot { + id:test + property int phase:0 + property string longName:"nvme-device-with-a-very-long-readable-name" + property string longPath:"/home/example/a/very/long/filesystem/mount/path" + property var savedHistory + property var savedSample + FloatingWindow { + visible:true;implicitWidth:700;implicitHeight:750 + Island.PerformanceMenu {id:panel;width:TEST_WIDTH;height:510} + } + TestCase {id:input;when:false} + function check(value,message) {if(!value)throw new Error(message);} + function child(name) {const item=input.findChild(panel,name);check(!!item,"Missing "+name);return item;} + function near(actual,expected,message) {check(Math.abs(actual-expected)<.01,message+" actual="+actual);} + function known() {return {cpu:.17,memoryUsed:1073741824,memoryTotal:4294967296,download:2097152,upload:1024, + diskIo:[{name:longName,busy:.08,read:1048576,write:2048},{name:"sda",busy:.02,read:24576,write:0}], + disks:[{path:"/",used:1073741824,total:4294967296},{path:longPath,used:2147483648,total:4294967296}]};} + function walk(item) {let items=[item];for(const child of item.children||[])items=items.concat(walk(child));return items;} + function geometry() { + for(const item of walk(child("performanceScroll"))) { + if(!item.visible||item.width<=0||item.height<=0)continue; + check(Number.isFinite(item.x)&&Number.isFinite(item.y)&&Number.isFinite(item.width),"Invalid metric geometry "+item.objectName); + if(item.text!==undefined)check(item.width<=panel.width+.1,"Metric exceeds narrow panel "+item.objectName); + } + check(child("driveName-"+longName).truncated&&child("driveName-"+longName).text===longName,"Long device label did not elide while retaining full text"); + check(child("storagePath-"+longPath).text===longPath,"Actual filesystem path missing"); + } + Component.onCompleted: {Preferences.set("motion","instant");Theme.setMode("TEST_MODE");IslandState.openMenu("performance");} + Timer {id:steps;interval:180;running:true;repeat:false;onTriggered:{try { + const scroll=child("performanceScroll"); + if(phase===0) { + check(Preferences.preview&&!child("performanceCollector").running,"Preview started live collector"); + check(Theme.mode==="TEST_MODE","Requested color mode not active"); + check(child("CPUPercent").text==="—"&&child("MemoryPercent").text==="—","Unknown percentages show data"); + check(child("downloadRate").text==="—/s"&&child("performanceStatus").visible&&!child("performanceLive").visible,"Loading state missing"); + panel.ingest(known()); + } else if(phase===1) { + check(panel.deviceNames.length===2&&panel.diskPaths.length===2,"Multiple drives/filesystems lost"); + check(child("CPUPercent").text==="17"&&child("MemoryPercent").text==="25","Known percentages wrong"); + check(child("CPUDetail").text==="All cores"&&child("MemoryDetail").text==="1.0 GiB / 4.0 GiB","Summary detail missing"); + check(child("driveBusy-"+longName).text==="8% active"&&child(longName+"-read").text==="1.0 MiB/s"&&child(longName+"-write").text==="2.0 KiB/s","Disk readings missing"); + check(child("sda-read").text==="24.0 KiB/s"&&child("sda-write").text==="0 B/s","Second disk readings missing"); + check(child("downloadRate").text==="2.0 MiB/s"&&child("uploadRate").text==="1.0 KiB/s","Network readings missing"); + check(child("storageUsage-/").text==="1.0 GiB / 4.0 GiB"&&child("storageUsage-"+longPath).text==="2.0 GiB / 4.0 GiB","Filesystem readings missing"); + near(child("storageFill-/").width/child("storageFill-/").parent.width,.25,"Capacity bar wrong"); + check(child("performanceLive").visible&&!child("performanceStatus").visible,"Live state missing"); + check(child("CPUHistory").values[0]===.17&&child("MemoryHistory").values[0]===.25&&child("driveHistory-sda").values[0]===.02,"CPU/RAM/disk traces lost"); + check(child("downloadHistory").values[0]===2097152&&child("uploadHistory").values[0]===1024,"Separate network histories lost"); + check(child("downloadHistory").ceiling===child("uploadHistory").ceiling&&child("uploadHistory").ceiling===2097152,"Network traces use different scales"); + geometry(); + check(panel.implicitHeight<=510,"Two-drive metrics exceed normal 610px detail allocation "+panel.implicitHeight); + const zero=known();zero.cpu=0;zero.memoryUsed=0;zero.download=0;zero.upload=0; + zero.diskIo.forEach(d=>{d.busy=0;d.read=0;d.write=0;});panel.ingest(zero); + } else if(phase===2) { + check(child("CPUPercent").text==="0"&&child("MemoryPercent").text==="0"&&child("downloadRate").text==="0 B/s","Zero metrics shown as unknown"); + check(child("driveBusy-sda").text==="0% active","Zero busy lost"); + const unknown=known();unknown.cpu=null;unknown.memoryUsed=null;unknown.memoryTotal=null;unknown.download=null;unknown.upload=null; + unknown.diskIo.forEach(d=>{d.busy=null;d.read=null;d.write=null;});unknown.disks.forEach(d=>{d.used=null;d.total=null;});panel.ingest(unknown); + } else if(phase===3) { + check(child("CPUPercent").text==="—"&&child("MemoryPercent").text==="—"&&child("MemoryDetail").text==="— / —","Null summary not unknown"); + check(child("driveBusy-sda").text==="—"&&child("sda-read").text==="—/s"&&child("downloadRate").text==="—/s","Null rates not unknown"); + check(child("storageUsage-/").text==="— / —"&&child("storageFill-/").width===0,"Unknown storage has invalid bar"); + check(panel.history.cpu.length===2&&panel.history.sda.length===2&&panel.history.download.length===2,"Null readings erased existing histories"); + panel.ingest(known());savedHistory=JSON.stringify(panel.history);savedSample=JSON.stringify(panel.sample); + panel.ingest({error:"Metrics unavailable"}); + } else if(phase===4) { + check(child("performanceStatus").visible&&child("performanceStatus").text==="Metrics unavailable"&&!child("performanceLive").visible,"Error state missing"); + check(JSON.stringify(panel.history)===savedHistory&&JSON.stringify(panel.sample)===savedSample,"Error erased last sample/history"); + check(child("CPUPercent").text==="17"&&child("storageUsage-/").text==="1.0 GiB / 4.0 GiB","Error hid last readings"); + for(let i=0;i<35;i++){const data=known();data.cpu=i/100;panel.ingest(data);} + } else if(phase===5) { + check(!panel.error&&!child("performanceStatus").visible,"Recovery retained error"); + for(const key of ["cpu","memory",longName,"sda","download","upload"])check(panel.history[key].length===30,"History retention changed "+key); + near(panel.history.cpu[0],.05,"History oldest sample wrong");near(panel.history.cpu[29],.34,"History newest sample wrong"); + panel.height=220; + const many=known();for(let i=0;i<6;i++){many.diskIo.push({name:"extra"+i,busy:.1,read:1024,write:0});many.disks.push({path:"/mount/"+i,used:1024,total:2048});}panel.ingest(many); + } else if(phase===6) { + geometry();check(scroll.contentHeight>scroll.height,"Short panel does not scroll"); + scroll.forceActiveFocus();input.keyClick(Qt.Key_End); + near(scroll.contentY,scroll.contentHeight-scroll.height,"End does not reach storage"); + const last=child("storage-/mount/5");const bottom=last.mapToItem(scroll,0,last.height).y; + check(bottom<=scroll.height+1&&bottom>0,"Last filesystem unreachable"); + input.keyClick(Qt.Key_Home);near(scroll.contentY,0,"Home does not reach CPU"); + input.keyClick(Qt.Key_PageDown);check(scroll.contentY>0,"Keyboard PageDown does not scroll"); + input.keyClick(Qt.Key_Up);input.keyClick(Qt.Key_PageUp);near(scroll.contentY,0,"Keyboard Up/PageUp does not scroll"); + input.mouseWheel(scroll,scroll.width/2,scroll.height/2,0,-120); + input.tryVerify(()=>scroll.contentY>0,1000,"Mouse wheel does not scroll");check(scroll.contentY>0,"Mouse wheel did not reach metrics"); + savedHistory=JSON.stringify(panel.history); + const back=walk(panel).find(item=>item.label==="Control center");check(!!back,"Back action missing"); + input.mouseClick(back,back.width/2,back.height/2);check(IslandState.menu==="quicksettings","Back action route failed"); + } else if(phase===7) { + check(JSON.stringify(panel.history)===savedHistory,"Back navigation changed history"); + console.log("PERFORMANCE TEST_MODE TEST_WIDTH PASS");Qt.quit();return; + } + phase++;steps.restart(); + }catch(error){console.error(error);Qt.exit(1);}}} +} +''' + +for mode in ('dark', 'light'): + run(FOOTER.replace('TEST_MODE', mode), f'CONTROL FOOTER {mode} PASS') + for width in (326, 256): + run(PERFORMANCE.replace('TEST_MODE', mode).replace('TEST_WIDTH', str(width)), + f'PERFORMANCE {mode} {width} PASS') diff --git a/tests/notes-ui.py b/tests/notes-ui.py index 65a6cca..8a026b2 100644 --- a/tests/notes-ui.py +++ b/tests/notes-ui.py @@ -149,7 +149,7 @@ check(surface.clockStage.height<=surface.maximumHeight,"Height escaped screen clamp"); check(surface.clockStage.targetWidth>=0&&surface.clockStage.targetHeight<=surface.maximumHeight,"Invalid compact targets"); const custom=[{id:"wifi",x:1,y:1,w:3,h:1}];ControlLayout.items=custom;Preferences.set("footerVisible",false); - check(ControlLayout.notesEntryShown&&ControlLayout.footerShown,"Custom layout hides Notes entry"); + check(!ControlLayout.footerShown,"Disabled footer reserves space for obsolete Notes fallback"); check(JSON.stringify(ControlLayout.items)===JSON.stringify(custom),"Notes discovery moved custom controls"); console.log("PASS Notes geometry: capture/library targets, screen clamps and custom layout discovery");Qt.quit();return; } diff --git a/tests/settings.py b/tests/settings.py index 775f169..837c3b6 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -248,7 +248,7 @@ def run(directory, environment, source, marker): const cursor=notes.mapToItem(view,notes.cursorRectangle.x,notes.cursorRectangle.y); check(cursor.y>=0&&cursor.y+notes.cursorRectangle.height<=view.height+1,"Notes cursor outside editor viewport"); targets=[];Catalog.pages.forEach(p=>p.blocks.forEach(b=>b.items.concat(b.targets.map(t=>({key:t.id,label:t.label}))).forEach(t=>targets.push({page:p.id,block:b.id,key:t.key,label:t.label})))); - check(targets.length>=176,"Catalog target sweep lost coverage"); + check(targets.length>=173,"Catalog target sweep lost coverage"); targetIndex=0;steps.interval=30;root.navigate(targets[0].page,targets[0].block,targets[0].key); }else{ const target=targets[targetIndex];