Notifications WIP
This commit is contained in:
@@ -9,9 +9,9 @@ Rectangle {
|
||||
|
||||
property string monitor: ""
|
||||
property string icon: " "
|
||||
property bool audioPipewireActive: Pipewire.defaultAudioSink? true:false
|
||||
property int volume: audioPipewireActive? Math.round(Pipewire.defaultAudioSink.audio.volume * 100): 30
|
||||
property var sink: audioPipewireActive? Pipewire.defaultAudioSink : null
|
||||
property bool audioPipewireActive: Pipewire.defaultAudioSink ? true : false
|
||||
property var sink: audioPipewireActive ? Pipewire.defaultAudioSink : null
|
||||
property int volume: audioPipewireActive ? Math.round(sink.audio.volume * 100) : 30
|
||||
|
||||
implicitWidth: audioText.implicitWidth * 1.6
|
||||
implicitHeight: Theme.heightGaps
|
||||
@@ -20,12 +20,11 @@ Rectangle {
|
||||
states: [
|
||||
State {
|
||||
name: "Mute"
|
||||
when: audioWidget.volume == 0
|
||||
when: audioWidget.volume == 0 || audioWidget.sink.audio.muted
|
||||
|
||||
PropertyChanges {
|
||||
audioWidget.icon: " "
|
||||
}
|
||||
|
||||
},
|
||||
State {
|
||||
name: "low volume"
|
||||
@@ -34,7 +33,6 @@ Rectangle {
|
||||
PropertyChanges {
|
||||
audioWidget.icon: " "
|
||||
}
|
||||
|
||||
},
|
||||
State {
|
||||
name: "high volume"
|
||||
@@ -43,7 +41,6 @@ Rectangle {
|
||||
PropertyChanges {
|
||||
audioWidget.icon: " "
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
@@ -56,13 +53,13 @@ Rectangle {
|
||||
audioWidget.volume = Math.round(Pipewire.defaultAudioSink.audio.volume * 100);
|
||||
}
|
||||
|
||||
target: audioWidget.audioPipewireActive? Pipewire.defaultAudioSink.audio: null
|
||||
target: audioWidget.audioPipewireActive ? Pipewire.defaultAudioSink.audio : null
|
||||
}
|
||||
|
||||
Text {
|
||||
id: audioText
|
||||
|
||||
property string audioTextText: audioWidget.audioPipewireActive? audioWidget.icon + " " + Math.round(Pipewire.defaultAudioSink.audio.volume * 100).toString() + "%" : ""
|
||||
property string audioTextText: audioWidget.audioPipewireActive ? audioWidget.icon + " " + Math.round(Pipewire.defaultAudioSink.audio.volume * 100).toString() + "%" : ""
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: audioTextText
|
||||
@@ -81,26 +78,31 @@ Rectangle {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
PopUpHover.start(audioWidget,"audio")
|
||||
PopUpHover.start(audioWidget, "audio");
|
||||
}
|
||||
onExited: {
|
||||
// PopUpHover.exit()
|
||||
PopUpHover.exit()
|
||||
PopUpHover.exit();
|
||||
}
|
||||
onClicked: {
|
||||
audioWidgetProcess.startDetached();
|
||||
onClicked: mouse => {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
parent.sink.audio.muted = !parent.sink.audio.muted;
|
||||
} else if (mouse.button === Qt.LeftButton) {
|
||||
audioWidgetProcess.startDetached();
|
||||
}
|
||||
}
|
||||
onWheel: (wheel) => {
|
||||
onWheel: wheel => {
|
||||
if (wheel.angleDelta.y > 0) {
|
||||
if (0)
|
||||
return ;
|
||||
return;
|
||||
|
||||
Pipewire.defaultAudioSink.audio.volume = (audioWidget.volume + 5) / 100;
|
||||
} else if (wheel.angleDelta.y < 0) {
|
||||
if (0)
|
||||
return ;
|
||||
return;
|
||||
|
||||
Pipewire.defaultAudioSink.audio.volume = (audioWidget.volume - 5) / 100;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user