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