diff --git a/quickshell/Modals/DankLauncherV2/Controller.qml b/quickshell/Modals/DankLauncherV2/Controller.qml index 1caec144..740197db 100644 --- a/quickshell/Modals/DankLauncherV2/Controller.qml +++ b/quickshell/Modals/DankLauncherV2/Controller.qml @@ -125,13 +125,6 @@ Item { } readonly property var sectionDefinitions: [ - { - id: "calculator", - title: I18n.tr("Calculator"), - icon: "calculate", - priority: 0, - defaultViewMode: "list" - }, { id: "favorites", title: I18n.tr("Pinned"), @@ -681,12 +674,6 @@ Item { return; } - var calculatorResult = evaluateCalculator(searchQuery); - if (calculatorResult) { - calculatorResult._preScored = 12000; - allItems.push(calculatorResult); - } - var apps = searchApps(searchQuery); for (var i = 0; i < apps.length; i++) { if (searchQuery) @@ -931,13 +918,6 @@ Item { return Transform.transformFileResult(file, I18n.tr("Open"), I18n.tr("Open folder"), I18n.tr("Copy path")); } - function evaluateCalculator(query) { - var calc = Utils.evaluateCalculator(query); - if (!calc) - return null; - return Transform.createCalculatorItem(calc, query, I18n.tr("Copy")); - } - function detectTrigger(query) { if (!query || query.length === 0) return { @@ -1559,9 +1539,6 @@ Item { case "file": openFile(item.data?.path); break; - case "calculator": - copyToClipboard(item.name); - break; default: return; } diff --git a/quickshell/Modals/DankLauncherV2/ControllerUtils.js b/quickshell/Modals/DankLauncherV2/ControllerUtils.js index e63c9327..a06285fd 100644 --- a/quickshell/Modals/DankLauncherV2/ControllerUtils.js +++ b/quickshell/Modals/DankLauncherV2/ControllerUtils.js @@ -101,35 +101,6 @@ function detectIconType(iconName) { return "material"; } -function evaluateCalculator(query) { - if (!query || query.length === 0) - return null; - - var mathExpr = query.replace(/[^0-9+\-*/().%\s^]/g, ""); - if (mathExpr.length < 2) - return null; - - var hasMath = /[+\-*/^%]/.test(query) && /\d/.test(query); - if (!hasMath) - return null; - - try { - var sanitized = mathExpr.replace(/\^/g, "**"); - var result = Function('"use strict"; return (' + sanitized + ')')(); - - if (typeof result === "number" && isFinite(result)) { - var displayResult = Number.isInteger(result) ? result.toString() : result.toFixed(6).replace(/\.?0+$/, ""); - return { - expression: query, - result: result, - displayResult: displayResult - }; - } - } catch (e) { } - - return null; -} - function sortPluginIdsByOrder(pluginIds, order) { if (!order || order.length === 0) return pluginIds; diff --git a/quickshell/Modals/DankLauncherV2/ItemTransformers.js b/quickshell/Modals/DankLauncherV2/ItemTransformers.js index 8d4a804d..d09f0854 100644 --- a/quickshell/Modals/DankLauncherV2/ItemTransformers.js +++ b/quickshell/Modals/DankLauncherV2/ItemTransformers.js @@ -190,32 +190,6 @@ function transformPluginItem(item, pluginId, selectLabel) { }; } -function createCalculatorItem(calc, query, copyLabel) { - return { - id: "calculator_result", - type: "calculator", - name: calc.displayResult, - subtitle: query + " =", - icon: "calculate", - iconType: "material", - section: "calculator", - data: { - expression: calc.expression, - result: calc.result - }, - actions: [], - primaryAction: { - name: copyLabel, - icon: "content_copy", - action: "copy" - }, - _hName: "", - _hSub: "", - _hRich: false, - _preScored: undefined - }; -} - function createPluginBrowseItem(pluginId, plugin, trigger, isBuiltIn, isAllowed, browseLabel, triggerLabel, noTriggerLabel) { var rawIcon = isBuiltIn ? (plugin.cornerIcon || "extension") : (plugin.icon || "extension"); return { diff --git a/quickshell/Modals/DankLauncherV2/ResultItem.qml b/quickshell/Modals/DankLauncherV2/ResultItem.qml index e4ad6753..7cce0b42 100644 --- a/quickshell/Modals/DankLauncherV2/ResultItem.qml +++ b/quickshell/Modals/DankLauncherV2/ResultItem.qml @@ -178,8 +178,6 @@ Rectangle { if (!root.item) return ""; switch (root.item.type) { - case "calculator": - return I18n.tr("Calc"); case "plugin": return I18n.tr("Plugin"); case "file": diff --git a/quickshell/Modules/ControlCenter/Components/DetailHost.qml b/quickshell/Modules/ControlCenter/Components/DetailHost.qml index 7826b4e1..a3b11564 100644 --- a/quickshell/Modules/ControlCenter/Components/DetailHost.qml +++ b/quickshell/Modules/ControlCenter/Components/DetailHost.qml @@ -15,18 +15,22 @@ Item { property var pluginDetailInstance: null property var widgetModel: null property var collapseCallback: null + property real maxAvailableHeight: 9999 function getDetailHeight(section) { - const maxAvailable = parent ? parent.height - Theme.spacingS : 9999; switch (true) { case section === "wifi": case section === "bluetooth": case section === "builtin_vpn": - return Math.min(350, maxAvailable); + return Math.min(350, maxAvailableHeight); case section.startsWith("brightnessSlider_"): - return Math.min(400, maxAvailable); + return Math.min(400, maxAvailableHeight); + case section.startsWith("plugin_"): + if (pluginDetailInstance?.ccDetailHeight) + return Math.min(pluginDetailInstance.ccDetailHeight, maxAvailableHeight); + return Math.min(250, maxAvailableHeight); default: - return Math.min(250, maxAvailable); + return Math.min(250, maxAvailableHeight); } } diff --git a/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml b/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml index b2ef540b..4cdd9797 100644 --- a/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml +++ b/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml @@ -31,11 +31,26 @@ Column { spacing: editMode ? Theme.spacingL : Theme.spacingS + property real maxPopoutHeight: 9999 property var currentRowWidgets: [] property real currentRowWidth: 0 property int expandedRowIndex: -1 property var colorPickerModal: null + readonly property real _maxDetailHeight: { + const rows = layoutResult.rows; + let totalRowHeight = 0; + for (let i = 0; i < rows.length; i++) { + const sliderOnly = rows[i].every(w => { + const id = w.id || ""; + return id === "volumeSlider" || id === "brightnessSlider" || id === "inputVolumeSlider"; + }); + totalRowHeight += sliderOnly ? 36 : 60; + } + const rowSpacing = Math.max(0, rows.length - 1) * spacing; + return Math.max(100, maxPopoutHeight - totalRowHeight - rowSpacing); + } + function calculateRowsAndWidgets() { return LayoutUtils.calculateRowsAndWidgets(root, expandedSection, expandedWidgetIndex); } @@ -163,6 +178,7 @@ Column { DetailHost { id: detailHost width: parent.width + maxAvailableHeight: root._maxDetailHeight height: active ? (getDetailHeight(root.expandedSection) + Theme.spacingS) : 0 property bool active: { if (root.expandedSection === "") diff --git a/quickshell/Modules/ControlCenter/ControlCenterPopout.qml b/quickshell/Modules/ControlCenter/ControlCenterPopout.qml index 359177df..065d09c1 100644 --- a/quickshell/Modules/ControlCenter/ControlCenterPopout.qml +++ b/quickshell/Modules/ControlCenter/ControlCenterPopout.qml @@ -116,6 +116,7 @@ DankPopout { property alias bluetoothCodecSelector: bluetoothCodecSelector color: "transparent" + clip: true Rectangle { anchors.fill: parent @@ -166,6 +167,10 @@ DankPopout { id: widgetGrid width: parent.width editMode: root.editMode + maxPopoutHeight: { + const screenHeight = (root.triggerScreen?.height ?? 1080); + return screenHeight - 100 - Theme.spacingL - headerPane.height - Theme.spacingS; + } expandedSection: root.expandedSection expandedWidgetIndex: root.expandedWidgetIndex expandedWidgetData: root.expandedWidgetData