From 4d6f58a9143d5c14e783099cc7dbaf00d6441bd8 Mon Sep 17 00:00:00 2001 From: ar-Raqmi Date: Wed, 4 Feb 2026 23:23:35 +0800 Subject: [PATCH] feat: allow centering widgets via taskbar right-click --- .../quickshell/ii/modules/ii/overlay/OverlayContext.qml | 2 ++ .../quickshell/ii/modules/ii/overlay/OverlayTaskbar.qml | 1 + .../ii/modules/ii/overlay/StyledOverlayWidget.qml | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/dots/.config/quickshell/ii/modules/ii/overlay/OverlayContext.qml b/dots/.config/quickshell/ii/modules/ii/overlay/OverlayContext.qml index bb68cefc3..2d1174d10 100644 --- a/dots/.config/quickshell/ii/modules/ii/overlay/OverlayContext.qml +++ b/dots/.config/quickshell/ii/modules/ii/overlay/OverlayContext.qml @@ -5,6 +5,8 @@ import Quickshell Singleton { id: root + signal requestCenter(string identifier) + readonly property list availableWidgets: [ { identifier: "crosshair", materialSymbol: "point_scan" }, { identifier: "fpsLimiter", materialSymbol: "animation" }, diff --git a/dots/.config/quickshell/ii/modules/ii/overlay/OverlayTaskbar.qml b/dots/.config/quickshell/ii/modules/ii/overlay/OverlayTaskbar.qml index 232903474..b182a2ffa 100644 --- a/dots/.config/quickshell/ii/modules/ii/overlay/OverlayTaskbar.qml +++ b/dots/.config/quickshell/ii/modules/ii/overlay/OverlayTaskbar.qml @@ -119,6 +119,7 @@ Rectangle { Layout.alignment: Qt.AlignVCenter toggled: Persistent.states.overlay.open.includes(identifier) + altAction: () => OverlayContext.requestCenter(identifier) onClicked: { if (widgetButton.toggled) { Persistent.states.overlay.open = Persistent.states.overlay.open.filter(type => type !== identifier); diff --git a/dots/.config/quickshell/ii/modules/ii/overlay/StyledOverlayWidget.qml b/dots/.config/quickshell/ii/modules/ii/overlay/StyledOverlayWidget.qml index b3cf1e74a..37d889fd8 100644 --- a/dots/.config/quickshell/ii/modules/ii/overlay/StyledOverlayWidget.qml +++ b/dots/.config/quickshell/ii/modules/ii/overlay/StyledOverlayWidget.qml @@ -105,6 +105,15 @@ AbstractOverlayWidget { reportClickableState(); } + Connections { + target: OverlayContext + function onRequestCenter(identifier) { + if (identifier === root.identifier) { + root.center() + } + } + } + // Hooks onPressed: (event) => { // We're only interested in handling resize here