quickshell: a bunch of changes
This commit is contained in:
parent
8c6b9f65c9
commit
b82a3580ec
11 changed files with 137 additions and 100 deletions
|
@ -1,103 +1,105 @@
|
|||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Pipewire
|
||||
import Quickshell.Wayland
|
||||
|
||||
import qs.config
|
||||
|
||||
Singleton {
|
||||
id: audioPopup
|
||||
property bool popupOpen: true
|
||||
id: root
|
||||
|
||||
property var volume: sink.ready ? audioPopup.sink.audio.volume : 0
|
||||
property real volume: Pipewire.defaultAudioSink?.audio?.volume ?? 0
|
||||
property real popupOpacity: 0
|
||||
|
||||
property var visible: volume
|
||||
|
||||
property PwNode sink: Pipewire.defaultAudioSink
|
||||
|
||||
// bind the node so we can read its properties
|
||||
PwObjectTracker {
|
||||
objects: [audioPopup.sink]
|
||||
objects: [Pipewire.defaultAudioSink]
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 3000
|
||||
running: false
|
||||
repeat: false
|
||||
|
||||
onTriggered: audioPopup.visible = false
|
||||
onVolumeChanged: {
|
||||
root.popupOpacity = 1;
|
||||
loader.activeAsync = true;
|
||||
timer.restart();
|
||||
timer_opacity.restart();
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: loader
|
||||
activeAsync: audioPopup.popupOpen
|
||||
activeAsync: false
|
||||
|
||||
PanelWindow {
|
||||
id: popup
|
||||
width: 400
|
||||
height: 30
|
||||
visible: true
|
||||
|
||||
// Give the window an empty click mask so all clicks pass through it.
|
||||
implicitWidth: rect.implicitWidth
|
||||
implicitHeight: 50
|
||||
color: "transparent"
|
||||
mask: Region {}
|
||||
|
||||
// Use the wlroots specific layer property to ensure it displays over
|
||||
// fullscreen windows.
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
bottom: true
|
||||
}
|
||||
|
||||
margins {
|
||||
bottom: 250
|
||||
}
|
||||
anchors.bottom: true
|
||||
margins.bottom: 100
|
||||
|
||||
Rectangle {
|
||||
id: rect
|
||||
Layout.fillWidth: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: "white"
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
anchors.fill: parent
|
||||
color: Colors.surface0
|
||||
implicitWidth: 300
|
||||
implicitHeight: parent.implicitHeight
|
||||
radius: 5
|
||||
opacity: 0
|
||||
opacity: root.popupOpacity
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
Behavior on width {
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
duration: 500
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "black"
|
||||
height: 20
|
||||
radius: height / 2
|
||||
id: bar
|
||||
color: Colors.blue
|
||||
implicitWidth: rect.implicitWidth * root.volume - 20
|
||||
implicitHeight: 30
|
||||
topRightRadius: 5
|
||||
bottomRightRadius: 5
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
topLeftRadius: 0
|
||||
bottomLeftRadius: 0
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width * audioPopup.sink.audio.volume
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: 300
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 2000
|
||||
running: false
|
||||
onTriggered: loader.activeAsync = false
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer_opacity
|
||||
interval: 1500
|
||||
running: false
|
||||
onTriggered: {
|
||||
root.popupOpacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue