From 0a0a333472f719ccf9f1e552f51c8aa9f4ea0905 Mon Sep 17 00:00:00 2001 From: lucy Date: Thu, 15 Jan 2026 15:14:29 +0100 Subject: [PATCH] fix some things and create batter and volume impl --- modules/Bar/Bar.qml | 6 +++--- modules/Bar/Battery.qml | 36 ++++++++++++++++++++++++++++++++++ modules/Bar/PowerProfiles.qml | 0 modules/Bar/SystemTray.qml | 0 modules/Bar/Title.qml | 20 +++++++------------ modules/Bar/TrayItem.qml | 0 modules/Bar/Volume.qml | 20 +++++++++++++++++++ modules/overlays/Wallpaper.qml | 26 ++++++++++++++++++++++++ settings/Settings.qml | 1 + settings/config.json | 1 + shell.qml | 2 ++ 11 files changed, 96 insertions(+), 16 deletions(-) create mode 100644 modules/Bar/Battery.qml create mode 100644 modules/Bar/PowerProfiles.qml create mode 100644 modules/Bar/SystemTray.qml create mode 100644 modules/Bar/TrayItem.qml create mode 100644 modules/Bar/Volume.qml create mode 100644 modules/overlays/Wallpaper.qml diff --git a/modules/Bar/Bar.qml b/modules/Bar/Bar.qml index 087c2b2..f0b82fc 100644 --- a/modules/Bar/Bar.qml +++ b/modules/Bar/Bar.qml @@ -36,12 +36,12 @@ Variants { } Row { + spacing: 10 id: rightStuff anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - CustomText { - text: "status shit goes here" - } + Volume {} + Battery {} } } } diff --git a/modules/Bar/Battery.qml b/modules/Bar/Battery.qml new file mode 100644 index 0000000..a3bb5e7 --- /dev/null +++ b/modules/Bar/Battery.qml @@ -0,0 +1,36 @@ +import Quickshell +import Quickshell.Services.UPower +import QtQuick +import Quickshell.Widgets +import "../../reusables/" +import "../../" +import "../../settings/" + +Item { + id: root + implicitWidth: batRow.implicitWidth + implicitHeight: Settings.config.barHeight + Rectangle { + id: batRow + implicitWidth: batText.implicitWidth + batIcon.implicitWidth + 10 + color: "transparent" + + implicitHeight: Settings.config.barHeight + Row { + anchors.centerIn: batRow + anchors.verticalCenter: batRow.verticalCenter + CustomText { + id: batText + text: Math.round(UPower.displayDevice.percentage * 100) + "%" + } + + IconImage { + anchors.verticalCenter: batRow.verticalCenter + id: batIcon + source: Quickshell.iconPath(UPower.displayDevice.iconName) + implicitSize: 14 + } + + } + } +} diff --git a/modules/Bar/PowerProfiles.qml b/modules/Bar/PowerProfiles.qml new file mode 100644 index 0000000..e69de29 diff --git a/modules/Bar/SystemTray.qml b/modules/Bar/SystemTray.qml new file mode 100644 index 0000000..e69de29 diff --git a/modules/Bar/Title.qml b/modules/Bar/Title.qml index 1c01ca7..53c8cb4 100644 --- a/modules/Bar/Title.qml +++ b/modules/Bar/Title.qml @@ -6,19 +6,13 @@ import "../../" import Quickshell.Hyprland Item { - id: root + id: textContainer + implicitWidth: text.implicitWidth implicitHeight: Settings.config.barHeight - implicitWidth: textContainer.implicitWidth - Rectangle { - id: textContainer - color: Colors.foreground - implicitWidth: text.implicitWidth + 10 - implicitHeight: Settings.config.barHeight - CustomText { - id: text - color: Colors.background - anchors.centerIn: textContainer - text: Hyprland.activeToplevel.activated ? Hyprland.activeToplevel.title : "sigma" - } + CustomText { + id: text + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + text: Hyprland.activeToplevel.activated ? Hyprland.activeToplevel.title : "sigma" } } diff --git a/modules/Bar/TrayItem.qml b/modules/Bar/TrayItem.qml new file mode 100644 index 0000000..e69de29 diff --git a/modules/Bar/Volume.qml b/modules/Bar/Volume.qml new file mode 100644 index 0000000..a11df03 --- /dev/null +++ b/modules/Bar/Volume.qml @@ -0,0 +1,20 @@ +import Quickshell +import QtQuick +import Quickshell.Services.Pipewire +import "../../reusables/" +import "../../settings/" +import "../../" + +Item { + id: root + implicitWidth: volumeText.implicitWidth + 10 + implicitHeight: Settings.config.barHeight + CustomText { + id: volumeText + anchors.centerIn: parent + PwObjectTracker { + objects: Pipewire.ready ? Pipewire.defaultAudioSink : [] + } + text: Pipewire.ready ? Pipewire.defaultAudioSink.audio.muted ? "mut: " + Math.round(Pipewire.defaultAudioSink.audio.volume * 100) + "%" : "vol: " + Math.round(Pipewire.defaultAudioSink.audio.volume * 100) + "%" : "failure" + } +} diff --git a/modules/overlays/Wallpaper.qml b/modules/overlays/Wallpaper.qml new file mode 100644 index 0000000..2676172 --- /dev/null +++ b/modules/overlays/Wallpaper.qml @@ -0,0 +1,26 @@ +import Quickshell +import QtQuick +import Quickshell.Wayland +import "../../settings/" + +Variants { + id: root + model: Quickshell.screens + delegate: WlrLayershell { + required property var modelData + id: wpShell + anchors { + left: true + top: true + bottom: true + right: true + } + layer: WlrLayer.Background + Image { + fillMode: Image.Stretch + source: Settings.config.currentWall + width: modelData.width + height: modelData.height + } + } +} diff --git a/settings/Settings.qml b/settings/Settings.qml index 9b398f7..0a7e202 100644 --- a/settings/Settings.qml +++ b/settings/Settings.qml @@ -21,6 +21,7 @@ Singleton { adapter: JsonAdapter { id: settingsAdapter + property var currentWall: "/home/lucy/.walls/faris.jpg" property var barHeight: 18 property var font: "JetBrainsMono Nerd Font" property var fontSize: 12 diff --git a/settings/config.json b/settings/config.json index ffecfc6..03a50c7 100644 --- a/settings/config.json +++ b/settings/config.json @@ -1,5 +1,6 @@ { "barHeight": 18, + "currentWall": "/home/lucy/.walls/faris.jpg", "floating": true, "font": "JetBrainsMono Nerd Font", "fontSize": 12, diff --git a/shell.qml b/shell.qml index 8f55e84..1d1ac4d 100644 --- a/shell.qml +++ b/shell.qml @@ -2,8 +2,10 @@ import Quickshell import QtQuick import "./settings/" import "./modules/Bar/" +import "./modules/overlays/" ShellRoot { id: root Bar {} + Wallpaper {} }