Lay the Control Center out as a resizable, editable grid
Modules are tiles on a 4-column grid, each 1x1 to 4x4 and adapting its layout to its size. Edit Controls in the panel reorders by dragging, resizes from a corner handle, removes with a badge and adds from a tray. Connectivity splits into Wi-Fi, Bluetooth and Network tiles and Audio into Sound and Microphone; right-clicking Sound extends it with output devices and a volume slider per app. Adds a Caffeine tile. Config version 2 migrates existing layouts in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0dcf37346c
commit
11bdc4c751
32 files changed
+2147
-355
No files matched your search
@@ -0,0 +1,170 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Widgets
|
||||
import "../components"
|
||||
import "../services"
|
||||
import "../theme"
|
||||
|
||||
// Extension of the Output and Input tiles: device choice, and for output a
|
||||
// volume slider per app stream (the players EasyEffects processes).
|
||||
ColumnLayout {
|
||||
id: root
|
||||
property bool input: false
|
||||
readonly property var nodes: input ? AudioService.inputs : AudioService.outputs
|
||||
readonly property var current: input ? AudioService.source : AudioService.sink
|
||||
spacing: 2
|
||||
Demand {
|
||||
service: AudioService
|
||||
counter: "streamConsumers"
|
||||
active: !root.input
|
||||
}
|
||||
component Heading: Text {
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
font.weight: Font.DemiBold
|
||||
font.letterSpacing: 1.1
|
||||
Layout.topMargin: 4
|
||||
Layout.bottomMargin: 2
|
||||
}
|
||||
|
||||
Heading {
|
||||
text: root.input ? "INPUT DEVICE" : "OUTPUT DEVICE"
|
||||
}
|
||||
Repeater {
|
||||
model: root.nodes
|
||||
Rectangle {
|
||||
id: device
|
||||
required property var modelData
|
||||
required property int index
|
||||
readonly property bool selected: modelData === root.current
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 28
|
||||
radius: 8
|
||||
color: deviceArea.containsMouse ? Qt.alpha(Theme.text, 0.08) : Theme.transparent
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 6
|
||||
anchors.rightMargin: 6
|
||||
spacing: 8
|
||||
Text {
|
||||
text: device.selected ? "✓" : ""
|
||||
color: Theme.accent
|
||||
font.pixelSize: 12
|
||||
Layout.preferredWidth: 12
|
||||
}
|
||||
Text {
|
||||
text: device.modelData.description || device.modelData.name
|
||||
color: device.selected ? Theme.text : Qt.alpha(Theme.text, 0.8)
|
||||
font.pixelSize: 12
|
||||
font.weight: device.selected ? Font.DemiBold : Font.Normal
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: deviceArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: AudioService.select(root.input, device.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Heading {
|
||||
visible: !root.input
|
||||
text: "APPLICATIONS"
|
||||
Layout.topMargin: 8
|
||||
}
|
||||
Text {
|
||||
visible: !root.input && AudioService.streams.length === 0
|
||||
text: "No apps are playing audio"
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 11
|
||||
Layout.leftMargin: 6
|
||||
}
|
||||
Repeater {
|
||||
model: root.input ? [] : AudioService.streams
|
||||
RowLayout {
|
||||
id: stream
|
||||
required property var modelData
|
||||
readonly property bool muted: !!modelData.audio && modelData.audio.muted
|
||||
readonly property string icon: AudioService.streamIcon(modelData)
|
||||
objectName: "appVolume-" + AudioService.streamName(modelData)
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 30
|
||||
spacing: 8
|
||||
// The app icon doubles as its mute button.
|
||||
Item {
|
||||
implicitWidth: 22
|
||||
implicitHeight: 22
|
||||
opacity: stream.muted ? 0.4 : 1
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: (stream.muted ? "Unmute " : "Mute ") + AudioService.streamName(stream.modelData)
|
||||
IconImage {
|
||||
anchors.fill: parent
|
||||
visible: stream.icon !== ""
|
||||
source: stream.icon
|
||||
asynchronous: true
|
||||
}
|
||||
GlassIcon {
|
||||
anchors.fill: parent
|
||||
visible: stream.icon === ""
|
||||
size: 22
|
||||
glyphSize: 11
|
||||
fallback: AudioService.streamName(stream.modelData).charAt(0).toUpperCase()
|
||||
}
|
||||
Text {
|
||||
visible: stream.muted
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: -3
|
||||
text: Icons.available ? "" : "×"
|
||||
font.family: Icons.available ? Icons.family : ""
|
||||
font.pixelSize: 11
|
||||
color: Theme.text
|
||||
}
|
||||
MouseArea {
|
||||
objectName: "appMute-" + AudioService.streamName(stream.modelData)
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: AudioService.streamMute(stream.modelData)
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 2
|
||||
Text {
|
||||
text: AudioService.streamName(stream.modelData)
|
||||
color: Theme.text
|
||||
font.pixelSize: 11
|
||||
elide: Text.ElideRight
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
GlassBarSlider {
|
||||
id: level
|
||||
objectName: "appSlider-" + AudioService.streamName(stream.modelData)
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 10
|
||||
from: 0
|
||||
to: 1
|
||||
stepSize: 0.01
|
||||
enabled: !!stream.modelData.audio
|
||||
value: stream.modelData.audio ? stream.modelData.audio.volume : 0
|
||||
onMoved: AudioService.streamVolume(stream.modelData, value)
|
||||
onPressedChanged: if (!pressed)
|
||||
value = Qt.binding(() => stream.modelData.audio ? stream.modelData.audio.volume : 0)
|
||||
Accessible.name: AudioService.streamName(stream.modelData) + " volume"
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: stream.modelData.audio ? Math.round(stream.modelData.audio.volume * 100) + "%" : "—"
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 11
|
||||
horizontalAlignment: Text.AlignRight
|
||||
Layout.preferredWidth: 32
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user