forked from Shinonome/dots-hyprland
volume mixer: adjust layout
This commit is contained in:
@@ -11,55 +11,56 @@ import Quickshell.Services.Pipewire
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
required property PwNode node;
|
required property PwNode node
|
||||||
PwObjectTracker { objects: [ node ] }
|
PwObjectTracker {
|
||||||
|
objects: [node]
|
||||||
|
}
|
||||||
|
|
||||||
implicitHeight: rowLayout.implicitHeight
|
implicitHeight: rowLayout.implicitHeight
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: rowLayout
|
id: rowLayout
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 10
|
spacing: 6
|
||||||
|
|
||||||
|
Image {
|
||||||
|
property real size: slider.height * 0.9
|
||||||
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
|
visible: source != ""
|
||||||
|
sourceSize.width: size
|
||||||
|
sourceSize.height: size
|
||||||
|
source: {
|
||||||
|
let icon;
|
||||||
|
icon = AppSearch.guessIcon(root.node.properties["application.icon-name"]);
|
||||||
|
if (AppSearch.iconExists(icon))
|
||||||
|
return Quickshell.iconPath(icon, "image-missing");
|
||||||
|
icon = AppSearch.guessIcon(root.node.properties["node.name"]);
|
||||||
|
return Quickshell.iconPath(icon, "image-missing");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: 0
|
spacing: -4
|
||||||
|
|
||||||
RowLayout {
|
StyledText {
|
||||||
StyledText {
|
Layout.fillWidth: true
|
||||||
Layout.fillWidth: true
|
font.pixelSize: Appearance.font.pixelSize.small
|
||||||
font.pixelSize: Appearance.font.pixelSize.normal
|
color: Appearance.colors.colSubtext
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: {
|
text: {
|
||||||
// application.name -> description -> name
|
// application.name -> description -> name
|
||||||
const app = root.node.properties["application.name"] ?? (root.node.description != "" ? root.node.description : root.node.name);
|
const app = root.node.properties["application.name"] ?? (root.node.description != "" ? root.node.description : root.node.name);
|
||||||
const media = root.node.properties["media.name"];
|
const media = root.node.properties["media.name"];
|
||||||
return media != undefined ? `${app} • ${media}` : app;
|
return media != undefined ? `${app} • ${media}` : app;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
StyledSlider {
|
||||||
Image {
|
id: slider
|
||||||
property real size: slider.trackHeight * 1.3
|
value: root.node.audio.volume
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
onValueChanged: root.node.audio.volume = value
|
||||||
visible: source != ""
|
|
||||||
sourceSize.width: size
|
|
||||||
sourceSize.height: size
|
|
||||||
source: {
|
|
||||||
let icon;
|
|
||||||
icon = AppSearch.guessIcon(root.node.properties["application.icon-name"]);
|
|
||||||
if (AppSearch.iconExists(icon)) return Quickshell.iconPath(icon, "image-missing");
|
|
||||||
icon = AppSearch.guessIcon(root.node.properties["node.name"]);
|
|
||||||
return Quickshell.iconPath(icon, "image-missing");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StyledSlider {
|
|
||||||
id: slider
|
|
||||||
value: root.node.audio.volume
|
|
||||||
onValueChanged: root.node.audio.volume = value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user