From b82a3580eca5b9d4c21fbf1717021ab48c3c000a Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Sat, 19 Jul 2025 00:36:05 +0200 Subject: [PATCH] quickshell: a bunch of changes --- modules/style/quickshell/quickshell.mod.nix | 5 + modules/style/quickshell/shell/AudioPopup.qml | 110 +++++++++--------- modules/style/quickshell/shell/Launcher.qml | 14 +-- .../style/quickshell/shell/ReloadPopup.qml | 2 +- .../style/quickshell/shell/config/Colors.qml | 25 ++++ .../style/quickshell/shell/config/Config.qml | 18 --- .../shell/modules/BackgroundImage.qml | 41 +++++-- .../shell/modules/bar/components/Clock.qml | 4 +- .../modules/bar/components/Workspaces.qml | 6 +- .../shell/modules/drawers/Drawers.qml | 6 +- modules/style/quickshell/shell/shell.qml | 6 +- 11 files changed, 137 insertions(+), 100 deletions(-) create mode 100644 modules/style/quickshell/shell/config/Colors.qml diff --git a/modules/style/quickshell/quickshell.mod.nix b/modules/style/quickshell/quickshell.mod.nix index 3c41f20..275bbfb 100644 --- a/modules/style/quickshell/quickshell.mod.nix +++ b/modules/style/quickshell/quickshell.mod.nix @@ -19,6 +19,11 @@ in { qt6.qt5compat qt6.qtmultimedia qt6.qtdeclarative + qt6.qtsvg + qt6.qtwayland + qt6.qtbase + kdePackages.breeze + kdePackages.breeze-icons ]; # taken from outfoxxed. diff --git a/modules/style/quickshell/shell/AudioPopup.qml b/modules/style/quickshell/shell/AudioPopup.qml index b8e27ee..383a9ef 100644 --- a/modules/style/quickshell/shell/AudioPopup.qml +++ b/modules/style/quickshell/shell/AudioPopup.qml @@ -1,103 +1,105 @@ -pragma Singleton pragma ComponentBehavior: Bound +pragma Singleton import QtQuick import Quickshell import QtQuick.Layouts -import Quickshell.Wayland import Quickshell.Services.Pipewire +import Quickshell.Wayland + +import qs.config Singleton { - id: audioPopup - property bool popupOpen: true + id: root - property var volume: sink.ready ? audioPopup.sink.audio.volume : 0 + property real volume: Pipewire.defaultAudioSink?.audio?.volume ?? 0 + property real popupOpacity: 0 - property var visible: volume - - property PwNode sink: Pipewire.defaultAudioSink - - // bind the node so we can read its properties PwObjectTracker { - objects: [audioPopup.sink] + objects: [Pipewire.defaultAudioSink] } - Timer { - id: timer - interval: 3000 - running: false - repeat: false - - onTriggered: audioPopup.visible = false + onVolumeChanged: { + root.popupOpacity = 1; + loader.activeAsync = true; + timer.restart(); + timer_opacity.restart(); } LazyLoader { id: loader - activeAsync: audioPopup.popupOpen + activeAsync: false PanelWindow { id: popup - width: 400 - height: 30 visible: true - - // Give the window an empty click mask so all clicks pass through it. + implicitWidth: rect.implicitWidth + implicitHeight: 50 + color: "transparent" mask: Region {} - - // Use the wlroots specific layer property to ensure it displays over - // fullscreen windows. + exclusionMode: ExclusionMode.Ignore WlrLayershell.layer: WlrLayer.Overlay - color: "transparent" - - anchors { - bottom: true - } - - margins { - bottom: 250 - } + anchors.bottom: true + margins.bottom: 100 Rectangle { id: rect Layout.fillWidth: true - anchors.verticalCenter: parent.verticalCenter - color: "white" - height: parent.height - width: parent.width + anchors.fill: parent + color: Colors.surface0 + implicitWidth: 300 + implicitHeight: parent.implicitHeight radius: 5 - opacity: 0 + opacity: root.popupOpacity - anchors { - left: parent.left - } - - Behavior on width { + Behavior on opacity { NumberAnimation { - duration: 200 + duration: 500 easing.type: Easing.OutCubic } } Rectangle { - color: "black" - height: 20 - radius: height / 2 + id: bar + color: Colors.blue + implicitWidth: rect.implicitWidth * root.volume - 20 + implicitHeight: 30 + topRightRadius: 5 + bottomRightRadius: 5 anchors { left: parent.left + verticalCenter: parent.verticalCenter } - topLeftRadius: 0 - bottomLeftRadius: 0 - - anchors.verticalCenter: parent.verticalCenter - width: parent.width * audioPopup.sink.audio.volume + Behavior on implicitWidth { + NumberAnimation { + duration: 300 + easing.type: Easing.OutCubic + } + } } } } } + Timer { + id: timer + interval: 2000 + running: false + onTriggered: loader.activeAsync = false + } + + Timer { + id: timer_opacity + interval: 1500 + running: false + onTriggered: { + root.popupOpacity = 0; + } + } + function init() { } } diff --git a/modules/style/quickshell/shell/Launcher.qml b/modules/style/quickshell/shell/Launcher.qml index f434f81..0cfebfb 100644 --- a/modules/style/quickshell/shell/Launcher.qml +++ b/modules/style/quickshell/shell/Launcher.qml @@ -49,9 +49,9 @@ Singleton { } } width: 450 - color: Config.catppuccin.base + color: Colors.base radius: 5 - border.color: Config.catppuccin.mantle + border.color: Colors.mantle border.width: 2 ColumnLayout { @@ -64,9 +64,9 @@ Singleton { id: searchContainer Layout.fillWidth: true implicitHeight: searchbox.implicitHeight + 10 - color: Config.catppuccin.base + color: Colors.base radius: 3 - border.color: Config.catppuccin.mantle + border.color: Colors.mantle RowLayout { id: searchbox @@ -76,7 +76,7 @@ Singleton { TextInput { id: search Layout.fillWidth: true - color: Config.catppuccin.text + color: Colors.text font.pointSize: 13 focus: true @@ -252,7 +252,7 @@ Singleton { highlight: Rectangle { radius: 5 color: "transparent" - border.color: Config.catppuccin.lavender + border.color: Colors.lavender border.width: 2 } keyNavigationEnabled: true @@ -293,7 +293,7 @@ Singleton { } Text { text: modelData.name - color: Config.catppuccin.text + color: Colors.text font.family: "JetBrainsMono Nerd Font Mono" font.pointSize: 13 Layout.alignment: Qt.AlignVCenter diff --git a/modules/style/quickshell/shell/ReloadPopup.qml b/modules/style/quickshell/shell/ReloadPopup.qml index 9c6e2fc..513f814 100644 --- a/modules/style/quickshell/shell/ReloadPopup.qml +++ b/modules/style/quickshell/shell/ReloadPopup.qml @@ -106,7 +106,7 @@ Scope { property: "width" from: rect.width to: 0 - duration: failed ? 10000 : 800 + duration: root.failed ? 10000 : 800 onFinished: popupLoader.active = false // Pause the animation when the mouse is hovering over the popup, diff --git a/modules/style/quickshell/shell/config/Colors.qml b/modules/style/quickshell/shell/config/Colors.qml new file mode 100644 index 0000000..8f77553 --- /dev/null +++ b/modules/style/quickshell/shell/config/Colors.qml @@ -0,0 +1,25 @@ +pragma Singleton + +import QtQuick +import Quickshell + +Singleton { + id: root + + readonly property color base: "#1e1e2e" + readonly property color mantle: "#181825" + readonly property color surface0: "#313244" + readonly property color surface1: "#45475a" + readonly property color surface2: "#585b70" + readonly property color text: "#cdd6f4" + readonly property color rosewater: "#f5e0dc" + readonly property color lavender: "#b4befe" + readonly property color red: "#f38ba8" + readonly property color peach: "#fab387" + readonly property color yellow: "#f9e2af" + readonly property color green: "#a6e3a1" + readonly property color teal: "#a6e3a1" + readonly property color blue: "#89b4fa" + readonly property color mauve: "#cba6f7" + readonly property color flamingo: "#f2cdcd" +} diff --git a/modules/style/quickshell/shell/config/Config.qml b/modules/style/quickshell/shell/config/Config.qml index 7b4c1b5..9e44e32 100644 --- a/modules/style/quickshell/shell/config/Config.qml +++ b/modules/style/quickshell/shell/config/Config.qml @@ -25,24 +25,6 @@ Singleton { readonly property int rounding: 0 } - readonly property QtObject catppuccin: QtObject { - readonly property color base: "#1e1e2e" - readonly property color mantle: "#181825" - readonly property color surface0: "#313244" - readonly property color surface1: "#45475a" - readonly property color surface2: "#585b70" - readonly property color text: "#cdd6f4" - readonly property color rosewater: "#f5e0dc" - readonly property color lavender: "#b4befe" - readonly property color red: "#f38ba8" - readonly property color peach: "#fab387" - readonly property color yellow: "#f9e2af" - readonly property color green: "#a6e3a1" - readonly property color teal: "#a6e3a1" - readonly property color blue: "#89b4fa" - readonly property color mauve: "#cba6f7" - readonly property color flamingo: "#f2cdcd" - } readonly property QtObject volumeslider: QtObject { readonly property int width: 50 } diff --git a/modules/style/quickshell/shell/modules/BackgroundImage.qml b/modules/style/quickshell/shell/modules/BackgroundImage.qml index 600fb74..b0710aa 100644 --- a/modules/style/quickshell/shell/modules/BackgroundImage.qml +++ b/modules/style/quickshell/shell/modules/BackgroundImage.qml @@ -1,6 +1,7 @@ import QtQuick import Quickshell import Quickshell.Wayland +import Qt.labs.folderlistmodel 2.9 PanelWindow { id: root @@ -9,6 +10,24 @@ PanelWindow { WlrLayershell.layer: WlrLayer.Background WlrLayershell.namespace: "shell:background" + // property string basePath: "file:///home/cr/Documents/Backgrounds/" + // property var absPath: folderModel.get(Math.floor(Math.random() * folderModel.count), "filePath") + // property var finalPath: absPath + + // property bool _: log() + // function log() { + // console.log(absPath); + // console.log(folderModel.count); + // return true; + // } + FolderListModel { + id: folderModel + // folder: root.basePath + nameFilters: ["*.png"] + showDirs: false + showFiles: true + } + anchors { top: true bottom: true @@ -16,13 +35,21 @@ PanelWindow { right: true } - Item { - id: background - anchors.fill: parent - Image { - id: image - asynchronous: true - source: "/home/cr/repos/projects/nichts/modules/style/wholefoods.png" + // Item { + // id: background + // anchors.fill: parent + // Image { + // id: image + // source: Qt.resolvedUrl(root.finalPath) + // } + // } + Timer { + id: timer + // 10 minutes + interval: 1000 * 60 * 10 + running: false + onTriggered: { + root.popupOpacity = 0; } } } diff --git a/modules/style/quickshell/shell/modules/bar/components/Clock.qml b/modules/style/quickshell/shell/modules/bar/components/Clock.qml index a6337fa..78d8c30 100644 --- a/modules/style/quickshell/shell/modules/bar/components/Clock.qml +++ b/modules/style/quickshell/shell/modules/bar/components/Clock.qml @@ -9,7 +9,7 @@ Rectangle { width: text.width + 5 height: text.height + 5 implicitWidth: width - border.color: Config.catppuccin.rosewater + border.color: Colors.rosewater border.width: 0 radius: 5 color: "transparent" @@ -24,7 +24,7 @@ Rectangle { font.family: "JetBrainsMono NF Mono" font.pointSize: 15 - color: Config.catppuccin.text + color: Colors.text } SystemClock { diff --git a/modules/style/quickshell/shell/modules/bar/components/Workspaces.qml b/modules/style/quickshell/shell/modules/bar/components/Workspaces.qml index 1d8b254..404f13e 100644 --- a/modules/style/quickshell/shell/modules/bar/components/Workspaces.qml +++ b/modules/style/quickshell/shell/modules/bar/components/Workspaces.qml @@ -36,7 +36,7 @@ Rectangle { // height: workspaces.length * root.wsItemHeight implicitWidth: list.implicitWidth color: "transparent" - border.color: Config.catppuccin.rosewater + border.color: Colors.rosewater border.width: 0 radius: 7 @@ -93,9 +93,9 @@ Rectangle { height: wsItem.height - 5 width: parent.width * wsItem.animActive radius: height / 2 - border.color: Config.catppuccin.mantle + border.color: Colors.mantle border.width: 0 - color: Config.catppuccin.blue + color: Colors.blue } } } diff --git a/modules/style/quickshell/shell/modules/drawers/Drawers.qml b/modules/style/quickshell/shell/modules/drawers/Drawers.qml index 2c6e920..466182c 100644 --- a/modules/style/quickshell/shell/modules/drawers/Drawers.qml +++ b/modules/style/quickshell/shell/modules/drawers/Drawers.qml @@ -5,10 +5,10 @@ import Quickshell.Wayland import QtQuick import QtQuick.Effects -import "../bar" +import qs.modules.bar -import "../../config" -import "../" +import qs.config +import qs.modules Variants { model: Quickshell.screens diff --git a/modules/style/quickshell/shell/shell.qml b/modules/style/quickshell/shell/shell.qml index 2835944..0ff4469 100644 --- a/modules/style/quickshell/shell/shell.qml +++ b/modules/style/quickshell/shell/shell.qml @@ -1,5 +1,4 @@ //@ pragma Env QS_NO_RELOAD_POPUP=1 -//@ pragma Env QT_QML_GENERATE_QMLLS_INI import Quickshell import QtQuick @@ -10,10 +9,7 @@ import qs ShellRoot { id: shellroot - Component.onCompleted: [Launcher.init()] + Component.onCompleted: [Launcher.init(), AudioPopup.init()] Drawers {} - // Background {}Popup - // - }