From 41ccd5c4605dc8916e9f6f0fc73de365de855495 Mon Sep 17 00:00:00 2001 From: kossLAN Date: Fri, 11 Jul 2025 13:39:16 -0400 Subject: [PATCH] progress save --- shell/bar/Bar.qml | 18 +- shell/bar/power/BatteryIndicator.qml | 3 +- shell/bar/systray/SysTray.qml | 2 +- shell/settings/Controller.qml | 249 ++---------------- shell/settings/WallpaperPicker.qml | 135 ++++++++++ shell/wallpaper/Controller.qml | 39 --- shell/widgets/IconButton.qml | 1 - ...MaterialButton.qml => StyledMouseArea.qml} | 0 shell/widgets/{TabBar.qml => TopBar.qml} | 4 +- 9 files changed, 164 insertions(+), 287 deletions(-) create mode 100644 shell/settings/WallpaperPicker.qml rename shell/widgets/{MaterialButton.qml => StyledMouseArea.qml} (100%) rename shell/widgets/{TabBar.qml => TopBar.qml} (93%) diff --git a/shell/bar/Bar.qml b/shell/bar/Bar.qml index 7116975..101a4cd 100644 --- a/shell/bar/Bar.qml +++ b/shell/bar/Bar.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Layouts import Quickshell import "power" -import "volume" +// import "volume" import "systray" as SysTray import "popups" as Popup import "../widgets" as Widgets @@ -72,14 +72,14 @@ PanelWindow { Layout.fillHeight: true } - VolumeIndicator { - id: volumeIndicator - popup: root.popup - Layout.preferredWidth: this.height - Layout.fillHeight: true - Layout.topMargin: 2 - Layout.bottomMargin: 2 - } + // VolumeIndicator { + // id: volumeIndicator + // popup: root.popup + // Layout.preferredWidth: this.height + // Layout.fillHeight: true + // Layout.topMargin: 2 + // Layout.bottomMargin: 2 + // } BatteryIndicator { id: batteryIndicator diff --git a/shell/bar/power/BatteryIndicator.qml b/shell/bar/power/BatteryIndicator.qml index 41681d9..0603017 100644 --- a/shell/bar/power/BatteryIndicator.qml +++ b/shell/bar/power/BatteryIndicator.qml @@ -1,7 +1,6 @@ pragma ComponentBehavior: Bound import QtQuick -import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects import Quickshell.Widgets @@ -17,7 +16,7 @@ Item { required property var popup - Widgets.MaterialButton { + Widgets.StyledMouseArea { id: batteryButton hoverEnabled: true onClicked: { diff --git a/shell/bar/systray/SysTray.qml b/shell/bar/systray/SysTray.qml index b572e3b..87f2fe5 100644 --- a/shell/bar/systray/SysTray.qml +++ b/shell/bar/systray/SysTray.qml @@ -23,7 +23,7 @@ RowLayout { Layout.fillHeight: true required property SystemTrayItem modelData - Widgets.MaterialButton { + Widgets.StyledMouseArea { id: trayButton hoverEnabled: true onClicked: { diff --git a/shell/settings/Controller.qml b/shell/settings/Controller.qml index 987d47f..e2fc879 100644 --- a/shell/settings/Controller.qml +++ b/shell/settings/Controller.qml @@ -3,11 +3,9 @@ pragma ComponentBehavior: Bound import Quickshell import Quickshell.Io -import Quickshell.Widgets import QtQuick import QtQuick.Layouts -import Qt5Compat.GraphicalEffects -import Qt.labs.folderlistmodel +import "../widgets/" as Widgets import "../" Singleton { @@ -63,242 +61,25 @@ Singleton { } ColumnLayout { - id: container - spacing: 5 + spacing: 20 + anchors.fill: parent - anchors { - fill: parent - margins: 10 - } - - ClippingRectangle { - radius: 20 - Layout.preferredWidth: 464 - Layout.preferredHeight: 261 - Layout.alignment: Qt.AlignCenter - Layout.margins: 20 - - Image { - id: wallpaperImage - source: ShellSettings.settings.wallpaperUrl - fillMode: Image.PreserveAspectFit - - anchors { - fill: parent - } - } - } - - Rectangle { - color: ShellSettings.colors["surface_container"] - radius: 20 + StackLayout { + id: page + currentIndex: topBar.currentIndex Layout.fillWidth: true - Layout.fillHeight: true + Layout.preferredHeight: currentItem ? currentItem.implicitHeight : 0 - ColumnLayout { - anchors.fill: parent + readonly property Item currentItem: children[currentIndex] - ListView { - id: horizontalList - orientation: ListView.Horizontal - model: ["scheme-content", "scheme-expressive", "scheme-fidelity", "scheme-fruit-salad", "scheme-monochrome", "scheme-neutral", "scheme-rainbow", "scheme-tonal-spot", "scheme-vibrant"] - spacing: 10 - clip: true + WallpaperPicker {} + } - Layout.fillWidth: true - Layout.preferredHeight: 100 - Layout.margins: 10 - - delegate: Rectangle { - id: paletteCell - required property string modelData - property string matugenConf: Qt.resolvedUrl("root:wallpaper/matugen.toml").toString().replace("file://", "") - property var colors: { - "primary": "white", - "secondary": "gray", - "tertiary": "lightgrey", - "container": "black" - } - - width: 100 - height: 100 - color: paletteSelect.containsMouse ? ShellSettings.colors["surface_container_highest"] : ShellSettings.colors["surface_container_high"] - radius: 20 - - MouseArea { - id: paletteSelect - hoverEnabled: true - anchors.fill: parent - onPressed: { - ShellSettings.settings.colorScheme = paletteCell.modelData; - } - } - - Item { - id: paletteContainer - width: 80 - height: 80 - anchors.centerIn: parent - - layer.enabled: true - layer.effect: OpacityMask { - maskSource: Rectangle { - width: paletteContainer.width - height: paletteContainer.height - radius: 20 - } - } - - Rectangle { - id: topLeft - color: paletteCell.colors["primary"] ?? "white" - width: parent.width / 2 - height: parent.height / 2 - } - - Rectangle { - id: topRight - color: paletteCell.colors["secondary"] ?? "gray" - width: parent.width / 2 - height: parent.height / 2 - anchors.left: topLeft.right - } - - Rectangle { - id: bottomLeft - color: paletteCell.colors["tertiary"] ?? "lightgrey" - width: parent.width / 2 - height: parent.height / 2 - anchors.top: topLeft.bottom - } - - Rectangle { - id: bottomRight - color: paletteCell.colors["surface"] ?? "black" - width: parent.width / 2 - height: parent.height / 2 - anchors { - top: topRight.bottom - left: bottomLeft.right - } - } - } - - Connections { - target: ShellSettings.settings - function onWallpaperUrlChanged() { - matugen.running = true; - } - } - - Process { - id: matugen - running: true - command: ["matugen", "image", ShellSettings.settings.wallpaperUrl.replace("file://", ""), "--type", paletteCell.modelData, "--json", "hex", "--config", paletteCell.matugenConf, "--dry-run"] - - stdout: SplitParser { - onRead: data => { - try { - paletteCell.colors = JSON.parse(data)['colors']['dark']; - } catch (e) { - console.error("Error parsing JSON:", e); - } - } - } - - stderr: SplitParser { - onRead: data => console.log(`line read: ${data}`) - } - } - } - } - - Rectangle { - color: ShellSettings.colors["surface_container_high"] - Layout.fillWidth: true - Layout.preferredHeight: 1 - } - - GridView { - id: wallpaperGrid - cellWidth: 200 - cellHeight: 200 - clip: true - Layout.fillWidth: true - Layout.fillHeight: true - Layout.margins: 10 - - model: FolderListModel { - id: folderModel - folder: Qt.resolvedUrl("root:resources/wallpapers") - nameFilters: ["*.jpg", "*.png"] - } - - delegate: Rectangle { - id: cell - required property var modelData - width: 200 - height: 200 - color: "transparent" - - Item { - anchors.fill: parent - - Rectangle { - id: border - visible: mouseArea.containsMouse - color: "transparent" - radius: 20 - - border { - color: ShellSettings.colors["primary"] - width: 2 - } - - anchors { - fill: parent - margins: 1 - } - } - - Image { - id: image - source: cell.modelData.fileUrl - fillMode: Image.PreserveAspectCrop - asynchronous: true - - sourceSize { - height: image.height - width: image.width - } - - anchors { - fill: parent - margins: 5 - } - - layer.enabled: true - layer.effect: OpacityMask { - maskSource: Rectangle { - width: cell.width - height: cell.height - radius: 20 - } - } - } - } - - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - onClicked: { - ShellSettings.settings.wallpaperUrl = cell.modelData.fileUrl; - } - } - } - } - } + Widgets.TopBar { + id: topBar + model: ["headphones", "tune"] + Layout.fillWidth: true + Layout.preferredHeight: 35 } } } diff --git a/shell/settings/WallpaperPicker.qml b/shell/settings/WallpaperPicker.qml new file mode 100644 index 0000000..25d9ae0 --- /dev/null +++ b/shell/settings/WallpaperPicker.qml @@ -0,0 +1,135 @@ +pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Layouts +import Quickshell.Widgets +import Qt5Compat.GraphicalEffects +import Qt.labs.folderlistmodel +import ".." + +ColumnLayout { + id: container + spacing: 5 + + + + // anchors { + // fill: parent + // margins: 10 + // } + + ClippingRectangle { + radius: 20 + Layout.preferredWidth: 464 + Layout.preferredHeight: 261 + Layout.alignment: Qt.AlignCenter + Layout.margins: 20 + + Image { + id: wallpaperImage + source: ShellSettings.settings.wallpaperUrl + fillMode: Image.PreserveAspectFit + + anchors { + fill: parent + } + } + } + + Rectangle { + color: ShellSettings.colors["surface_container"] + radius: 20 + Layout.fillWidth: true + Layout.fillHeight: true + + ColumnLayout { + anchors.fill: parent + + Rectangle { + color: ShellSettings.colors["surface_container_high"] + Layout.fillWidth: true + Layout.preferredHeight: 1 + } + + GridView { + id: wallpaperGrid + cellWidth: 200 + cellHeight: 200 + clip: true + Layout.fillWidth: true + Layout.fillHeight: true + Layout.margins: 10 + + model: FolderListModel { + id: folderModel + folder: Qt.resolvedUrl("root:resources/wallpapers") + nameFilters: ["*.jpg", "*.png"] + } + + delegate: Rectangle { + id: cell + required property var modelData + width: 200 + height: 200 + color: "transparent" + + Item { + anchors.fill: parent + + Rectangle { + id: border + visible: mouseArea.containsMouse + color: "transparent" + radius: 20 + + border { + color: ShellSettings.colors["primary"] + width: 2 + } + + anchors { + fill: parent + margins: 1 + } + } + + Image { + id: image + source: cell.modelData.fileUrl + fillMode: Image.PreserveAspectCrop + asynchronous: true + + sourceSize { + height: image.height + width: image.width + } + + anchors { + fill: parent + margins: 5 + } + + layer.enabled: true + layer.effect: OpacityMask { + maskSource: Rectangle { + width: cell.width + height: cell.height + radius: 20 + } + } + } + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: { + ShellSettings.settings.wallpaperUrl = cell.modelData.fileUrl; + } + } + } + } + } + } +} diff --git a/shell/wallpaper/Controller.qml b/shell/wallpaper/Controller.qml index 4230c95..443bacc 100644 --- a/shell/wallpaper/Controller.qml +++ b/shell/wallpaper/Controller.qml @@ -1,11 +1,9 @@ import Quickshell -import Quickshell.Io import QtQuick import ".." Scope { id: root - property string matugenConf: Qt.resolvedUrl("matugen.toml").toString().replace("file://", "") LazyLoader { loading: true @@ -40,43 +38,6 @@ Scope { function onWallpaperUrlChanged() { console.log("Switching wallpaper: " + ShellSettings.settings.wallpaperUrl); - matugen.running = true; - } - - function onColorSchemeChanged() { - console.log("Switching color scheme: " + ShellSettings.settings.colorScheme); - matugen.running = true; - } - } - - Process { - id: matugen - running: false - - // Don't format this lol - command: [ - "matugen", - "image", - ShellSettings.settings.wallpaperUrl.replace("file://", ""), - "--type", - ShellSettings.settings.colorScheme, - "--json", - "hex", - "--config", - root.matugenConf - ] - - stdout: SplitParser { - onRead: data => { - console.log(ShellSettings.settings.colorScheme); - try { - ShellSettings.colors = JSON.parse(data)['colors']['dark']; - } catch (e) {} - } - } - - stderr: SplitParser { - onRead: data => console.log(`line read: ${data}`) } } } diff --git a/shell/widgets/IconButton.qml b/shell/widgets/IconButton.qml index 119c971..8f7ca52 100644 --- a/shell/widgets/IconButton.qml +++ b/shell/widgets/IconButton.qml @@ -1,6 +1,5 @@ import QtQuick import Quickshell.Widgets -import Qt5Compat.GraphicalEffects import ".." Item { diff --git a/shell/widgets/MaterialButton.qml b/shell/widgets/StyledMouseArea.qml similarity index 100% rename from shell/widgets/MaterialButton.qml rename to shell/widgets/StyledMouseArea.qml diff --git a/shell/widgets/TabBar.qml b/shell/widgets/TopBar.qml similarity index 93% rename from shell/widgets/TabBar.qml rename to shell/widgets/TopBar.qml index 7ac2f3c..048e2ac 100644 --- a/shell/widgets/TabBar.qml +++ b/shell/widgets/TopBar.qml @@ -29,10 +29,11 @@ Item { property bool checked: index === root.currentIndex onClicked: { - currentIndex = index; + currentIndex = button.index; root.updateSelectionBarPosition(); } + // Change to SVG Icon FontIcon { text: button.modelData fill: { @@ -79,6 +80,7 @@ Item { } } + // Change to icons being greyed out by default but selected is full white function updateSelectionBarPosition() { if (buttonRepeater.count > 0) { var buttonWidth = buttonGroup.width / buttonRepeater.count;