bar brightness scroll

This commit is contained in:
end-4
2025-04-11 20:43:18 +02:00
parent 06fc4baf4e
commit d77e4f14bf
3 changed files with 81 additions and 2 deletions
@@ -9,6 +9,7 @@ Rectangle {
required property var bar
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(bar.screen)
readonly property Toplevel activeWindow: ToplevelManager.activeToplevel
property int preferredWidth: 400
height: parent.height
width: colLayout.width
@@ -25,13 +26,17 @@ Rectangle {
StyledText {
font.pointSize: Appearance.font.pointSize.smaller
color: Appearance.colors.colSubtext
text: activeWindow.activated ? activeWindow?.appId : "Desktop"
Layout.preferredWidth: preferredWidth
elide: Text.ElideRight
text: activeWindow?.activated ? activeWindow?.appId : "Desktop"
}
StyledText {
font.pointSize: Appearance.font.pointSize.small
color: Appearance.colors.colOnLayer0
text: activeWindow.activated ? activeWindow?.title : `Workspace ${monitor.activeWorkspace?.id}`
Layout.preferredWidth: preferredWidth
elide: Text.ElideRight
text: activeWindow?.activated ? activeWindow?.title : `Workspace ${monitor.activeWorkspace?.id}`
}
}
+11
View File
@@ -30,6 +30,17 @@ Scope {
ActiveWindow {
bar: barRoot
}
// Scroll to switch workspaces
WheelHandler {
onWheel: (event) => {
if (event.angleDelta.y < 0)
Brightness.value = -1;
else if (event.angleDelta.y > 0)
Brightness.value = 1;
}
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
}
}