bar: fix scroll areas

This commit is contained in:
2 * r + 2 * t 2025-06-02 21:09:19 +10:00
parent 24a3da8138
commit 05d8a6a7cb
2 changed files with 34 additions and 32 deletions

View file

@ -4,7 +4,6 @@ import "root:/config"
import "components" import "components"
import "components/workspaces" import "components/workspaces"
import Quickshell import Quickshell
import Quickshell.Widgets
import QtQuick import QtQuick
StyledRect { StyledRect {
@ -13,10 +12,10 @@ StyledRect {
required property ShellScreen screen required property ShellScreen screen
function checkPopout(y: real): var { function checkPopout(y: real): var {
const aw = activeWindow.child const aw = activeWindow.child;
const awy = activeWindow.y + aw.y const awy = activeWindow.y + aw.y;
if (y >= awy && y <= awy + aw.implicitHeight) { if (y >= awy && y <= awy + aw.implicitHeight) {
Popouts.currentName = "activewindow" Popouts.currentName = "activewindow";
Popouts.currentCenter = Qt.binding(() => activeWindow.y + aw.y + aw.implicitHeight / 2); Popouts.currentCenter = Qt.binding(() => activeWindow.y + aw.y + aw.implicitHeight / 2);
Popouts.hasCurrent = true; Popouts.hasCurrent = true;
} else { } else {
@ -83,20 +82,6 @@ StyledRect {
} }
} }
MouseArea {
anchors.top: workspaces.bottom
anchors.bottom: activeWindow.top
anchors.left: parent.left
anchors.right: parent.right
onWheel: event => {
if (event.angleDelta.y > 0)
Audio.setVolume(Audio.volume + 0.1);
else if (event.angleDelta.y < 0)
Audio.setVolume(Audio.volume - 0.1);
}
}
ActiveWindow { ActiveWindow {
id: activeWindow id: activeWindow
@ -104,21 +89,8 @@ StyledRect {
anchors.top: workspaces.bottom anchors.top: workspaces.bottom
anchors.bottom: tray.top anchors.bottom: tray.top
anchors.margins: Appearance.spacing.large anchors.margins: Appearance.spacing.large
}
MouseArea { monitor: Brightness.getMonitorForScreen(root.screen)
anchors.top: workspaces.bottom
anchors.bottom: activeWindow.top
anchors.left: parent.left
anchors.right: parent.right
onWheel: event => {
const monitor = Brightness.getMonitorForScreen(root.screen);
if (event.angleDelta.y > 0)
monitor.setBrightness(monitor.brightness + 0.1);
else if (event.angleDelta.y < 0)
monitor.setBrightness(monitor.brightness - 0.1);
}
} }
Tray { Tray {

View file

@ -9,12 +9,42 @@ import QtQuick
Item { Item {
id: root id: root
required property Brightness.Monitor monitor
property color colour: Colours.palette.m3primary property color colour: Colours.palette.m3primary
readonly property Item child: child readonly property Item child: child
implicitWidth: child.implicitWidth implicitWidth: child.implicitWidth
implicitHeight: child.implicitHeight implicitHeight: child.implicitHeight
MouseArea {
anchors.top: parent.top
anchors.bottom: child.top
anchors.left: parent.left
anchors.right: parent.right
onWheel: event => {
if (event.angleDelta.y > 0)
Audio.setVolume(Audio.volume + 0.1);
else if (event.angleDelta.y < 0)
Audio.setVolume(Audio.volume - 0.1);
}
}
MouseArea {
anchors.top: child.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
onWheel: event => {
const monitor = root.monitor;
if (event.angleDelta.y > 0)
monitor.setBrightness(monitor.brightness + 0.1);
else if (event.angleDelta.y < 0)
monitor.setBrightness(monitor.brightness - 0.1);
}
}
Item { Item {
id: child id: child