fix flyouts

This commit is contained in:
Damocles 2026-04-12 10:50:00 +02:00
parent 99f71f858d
commit bc3a85d18d
6 changed files with 8 additions and 16 deletions

View file

@ -1,5 +1,4 @@
import QtQuick
import Quickshell
import "." as M
Text {
@ -16,10 +15,8 @@ Text {
HoverHandler {
onHoveredChanged: {
if (hovered && root.tooltip !== "") {
const win = QsWindow.window
M.FlyoutState.text = root.tooltip
M.FlyoutState.itemX = root.mapToItem(win, root.width / 2, 0).x
M.FlyoutState.screen = win?.screen ?? null
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x
M.FlyoutState.visible = true
} else if (!hovered && root.tooltip !== "") {
M.FlyoutState.visible = false

View file

@ -1,5 +1,4 @@
import QtQuick
import Quickshell
import "." as M
Text {
@ -16,10 +15,8 @@ Text {
HoverHandler {
onHoveredChanged: {
if (hovered && root.tooltip !== "") {
const win = QsWindow.window
M.FlyoutState.text = root.tooltip
M.FlyoutState.itemX = root.mapToItem(win, root.width / 2, 0).x
M.FlyoutState.screen = win?.screen ?? null
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x
M.FlyoutState.visible = true
} else if (!hovered && root.tooltip !== "") {
M.FlyoutState.visible = false

View file

@ -1,5 +1,4 @@
import QtQuick
import Quickshell
import "." as M
Row {
@ -9,10 +8,8 @@ Row {
HoverHandler {
onHoveredChanged: {
if (hovered && root.tooltip !== "") {
const win = QsWindow.window
M.FlyoutState.text = root.tooltip
M.FlyoutState.itemX = root.mapToItem(win, root.width / 2, 0).x
M.FlyoutState.screen = win?.screen ?? null
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x
M.FlyoutState.visible = true
} else if (!hovered && root.tooltip !== "") {
M.FlyoutState.visible = false

View file

@ -8,7 +8,7 @@ PanelWindow {
required property var screen
visible: M.FlyoutState.visible && M.FlyoutState.screen === screen
visible: M.FlyoutState.visible
color: "transparent"
WlrLayershell.layer: WlrLayer.Overlay

View file

@ -5,5 +5,4 @@ QtObject {
property bool visible: false
property string text: ""
property real itemX: 0
property var screen: null
}

View file

@ -37,8 +37,10 @@ M.BarIcon {
onRunningChanged: if (!running && next !== "") proc.running = true
}
TapHandler {
onTapped: {
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
const cycle = ["performance", "balanced", "power-saver"];
const idx = cycle.indexOf(root.profile);
setter.next = cycle[(idx + 1) % cycle.length];