summaryrefslogtreecommitdiff
path: root/modules/osd
diff options
context:
space:
mode:
Diffstat (limited to 'modules/osd')
-rw-r--r--modules/osd/Content.qml4
-rw-r--r--modules/osd/Osd.qml60
2 files changed, 37 insertions, 27 deletions
diff --git a/modules/osd/Content.qml b/modules/osd/Content.qml
index daab4e2..b224bf6 100644
--- a/modules/osd/Content.qml
+++ b/modules/osd/Content.qml
@@ -7,7 +7,7 @@ import QtQuick
Column {
id: root
- required property ShellScreen screen
+ required property Brightness.Monitor monitor
padding: Appearance.padding.large
@@ -35,6 +35,8 @@ Column {
VerticalSlider {
icon: "brightness_6"
+ value: root.monitor?.brightness ?? 0
+ onMoved: root.monitor?.setBrightness(value)
implicitWidth: OsdConfig.sizes.sliderWidth
implicitHeight: OsdConfig.sizes.sliderHeight
diff --git a/modules/osd/Osd.qml b/modules/osd/Osd.qml
index 4d744f6..4d6ab7e 100644
--- a/modules/osd/Osd.qml
+++ b/modules/osd/Osd.qml
@@ -4,47 +4,55 @@ import "root:/config"
import Quickshell
import QtQuick
-Scope {
- id: root
+Variants {
+ model: Quickshell.screens
- property bool osdVisible
+ Scope {
+ id: root
- function show(): void {
- root.osdVisible = true;
- timer.restart();
- }
-
- Connections {
- target: Audio
+ required property ShellScreen modelData
+ readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(modelData)
+ property bool osdVisible
- function onMutedChanged(): void {
- root.show();
+ function show(): void {
+ root.osdVisible = true;
+ timer.restart();
}
- function onVolumeChanged(): void {
- root.show();
+ Connections {
+ target: Audio
+
+ function onMutedChanged(): void {
+ root.show();
+ }
+
+ function onVolumeChanged(): void {
+ root.show();
+ }
}
- }
- Timer {
- id: timer
+ Connections {
+ target: root.monitor
- interval: OsdConfig.hideDelay
- onTriggered: root.osdVisible = false
- }
+ function onBrightnessChanged(): void {
+ root.show();
+ }
+ }
- Variants {
- model: Quickshell.screens
+ Timer {
+ id: timer
+
+ interval: OsdConfig.hideDelay
+ onTriggered: root.osdVisible = false
+ }
LazyLoader {
loading: true
- required property ShellScreen modelData
-
StyledWindow {
id: win
- screen: parent.modelData
+ screen: root.modelData
name: "osd"
visible: wrapper.shouldBeVisible
@@ -80,7 +88,7 @@ Scope {
Content {
id: content
- screen: parent.modelData
+ monitor: root.monitor
}
}
}