mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
feat: allow centering widgets via taskbar right-click
This commit is contained in:
@@ -5,6 +5,8 @@ import Quickshell
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
signal requestCenter(string identifier)
|
||||
|
||||
readonly property list<var> availableWidgets: [
|
||||
{ identifier: "crosshair", materialSymbol: "point_scan" },
|
||||
{ identifier: "fpsLimiter", materialSymbol: "animation" },
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user