forked from Shinonome/dots-hyprland
waffles: action center: volume menu
This commit is contained in:
+90
@@ -0,0 +1,90 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import qs
|
||||
import qs.services
|
||||
import qs.modules.common
|
||||
import qs.modules.common.functions
|
||||
import qs.modules.waffle.looks
|
||||
import qs.modules.waffle.actionCenter
|
||||
import qs.modules.waffle.actionCenter.volumeControl
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
property var screen: root.QsWindow.window?.screen
|
||||
property var brightnessMonitor: Brightness.getMonitorForScreen(screen)
|
||||
spacing: 12
|
||||
|
||||
RowLayout {
|
||||
spacing: 4
|
||||
|
||||
WPanelIconButton {
|
||||
color: colBackground
|
||||
property real animationValue: root.brightnessMonitor?.brightness ?? 0
|
||||
rotation: animationValue * 180
|
||||
scale: 0.8 + animationValue * 0.2
|
||||
iconName: "weather-sunny"
|
||||
|
||||
Behavior on animationValue {
|
||||
animation: Looks.transition.longMovement.createObject(this)
|
||||
}
|
||||
}
|
||||
|
||||
WSlider {
|
||||
Layout.fillWidth: true
|
||||
value: root.brightnessMonitor?.brightness ?? 0
|
||||
onMoved: {
|
||||
root.brightnessMonitor?.setBrightness(value)
|
||||
}
|
||||
}
|
||||
|
||||
WPanelIconButton {
|
||||
opacity: 0
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 4
|
||||
|
||||
WPanelIconButton {
|
||||
iconName: WIcons.volumeIcon
|
||||
onClicked: Audio.toggleMute();
|
||||
}
|
||||
|
||||
WSlider {
|
||||
Layout.fillWidth: true
|
||||
value: Audio.sink.audio.volume
|
||||
onMoved: {
|
||||
Audio.sink.audio.volume = value;
|
||||
}
|
||||
}
|
||||
|
||||
WPanelIconButton {
|
||||
Component {
|
||||
id: volumeControlComp
|
||||
VolumeControl {}
|
||||
}
|
||||
onClicked: {
|
||||
ActionCenterContext.push(volumeControlComp)
|
||||
}
|
||||
contentItem: Item {
|
||||
anchors.centerIn: parent
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
spacing: -1
|
||||
FluentIcon {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
implicitSize: 18
|
||||
icon: "options"
|
||||
}
|
||||
FluentIcon {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
implicitSize: 12
|
||||
icon: "chevron-right"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user