bar: add scroll actions to fillers

Also change the brightness osd icon depending on value
This commit is contained in:
2 * r + 2 * t 2025-05-04 23:18:11 +10:00
parent d95c134717
commit cd45cafa60
5 changed files with 52 additions and 7 deletions

View file

@ -45,12 +45,16 @@ Variants {
Preset { Preset {
presetName: "pills" presetName: "pills"
sourceComponent: Pills {} sourceComponent: Pills {
screen: win.modelData
}
} }
Preset { Preset {
presetName: "panel" presetName: "panel"
sourceComponent: Panel {} sourceComponent: Panel {
screen: win.modelData
}
} }
} }

View file

@ -2,12 +2,15 @@ import "root:/widgets"
import "root:/config" import "root:/config"
import "components" import "components"
import "components/workspaces" import "components/workspaces"
import Quickshell
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
StyledRect { StyledRect {
id: root id: root
required property ShellScreen screen
function get(horiz, vert) { function get(horiz, vert) {
return BarConfig.vertical ? vert : horiz; return BarConfig.vertical ? vert : horiz;
} }
@ -47,9 +50,29 @@ StyledRect {
} }
} }
Item { MouseArea {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
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 {
Layout.fillWidth: true
Layout.fillHeight: true
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);
}
} }
Module { Module {

View file

@ -1,13 +1,17 @@
import "root:/widgets" import "root:/widgets"
import "root:/services"
import "root:/config" import "root:/config"
import "components" import "components"
import "components/workspaces" import "components/workspaces"
import Quickshell
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
BoxLayout { BoxLayout {
id: root id: root
required property ShellScreen screen
function get(horiz, vert) { function get(horiz, vert) {
return BarConfig.vertical ? vert : horiz; return BarConfig.vertical ? vert : horiz;
} }
@ -42,9 +46,16 @@ BoxLayout {
} }
} }
Item { MouseArea {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
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);
}
} }
Pill { Pill {
@ -56,9 +67,17 @@ BoxLayout {
} }
} }
Item { MouseArea {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
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);
}
} }
Pill { Pill {

View file

@ -34,7 +34,7 @@ Column {
} }
VerticalSlider { VerticalSlider {
icon: "brightness_6" icon: `brightness_${(Math.round(value * 6) + 1)}`
value: root.monitor?.brightness ?? 0 value: root.monitor?.brightness ?? 0
onMoved: root.monitor?.setBrightness(value) onMoved: root.monitor?.setBrightness(value)

View file

@ -99,7 +99,6 @@ Variants {
HoverHandler { HoverHandler {
id: hoverHandler id: hoverHandler
parent: win
onHoveredChanged: { onHoveredChanged: {
root.hovered = hovered; root.hovered = hovered;
if (hovered) if (hovered)