From d2a8d0b563a965993e982fdb92d89c0378b3c066 Mon Sep 17 00:00:00 2001 From: lucy Date: Wed, 24 Dec 2025 15:41:03 +0100 Subject: [PATCH] steal reverse corners from noctalia --- modules/bar/Colors.qml => Colors.qml | 0 modules/bar/Appearance.qml | 2 +- modules/bar/Bar.qml | 2 +- modules/bar/Battery.qml | 25 +++- modules/bar/Clock.qml | 1 + modules/bar/Volume.qml | 1 + modules/bar/Workspaces.qml | 5 +- modules/notifications/NotiPopup.qml | 12 +- modules/wallpaper/Overlay.qml | 38 ++++++ modules/wallpaper/ScreenCorners.qml | 178 +++++++++++++++++++++++++++ modules/wallpaper/WallSwitcher.qml | 1 + modules/wallpaper/Wallpaper.qml | 3 +- modules/wallpaper/qmldir | 2 + shell.qml | 1 + 14 files changed, 262 insertions(+), 9 deletions(-) rename modules/bar/Colors.qml => Colors.qml (100%) create mode 100644 modules/wallpaper/Overlay.qml create mode 100644 modules/wallpaper/ScreenCorners.qml diff --git a/modules/bar/Colors.qml b/Colors.qml similarity index 100% rename from modules/bar/Colors.qml rename to Colors.qml diff --git a/modules/bar/Appearance.qml b/modules/bar/Appearance.qml index e132a8f..1a7c411 100644 --- a/modules/bar/Appearance.qml +++ b/modules/bar/Appearance.qml @@ -3,5 +3,5 @@ import QtQuick QtObject { readonly property string font: "JetBrainsMono Nerd Font" - readonly property real fontSize: 12 + readonly property real fontSize: 14 } diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index d46c8c3..239908e 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -1,7 +1,7 @@ import Quickshell import QtQuick -import qs.modules.bar import QtQuick.Layouts +import qs PanelWindow { id: root diff --git a/modules/bar/Battery.qml b/modules/bar/Battery.qml index 34eeaf1..55c143d 100644 --- a/modules/bar/Battery.qml +++ b/modules/bar/Battery.qml @@ -1,6 +1,8 @@ import Quickshell.Services.UPower import QtQuick import Quickshell.Widgets +import "." +import qs Item { id: root @@ -9,7 +11,7 @@ Item { Row { id: batRow anchors.centerIn: parent - spacing: 0 + spacing: 5 IconImage { anchors.verticalCenter: parent.verticalCenter source: "root:/icons/" + UPower.displayDevice.iconName + ".svg" @@ -25,5 +27,26 @@ Item { color: Colors.foreground text: Math.round(UPower.displayDevice.percentage * 100) + "%" } + Text { + id: powerProfile + text: PowerProfile.toString(PowerProfiles.profile) + font.weight: 900 + color: Colors.foreground + font.family: Appearance.font + font.pixelSize: Appearance.fontSize + } + } + MouseArea { + acceptedButtons: Qt.LeftButton + cursorShape: Qt.OpenHandCursor + anchors.fill: parent + onClicked: { + const modes = [PowerProfile.PowerSaver, PowerProfile.Balanced, PowerProfile.Performance]; + let current = PowerProfiles.profile; + let currentIndex = modes.indexOf(current); + let nextIndex = (currentIndex + 1) % modes.length; + PowerProfiles.profile = modes[nextIndex]; + PowerProfiles.profile = profiles[nextIndex]; + } } } diff --git a/modules/bar/Clock.qml b/modules/bar/Clock.qml index 4427ce9..112c019 100644 --- a/modules/bar/Clock.qml +++ b/modules/bar/Clock.qml @@ -1,5 +1,6 @@ import QtQuick import Quickshell +import qs Item { id: root diff --git a/modules/bar/Volume.qml b/modules/bar/Volume.qml index a4a48f1..ed83e7d 100644 --- a/modules/bar/Volume.qml +++ b/modules/bar/Volume.qml @@ -2,6 +2,7 @@ import QtQuick import Quickshell.Services.Pipewire import Quickshell.Widgets import Quickshell.Io +import qs Item { id: root diff --git a/modules/bar/Workspaces.qml b/modules/bar/Workspaces.qml index a408f74..5aaa706 100644 --- a/modules/bar/Workspaces.qml +++ b/modules/bar/Workspaces.qml @@ -1,6 +1,7 @@ import Quickshell.Hyprland import QtQuick import QtQuick.Layouts +import qs Item { id: root @@ -14,8 +15,8 @@ Item { Repeater { id: workspaceRepeater Rectangle { - width: 14 - height: 14 + width: 16 + height: 16 radius: 10 //color: modelData.active ? myPallete.accent : myPallete.window color: modelData.active ? Colors.foreground : "transparent" diff --git a/modules/notifications/NotiPopup.qml b/modules/notifications/NotiPopup.qml index f487aee..afba908 100644 --- a/modules/notifications/NotiPopup.qml +++ b/modules/notifications/NotiPopup.qml @@ -1,7 +1,7 @@ import QtQuick import Quickshell import Quickshell.Wayland -import qs.modules.bar +import qs import "." import QtQuick.Layouts @@ -49,16 +49,23 @@ WlrLayershell { // ... other imports // Inside your ListView... + model: NotifServer.trackedNotifications delegate: Item { width: ListView.view.width height: 60 // Fixed height is usually better for icon layouts required property var modelData + Timer { + id: timout + interval: 5000 + running: true + onRunningChanged: modelData.dismiss() + } Rectangle { anchors.fill: parent color: Colors.background - radius: 10 + radius: 20 border.color: Colors.color5 // 2. Use RowLayout to put Image | Text side-by-side @@ -124,6 +131,5 @@ WlrLayershell { } } } - model: NotifServer.trackedNotifications } } diff --git a/modules/wallpaper/Overlay.qml b/modules/wallpaper/Overlay.qml new file mode 100644 index 0000000..7425d53 --- /dev/null +++ b/modules/wallpaper/Overlay.qml @@ -0,0 +1,38 @@ +import QtQuick +import Quickshell +import Quickshell.Wayland +import "." // <--- Ensures we can find ScreenCorners.qml + +WlrLayershell { + id: overlayRoot + + // 1. Fill the entire screen + anchors { + top: true + bottom: true + left: true + right: true + } + + // 2. Sit on top of EVERYTHING (even fullscreen apps if compositor allows) + layer: WlrLayer.Overlay + + // 3. Invisible background + color: "transparent" + + // 4. 👻 GHOST MODE ENABLED 👻 + // An empty Region means "I accept mouse events nowhere". + // This guarantees you can click through the black corners. + mask: Region {} + + // 5. Load the corners! + ScreenCorners { + // Adjust these to match your screen's aesthetic + cornerRadius: 25 + cornerColor: "black" + shouldShow: true + + // Ensure it stays on top of any other items in this window + z: 999 + } +} diff --git a/modules/wallpaper/ScreenCorners.qml b/modules/wallpaper/ScreenCorners.qml new file mode 100644 index 0000000..d539b09 --- /dev/null +++ b/modules/wallpaper/ScreenCorners.qml @@ -0,0 +1,178 @@ +import QtQuick +import QtQuick.Shapes +import qs + +// removed "import qs.Commons" because you don't have it! + +Item { + id: root + anchors.fill: parent + + // --------------------------------------------------------- + // 🛠️ CONFIGURATION (Tweaked to match your setup) + // --------------------------------------------------------- + + // How round do you want the screen? + property real cornerRadius: 20 + + // What color should the corners be? (Usually black to match the bezel) + // You can change this to "transparent" or a theme color if you want. + property color cornerColor: Colors.background + + // Enable/Disable toggle + property bool shouldShow: true + + // --------------------------------------------------------- + + // Wrapper with layer caching to reduce GPU usage + Item { + anchors.fill: parent + layer.enabled: true + + Shape { + id: cornersShape + anchors.fill: parent + preferredRendererType: Shape.CurveRenderer + enabled: false // Click-through + + ShapePath { + id: cornersPath + + // Map our local properties to the variables the code expects + readonly property real cornerRadius: root.cornerRadius + readonly property real cornerSize: root.cornerRadius // Usually same as radius + + // Margins (Leave 0 unless your bar overlaps) + readonly property real topMargin: 0 + readonly property real bottomMargin: 0 + readonly property real leftMargin: 0 + readonly property real rightMargin: 0 + + readonly property real screenWidth: cornersShape.width + readonly property real screenHeight: cornersShape.height + + strokeWidth: -1 // No outline + fillColor: Colors.background + + // Smooth fade if you toggle it + + // ========================================== + // 📐 GEOMETRY LOGIC (Untouched) + // ========================================== + + // Top-Left + startX: leftMargin + startY: topMargin + PathLine { + relativeX: cornersPath.cornerSize + relativeY: 0 + } + PathLine { + relativeX: 0 + relativeY: cornersPath.cornerSize - cornersPath.cornerRadius + } + PathArc { + relativeX: -cornersPath.cornerRadius + relativeY: cornersPath.cornerRadius + radiusX: cornersPath.cornerRadius + radiusY: cornersPath.cornerRadius + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: -(cornersPath.cornerSize - cornersPath.cornerRadius) + relativeY: 0 + } + PathLine { + relativeX: 0 + relativeY: -cornersPath.cornerSize + } + + // Top-Right + PathMove { + x: cornersPath.screenWidth - cornersPath.rightMargin - cornersPath.cornerSize + y: cornersPath.topMargin + } + PathLine { + relativeX: cornersPath.cornerSize + relativeY: 0 + } + PathLine { + relativeX: 0 + relativeY: cornersPath.cornerSize + } + PathLine { + relativeX: -(cornersPath.cornerSize - cornersPath.cornerRadius) + relativeY: 0 + } + PathArc { + relativeX: -cornersPath.cornerRadius + relativeY: -cornersPath.cornerRadius + radiusX: cornersPath.cornerRadius + radiusY: cornersPath.cornerRadius + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: 0 + relativeY: -(cornersPath.cornerSize - cornersPath.cornerRadius) + } + // Bottom-Left + PathMove { + x: cornersPath.leftMargin + y: cornersPath.screenHeight - cornersPath.bottomMargin - cornersPath.cornerSize + } + PathLine { + relativeX: cornersPath.cornerSize - cornersPath.cornerRadius + relativeY: 0 + } + PathArc { + relativeX: cornersPath.cornerRadius + relativeY: cornersPath.cornerRadius + radiusX: cornersPath.cornerRadius + radiusY: cornersPath.cornerRadius + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: 0 + relativeY: cornersPath.cornerSize - cornersPath.cornerRadius + } + PathLine { + relativeX: -cornersPath.cornerSize + relativeY: 0 + } + PathLine { + relativeX: 0 + relativeY: -cornersPath.cornerSize + } + + // Bottom-Right + PathMove { + x: cornersPath.screenWidth - cornersPath.rightMargin + y: cornersPath.screenHeight - cornersPath.bottomMargin + } + PathLine { + relativeX: -cornersPath.cornerSize + relativeY: 0 + } + PathLine { + relativeX: 0 + relativeY: -(cornersPath.cornerSize - cornersPath.cornerRadius) + } + PathArc { + relativeX: cornersPath.cornerRadius + relativeY: -cornersPath.cornerRadius + radiusX: cornersPath.cornerRadius + radiusY: cornersPath.cornerRadius + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: cornersPath.cornerSize - cornersPath.cornerRadius + relativeY: 0 + } + PathLine { + relativeX: 0 + relativeY: cornersPath.cornerSize + } + } + } + } +} diff --git a/modules/wallpaper/WallSwitcher.qml b/modules/wallpaper/WallSwitcher.qml index 78edfc6..5100e68 100644 --- a/modules/wallpaper/WallSwitcher.qml +++ b/modules/wallpaper/WallSwitcher.qml @@ -5,6 +5,7 @@ import Quickshell.Hyprland import Quickshell.Io import "." import qs.modules.bar +import qs FloatingWindow { id: root diff --git a/modules/wallpaper/Wallpaper.qml b/modules/wallpaper/Wallpaper.qml index 57f7894..6d814a2 100644 --- a/modules/wallpaper/Wallpaper.qml +++ b/modules/wallpaper/Wallpaper.qml @@ -2,10 +2,11 @@ import QtQuick import Quickshell import Quickshell.Wayland import "." -import Quickshell.Io +import qs WlrLayershell { id: root + // Inside your Wallpaper Window // 1. Send it to the bottom of the stack! layer: WlrLayer.Background diff --git a/modules/wallpaper/qmldir b/modules/wallpaper/qmldir index 4d71e10..67b126a 100644 --- a/modules/wallpaper/qmldir +++ b/modules/wallpaper/qmldir @@ -1,3 +1,5 @@ singleton WallpaperStore 1.0 WallpaperStore.qml Wallpaper 1.0 Wallpaper.qml WallSwitcher 1.0 WallSwitcher.qml +Overlay 1.0 Overlay.qml +ScreenCorners 1.0 ScreenCorners.qml diff --git a/shell.qml b/shell.qml index f9cde87..f6efafe 100644 --- a/shell.qml +++ b/shell.qml @@ -22,4 +22,5 @@ Scope { } } NotiPopup {} + Overlay {} }