mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-23 19:54:02 -04:00
them towards theme controlCenter: make a real grid, add numerous more tile varieties, add icon size option surfaces: fix elevation levels in general, and shift them down settings: restyles and re-org sliders: scale down universally
30 lines
1.4 KiB
QML
30 lines
1.4 KiB
QML
import QtQuick
|
|
import Quickshell.Services.Pipewire
|
|
import qs.Common
|
|
import qs.Services
|
|
import "../../../Common/QmlUtils.js" as QmlUtils
|
|
|
|
CcTileActions {
|
|
id: root
|
|
|
|
property bool isInput: false
|
|
readonly property var pins: QmlUtils.normalizePinList(isInput ? (CacheData.audioInputDevicePins || {}).preferredInput : (CacheData.audioOutputDevicePins || {}).preferredOutput)
|
|
readonly property var selectedNode: isInput ? AudioService.source : AudioService.sink
|
|
readonly property var devices: {
|
|
const hidden = (isInput ? SessionData.hiddenInputDeviceNames : SessionData.hiddenOutputDeviceNames) || [];
|
|
return Pipewire.nodes.values.filter(node => node.audio && node.isSink !== isInput && !node.isStream && !hidden.includes(node.name)).sort((a, b) => {
|
|
const aPin = pins.indexOf(a.name);
|
|
const bPin = pins.indexOf(b.name);
|
|
if (aPin !== bPin)
|
|
return (aPin < 0 ? Infinity : aPin) - (bPin < 0 ? Infinity : bPin);
|
|
return Number(b === selectedNode) - Number(a === selectedNode);
|
|
});
|
|
}
|
|
actions: devices.map(node => ({
|
|
text: AudioService.displayName(node),
|
|
icon: isInput ? "mic" : AudioService.sinkIcon(node),
|
|
active: node === selectedNode,
|
|
trigger: () => isInput ? AudioService.setDefaultSourceByName(node.name) : AudioService.setDefaultSinkByName(node.name)
|
|
}))
|
|
}
|