mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-04 22:49:50 -05:00
feat: proper volume control center, still not done though
This commit is contained in:
parent
102fa853a8
commit
99eb6956bd
10 changed files with 140 additions and 256 deletions
|
|
@ -2,6 +2,7 @@ pragma ComponentBehavior: Bound
|
|||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Effects
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.Pipewire
|
||||
import qs.widgets
|
||||
|
|
@ -49,12 +50,29 @@ StyledMouseArea {
|
|||
|
||||
// Default Audio
|
||||
VolumeCard {
|
||||
id: defaultCard
|
||||
node: menu.sink
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: menu.entryHeight
|
||||
|
||||
leftWidget: StyledMouseArea {
|
||||
onClicked: defaultCard.node.audio.muted = !defaultCard.node.audio.muted
|
||||
|
||||
IconImage {
|
||||
anchors.fill: parent
|
||||
source: {
|
||||
if (defaultCard.node.audio.muted) {
|
||||
return "root:resources/volume/volume-mute.svg";
|
||||
} else {
|
||||
return "root:resources/volume/volume-full.svg";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: linkTracker.linkGroups.length !== 0
|
||||
color: ShellSettings.colors.active_translucent
|
||||
radius: height / 2
|
||||
Layout.leftMargin: 3
|
||||
|
|
@ -64,34 +82,55 @@ StyledMouseArea {
|
|||
}
|
||||
|
||||
// Application Mixer
|
||||
Loader {
|
||||
id: sinkLoader
|
||||
active: menu.sink
|
||||
PwNodeLinkTracker {
|
||||
id: linkTracker
|
||||
node: menu.sink
|
||||
}
|
||||
|
||||
StyledListView {
|
||||
id: appList
|
||||
visible: linkTracker.linkGroups.length !== 0
|
||||
spacing: 6
|
||||
model: linkTracker.linkGroups
|
||||
clip: true
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 5 * menu.entryHeight
|
||||
Layout.preferredHeight: {
|
||||
const entryHeight = Math.min(5, linkTracker.linkGroups.length);
|
||||
|
||||
PwNodeLinkTracker {
|
||||
id: linkTracker
|
||||
node: menu.sink
|
||||
return entryHeight * (menu.entryHeight + appList.spacing);
|
||||
}
|
||||
|
||||
sourceComponent: ListView {
|
||||
anchors.fill: parent
|
||||
spacing: 6
|
||||
model: linkTracker.linkGroups
|
||||
delegate: VolumeCard {
|
||||
id: appCard
|
||||
node: modelData.source
|
||||
label: node.properties["media.name"] ?? ""
|
||||
width: ListView.view.width
|
||||
height: menu.entryHeight
|
||||
|
||||
delegate: Loader {
|
||||
id: nodeLoader
|
||||
active: modelData.source != null
|
||||
width: ListView.view.width
|
||||
height: menu.entryHeight
|
||||
required property PwLinkGroup modelData
|
||||
|
||||
required property PwLinkGroup modelData
|
||||
leftWidget: StyledMouseArea {
|
||||
onClicked: appCard.node.audio.muted = !appCard.node.audio.muted
|
||||
|
||||
sourceComponent: VolumeCard {
|
||||
node: nodeLoader.modelData.source
|
||||
label: node.properties["media.name"] ?? ""
|
||||
IconImage {
|
||||
id: appIcon
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
|
||||
source: {
|
||||
if (appCard.node.properties["application.icon-name"] !== undefined)
|
||||
return `image://icon/${appCard.node.properties["application.icon-name"]}`;
|
||||
|
||||
let applicationName = appCard.node.properties["application.name"];
|
||||
return `image://icon/${applicationName?.toLowerCase() ?? "image-missing"}`;
|
||||
}
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
source: appIcon
|
||||
anchors.fill: appIcon
|
||||
saturation: appCard.node.audio.muted ? -1.0 : 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue