From 47dfcf4baf42c33ca5ee78dd4c0877e894aec1fb Mon Sep 17 00:00:00 2001 From: ATMDA Date: Mon, 10 Nov 2025 00:46:45 -0500 Subject: launcher: python execution like calculator functionality --- modules/launcher/AppList.qml | 18 ++++- modules/launcher/Content.qml | 2 +- modules/launcher/items/PythonItem.qml | 124 ++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 modules/launcher/items/PythonItem.qml (limited to 'modules/launcher') diff --git a/modules/launcher/AppList.qml b/modules/launcher/AppList.qml index 7f7b843..6217237 100644 --- a/modules/launcher/AppList.qml +++ b/modules/launcher/AppList.qml @@ -52,7 +52,7 @@ StyledListView { const text = search.text; const prefix = Config.launcher.actionPrefix; if (text.startsWith(prefix)) { - for (const action of ["calc", "scheme", "variant"]) + for (const action of ["calc", "python", "scheme", "variant"]) if (text.startsWith(`${prefix}${action} `)) return action; @@ -92,6 +92,14 @@ StyledListView { root.delegate: calcItem } }, + State { + name: "python" + + PropertyChanges { + model.values: [0] + root.delegate: pythonItem + } + }, State { name: "scheme" @@ -239,6 +247,14 @@ StyledListView { } } + Component { + id: pythonItem + + PythonItem { + list: root + } + } + Component { id: schemeItem diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index f674569..3a90a74 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -90,7 +90,7 @@ Item { Wallpapers.setWallpaper(currentItem.modelData.path); root.visibilities.launcher = false; } else if (text.startsWith(Config.launcher.actionPrefix)) { - if (text.startsWith(`${Config.launcher.actionPrefix}calc `)) + if (text.startsWith(`${Config.launcher.actionPrefix}calc `) || text.startsWith(`${Config.launcher.actionPrefix}python `)) currentItem.onClicked(); else currentItem.modelData.onClicked(list.currentList); diff --git a/modules/launcher/items/PythonItem.qml b/modules/launcher/items/PythonItem.qml new file mode 100644 index 0000000..8384e71 --- /dev/null +++ b/modules/launcher/items/PythonItem.qml @@ -0,0 +1,124 @@ +import qs.components +import qs.services +import qs.config +import Quickshell +import QtQuick +import QtQuick.Layouts + +Item { + id: root + + required property var list + readonly property string code: list.search.text.slice(`${Config.launcher.actionPrefix}python `.length) + + function onClicked(): void { + // Execute Python code and copy result to clipboard + // Escape single quotes in code for shell safety + const escapedCode = root.code.replace(/'/g, "'\\''"); + Quickshell.execDetached(["sh", "-c", `python3 -c '${escapedCode}' 2>&1 | wl-copy`]); + root.list.visibilities.launcher = false; + } + + implicitHeight: Config.launcher.sizes.itemHeight + + anchors.left: parent?.left + anchors.right: parent?.right + + StateLayer { + radius: Appearance.rounding.normal + + function onClicked(): void { + root.onClicked(); + } + } + + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: Appearance.padding.larger + + spacing: Appearance.spacing.normal + + MaterialIcon { + text: "code" + font.pointSize: Appearance.font.size.extraLarge + Layout.alignment: Qt.AlignVCenter + } + + StyledText { + id: result + + color: { + if (!root.code) + return Colours.palette.m3onSurfaceVariant; + return Colours.palette.m3onSurface; + } + + text: root.code.length > 0 ? qsTr("Press Enter to execute: %1").arg(root.code) : qsTr("Type Python code to execute") + elide: Text.ElideLeft + + Layout.fillWidth: true + Layout.alignment: Qt.AlignVCenter + } + + StyledRect { + color: Colours.palette.m3tertiary + radius: Appearance.rounding.normal + clip: true + + implicitWidth: (stateLayer.containsMouse ? label.implicitWidth + label.anchors.rightMargin : 0) + icon.implicitWidth + Appearance.padding.normal * 2 + implicitHeight: Math.max(label.implicitHeight, icon.implicitHeight) + Appearance.padding.small * 2 + + Layout.alignment: Qt.AlignVCenter + + StateLayer { + id: stateLayer + + color: Colours.palette.m3onTertiary + + function onClicked(): void { + const escapedCode = root.code.replace(/'/g, "'\\''"); + Quickshell.execDetached(["app2unit", "--", ...Config.general.apps.terminal, "fish", "-C", `python3 -i -c '${escapedCode}'`]); + root.list.visibilities.launcher = false; + } + } + + StyledText { + id: label + + anchors.verticalCenter: parent.verticalCenter + anchors.right: icon.left + anchors.rightMargin: Appearance.spacing.small + + text: qsTr("Open in terminal") + color: Colours.palette.m3onTertiary + font.pointSize: Appearance.font.size.normal + + opacity: stateLayer.containsMouse ? 1 : 0 + + Behavior on opacity { + Anim {} + } + } + + MaterialIcon { + id: icon + + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Appearance.padding.normal + + text: "open_in_new" + color: Colours.palette.m3onTertiary + font.pointSize: Appearance.font.size.large + } + + Behavior on implicitWidth { + Anim { + easing.bezierCurve: Appearance.anim.curves.emphasized + } + } + } + } +} -- cgit v1.2.3-freya From 2ebdba6cc4a6b3fe6acd3498c774d2ed8678eb2a Mon Sep 17 00:00:00 2001 From: ATMDA Date: Thu, 13 Nov 2025 13:57:35 -0500 Subject: launcher: reverted python launcher item to not exist, changes back to c0ea060f --- config/LauncherConfig.qml | 8 --- modules/launcher/AppList.qml | 18 +---- modules/launcher/Content.qml | 2 +- modules/launcher/items/PythonItem.qml | 124 ---------------------------------- 4 files changed, 2 insertions(+), 150 deletions(-) delete mode 100644 modules/launcher/items/PythonItem.qml (limited to 'modules/launcher') diff --git a/config/LauncherConfig.qml b/config/LauncherConfig.qml index 30b3e8b..9d9c50c 100644 --- a/config/LauncherConfig.qml +++ b/config/LauncherConfig.qml @@ -38,14 +38,6 @@ JsonObject { enabled: true, dangerous: false }, - { - name: "Python", - icon: "code", - description: "Execute Python one-liners", - command: ["autocomplete", "python"], - enabled: true, - dangerous: false - }, { name: "Scheme", icon: "palette", diff --git a/modules/launcher/AppList.qml b/modules/launcher/AppList.qml index 6217237..7f7b843 100644 --- a/modules/launcher/AppList.qml +++ b/modules/launcher/AppList.qml @@ -52,7 +52,7 @@ StyledListView { const text = search.text; const prefix = Config.launcher.actionPrefix; if (text.startsWith(prefix)) { - for (const action of ["calc", "python", "scheme", "variant"]) + for (const action of ["calc", "scheme", "variant"]) if (text.startsWith(`${prefix}${action} `)) return action; @@ -92,14 +92,6 @@ StyledListView { root.delegate: calcItem } }, - State { - name: "python" - - PropertyChanges { - model.values: [0] - root.delegate: pythonItem - } - }, State { name: "scheme" @@ -247,14 +239,6 @@ StyledListView { } } - Component { - id: pythonItem - - PythonItem { - list: root - } - } - Component { id: schemeItem diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index 3a90a74..f674569 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -90,7 +90,7 @@ Item { Wallpapers.setWallpaper(currentItem.modelData.path); root.visibilities.launcher = false; } else if (text.startsWith(Config.launcher.actionPrefix)) { - if (text.startsWith(`${Config.launcher.actionPrefix}calc `) || text.startsWith(`${Config.launcher.actionPrefix}python `)) + if (text.startsWith(`${Config.launcher.actionPrefix}calc `)) currentItem.onClicked(); else currentItem.modelData.onClicked(list.currentList); diff --git a/modules/launcher/items/PythonItem.qml b/modules/launcher/items/PythonItem.qml deleted file mode 100644 index 8384e71..0000000 --- a/modules/launcher/items/PythonItem.qml +++ /dev/null @@ -1,124 +0,0 @@ -import qs.components -import qs.services -import qs.config -import Quickshell -import QtQuick -import QtQuick.Layouts - -Item { - id: root - - required property var list - readonly property string code: list.search.text.slice(`${Config.launcher.actionPrefix}python `.length) - - function onClicked(): void { - // Execute Python code and copy result to clipboard - // Escape single quotes in code for shell safety - const escapedCode = root.code.replace(/'/g, "'\\''"); - Quickshell.execDetached(["sh", "-c", `python3 -c '${escapedCode}' 2>&1 | wl-copy`]); - root.list.visibilities.launcher = false; - } - - implicitHeight: Config.launcher.sizes.itemHeight - - anchors.left: parent?.left - anchors.right: parent?.right - - StateLayer { - radius: Appearance.rounding.normal - - function onClicked(): void { - root.onClicked(); - } - } - - RowLayout { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.larger - - spacing: Appearance.spacing.normal - - MaterialIcon { - text: "code" - font.pointSize: Appearance.font.size.extraLarge - Layout.alignment: Qt.AlignVCenter - } - - StyledText { - id: result - - color: { - if (!root.code) - return Colours.palette.m3onSurfaceVariant; - return Colours.palette.m3onSurface; - } - - text: root.code.length > 0 ? qsTr("Press Enter to execute: %1").arg(root.code) : qsTr("Type Python code to execute") - elide: Text.ElideLeft - - Layout.fillWidth: true - Layout.alignment: Qt.AlignVCenter - } - - StyledRect { - color: Colours.palette.m3tertiary - radius: Appearance.rounding.normal - clip: true - - implicitWidth: (stateLayer.containsMouse ? label.implicitWidth + label.anchors.rightMargin : 0) + icon.implicitWidth + Appearance.padding.normal * 2 - implicitHeight: Math.max(label.implicitHeight, icon.implicitHeight) + Appearance.padding.small * 2 - - Layout.alignment: Qt.AlignVCenter - - StateLayer { - id: stateLayer - - color: Colours.palette.m3onTertiary - - function onClicked(): void { - const escapedCode = root.code.replace(/'/g, "'\\''"); - Quickshell.execDetached(["app2unit", "--", ...Config.general.apps.terminal, "fish", "-C", `python3 -i -c '${escapedCode}'`]); - root.list.visibilities.launcher = false; - } - } - - StyledText { - id: label - - anchors.verticalCenter: parent.verticalCenter - anchors.right: icon.left - anchors.rightMargin: Appearance.spacing.small - - text: qsTr("Open in terminal") - color: Colours.palette.m3onTertiary - font.pointSize: Appearance.font.size.normal - - opacity: stateLayer.containsMouse ? 1 : 0 - - Behavior on opacity { - Anim {} - } - } - - MaterialIcon { - id: icon - - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Appearance.padding.normal - - text: "open_in_new" - color: Colours.palette.m3onTertiary - font.pointSize: Appearance.font.size.large - } - - Behavior on implicitWidth { - Anim { - easing.bezierCurve: Appearance.anim.curves.emphasized - } - } - } - } -} -- cgit v1.2.3-freya From 7023a72ef1ad21b96aae1bbf820f2181df837f9b Mon Sep 17 00:00:00 2001 From: ATMDA Date: Sat, 15 Nov 2025 17:07:27 -0500 Subject: controlcenter: corrected wallpaper flicker issue --- .../controlcenter/appearance/AppearancePane.qml | 79 +++++++++++----------- modules/launcher/items/WallpaperItem.qml | 1 + shell | 1 + 3 files changed, 42 insertions(+), 39 deletions(-) create mode 160000 shell (limited to 'modules/launcher') diff --git a/modules/controlcenter/appearance/AppearancePane.qml b/modules/controlcenter/appearance/AppearancePane.qml index ba95977..baf49cf 100644 --- a/modules/controlcenter/appearance/AppearancePane.qml +++ b/modules/controlcenter/appearance/AppearancePane.qml @@ -1049,10 +1049,10 @@ RowLayout { Layout.preferredHeight: 140 Layout.minimumWidth: 200 Layout.minimumHeight: 140 + Layout.maximumWidth: 200 + Layout.maximumHeight: 140 readonly property bool isCurrent: modelData.path === Wallpapers.actualCurrent - readonly property real imageWidth: Math.max(1, width) - readonly property real imageHeight: Math.max(1, height) StateLayer { radius: Appearance.rounding.normal @@ -1069,71 +1069,72 @@ RowLayout { color: Colours.tPalette.m3surfaceContainer radius: Appearance.rounding.normal - border.width: isCurrent ? 2 : 0 - border.color: Colours.palette.m3primary - CachingImage { id: cachingImage path: modelData.path anchors.fill: parent + cache: true + visible: opacity > 0 - // Ensure sourceSize is always set to valid dimensions - sourceSize: Qt.size(Math.max(1, Math.floor(parent.width)), Math.max(1, Math.floor(parent.height))) - - // Show when ready, hide if fallback is showing - opacity: status === Image.Ready && !fallbackImage.visible ? 1 : 0 + // Show when ready + opacity: status === Image.Ready ? 1 : 0 Behavior on opacity { NumberAnimation { - duration: 200 + duration: 150 + easing.type: Easing.OutQuad } } } - // Fallback: Direct image load if caching fails or is slow + // Fallback image for when caching fails Image { id: fallbackImage anchors.fill: parent - source: modelData.path + source: fallbackTimer.triggered && cachingImage.status !== Image.Ready ? modelData.path : "" asynchronous: true fillMode: Image.PreserveAspectCrop - sourceSize: Qt.size(Math.max(1, Math.floor(parent.width)), Math.max(1, Math.floor(parent.height))) - - // Show if caching image hasn't loaded after a delay + cache: true visible: opacity > 0 - opacity: 0 - - Timer { - id: fallbackTimer - interval: 500 - running: cachingImage.status === Image.Loading || (cachingImage.status !== Image.Ready && cachingImage.status !== Image.Null) - onTriggered: { - if (cachingImage.status !== Image.Ready && fallbackImage.status === Image.Ready) { - fallbackImage.opacity = 1; - } - } - } - // Also check status changes - onStatusChanged: { - if (status === Image.Ready && cachingImage.status !== Image.Ready) { - Qt.callLater(() => { - if (cachingImage.status !== Image.Ready) { - fallbackImage.opacity = 1; - } - }); - } - } + opacity: status === Image.Ready && cachingImage.status !== Image.Ready ? 1 : 0 Behavior on opacity { NumberAnimation { - duration: 200 + duration: 150 + easing.type: Easing.OutQuad } } } + // Timer to trigger fallback only if caching hasn't loaded + Timer { + id: fallbackTimer + + property bool triggered: false + interval: 800 + running: cachingImage.status === Image.Loading || cachingImage.status === Image.Null + onTriggered: triggered = true + } + } + + // Border overlay that doesn't affect image size + Rectangle { + anchors.fill: parent + color: "transparent" + radius: Appearance.rounding.normal + border.width: isCurrent ? 2 : 0 + border.color: Colours.palette.m3primary + + Behavior on border.width { + NumberAnimation { + duration: 150 + easing.type: Easing.OutQuad + } + } + MaterialIcon { anchors.right: parent.right anchors.top: parent.top diff --git a/modules/launcher/items/WallpaperItem.qml b/modules/launcher/items/WallpaperItem.qml index 1128bad..9fdac3f 100644 --- a/modules/launcher/items/WallpaperItem.qml +++ b/modules/launcher/items/WallpaperItem.qml @@ -67,6 +67,7 @@ Item { CachingImage { path: root.modelData.path smooth: !root.PathView.view.moving + cache: true anchors.fill: parent } diff --git a/shell b/shell new file mode 160000 index 0000000..442b49e --- /dev/null +++ b/shell @@ -0,0 +1 @@ +Subproject commit 442b49e0e1975d51efcef90d10566c90dedbf7e1 -- cgit v1.2.3-freya From 4ada7ea608711aa21f8bfc51698e7a3ec261aeeb Mon Sep 17 00:00:00 2001 From: ATMDA Date: Sat, 15 Nov 2025 17:16:52 -0500 Subject: controlcenter: corrected certain containers not respecting transparency layers --- components/SectionContainer.qml | 2 +- components/controls/FilledSlider.qml | 2 +- components/controls/SpinBoxRow.qml | 2 +- components/controls/StyledSlider.qml | 2 +- components/controls/SwitchRow.qml | 2 +- modules/controlcenter/audio/AudioPane.qml | 4 ++-- modules/controlcenter/launcher/LauncherPane.qml | 4 ++-- modules/launcher/Content.qml | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) (limited to 'modules/launcher') diff --git a/components/SectionContainer.qml b/components/SectionContainer.qml index d41254b..f7dfef4 100644 --- a/components/SectionContainer.qml +++ b/components/SectionContainer.qml @@ -15,7 +15,7 @@ StyledRect { implicitHeight: contentColumn.implicitHeight + Appearance.padding.large * 2 radius: Appearance.rounding.normal - color: Colours.tPalette.m3surfaceContainer + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) ColumnLayout { id: contentColumn diff --git a/components/controls/FilledSlider.qml b/components/controls/FilledSlider.qml index 78b8a5c..80dd44c 100644 --- a/components/controls/FilledSlider.qml +++ b/components/controls/FilledSlider.qml @@ -15,7 +15,7 @@ Slider { orientation: Qt.Vertical background: StyledRect { - color: Colours.tPalette.m3surfaceContainer + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) radius: Appearance.rounding.full StyledRect { diff --git a/components/controls/SpinBoxRow.qml b/components/controls/SpinBoxRow.qml index 2507b80..4902627 100644 --- a/components/controls/SpinBoxRow.qml +++ b/components/controls/SpinBoxRow.qml @@ -19,7 +19,7 @@ StyledRect { Layout.fillWidth: true implicitHeight: row.implicitHeight + Appearance.padding.large * 2 radius: Appearance.rounding.normal - color: Colours.tPalette.m3surfaceContainer + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) Behavior on implicitHeight { Anim {} diff --git a/components/controls/StyledSlider.qml b/components/controls/StyledSlider.qml index 92c8aa8..55e8c8d 100644 --- a/components/controls/StyledSlider.qml +++ b/components/controls/StyledSlider.qml @@ -32,7 +32,7 @@ Slider { implicitWidth: parent.width - root.handle.x - root.handle.implicitWidth - root.implicitHeight / 6 - color: Colours.tPalette.m3surfaceContainer + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) radius: Appearance.rounding.full topLeftRadius: root.implicitHeight / 15 bottomLeftRadius: root.implicitHeight / 15 diff --git a/components/controls/SwitchRow.qml b/components/controls/SwitchRow.qml index 0ec7aa5..7fa3e1b 100644 --- a/components/controls/SwitchRow.qml +++ b/components/controls/SwitchRow.qml @@ -17,7 +17,7 @@ StyledRect { Layout.fillWidth: true implicitHeight: row.implicitHeight + Appearance.padding.large * 2 radius: Appearance.rounding.normal - color: Colours.tPalette.m3surfaceContainer + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) Behavior on implicitHeight { Anim {} diff --git a/modules/controlcenter/audio/AudioPane.qml b/modules/controlcenter/audio/AudioPane.qml index 005de3a..1c0c770 100644 --- a/modules/controlcenter/audio/AudioPane.qml +++ b/modules/controlcenter/audio/AudioPane.qml @@ -127,7 +127,7 @@ RowLayout { Layout.fillWidth: true - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, Audio.sink?.id === modelData.id ? Colours.tPalette.m3surfaceContainer.a : 0) + color: Audio.sink?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" radius: Appearance.rounding.normal StateLayer { @@ -205,7 +205,7 @@ RowLayout { Layout.fillWidth: true - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, Audio.source?.id === modelData.id ? Colours.tPalette.m3surfaceContainer.a : 0) + color: Audio.source?.id === modelData.id ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" radius: Appearance.rounding.normal StateLayer { diff --git a/modules/controlcenter/launcher/LauncherPane.qml b/modules/controlcenter/launcher/LauncherPane.qml index 12abc1e..dc7a7a7 100644 --- a/modules/controlcenter/launcher/LauncherPane.qml +++ b/modules/controlcenter/launcher/LauncherPane.qml @@ -218,7 +218,7 @@ RowLayout { Layout.topMargin: Appearance.spacing.normal Layout.bottomMargin: Appearance.spacing.small - color: Colours.tPalette.m3surfaceContainer + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) radius: Appearance.rounding.full implicitHeight: Math.max(searchIcon.implicitHeight, searchField.implicitHeight, clearIcon.implicitHeight) @@ -317,7 +317,7 @@ RowLayout { readonly property bool isSelected: root.selectedApp === modelData - color: Qt.alpha(Colours.tPalette.m3surfaceContainer, isSelected ? Colours.tPalette.m3surfaceContainer.a : 0) + color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" radius: Appearance.rounding.normal StateLayer { diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index f674569..c085976 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -47,7 +47,7 @@ Item { StyledRect { id: searchWrapper - color: Colours.tPalette.m3surfaceContainer + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) radius: Appearance.rounding.full anchors.left: parent.left -- cgit v1.2.3-freya