Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
183 lines
6.2 KiB
QML
183 lines
6.2 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import "../../components"
|
|
import "../../core"
|
|
import "../../services"
|
|
import "../../theme"
|
|
|
|
// One setting: optional icon, title and description on the left, control on the right.
|
|
// Wide controls go in `below`. A bound `setting` gains a reset-to-default button once changed.
|
|
Item {
|
|
id: root
|
|
property string title
|
|
property string description
|
|
property string icon
|
|
property string setting
|
|
property bool clickable: false
|
|
default property alias control: controls.data
|
|
property alias below: belowColumn.data
|
|
signal clicked
|
|
readonly property var defaultValue: setting ? setting.split(".").reduce((object, key) => object ? object[key] : undefined, ConfigService.defaults) : undefined
|
|
readonly property bool modified: defaultValue !== undefined && JSON.stringify(ConfigService.value(setting)) !== JSON.stringify(defaultValue)
|
|
property real flash: 0
|
|
Layout.fillWidth: true
|
|
implicitHeight: Math.max(52, content.implicitHeight + 20)
|
|
opacity: enabled ? 1 : 0.5
|
|
|
|
function matches(text) {
|
|
const a = title.toLowerCase(), b = String(text).toLowerCase();
|
|
return !!a && !!b && (a === b || a.startsWith(b) || b.startsWith(a));
|
|
}
|
|
function reveal() {
|
|
// Untyped walk: the nearest Flickable ancestor scrolls the row into view.
|
|
let parent = Object(root.parent);
|
|
while (parent) {
|
|
if (parent.contentY !== undefined && parent.contentItem && parent.contentHeight > parent.height) {
|
|
const position = root.mapToItem(parent.contentItem, 0, 0);
|
|
parent.contentY = Math.max(0, Math.min(parent.contentHeight - parent.height, position.y - parent.height / 3));
|
|
break;
|
|
}
|
|
parent = parent.parent;
|
|
}
|
|
highlight.restart();
|
|
}
|
|
function checkHighlight() {
|
|
if (ShellState.settingsHighlight && root.matches(ShellState.settingsHighlight))
|
|
Qt.callLater(root.reveal);
|
|
}
|
|
Component.onCompleted: checkHighlight()
|
|
Connections {
|
|
target: ShellState
|
|
function onSettingsHighlightSerialChanged() {
|
|
root.checkHighlight();
|
|
}
|
|
}
|
|
SequentialAnimation {
|
|
id: highlight
|
|
PauseAnimation {
|
|
duration: 160
|
|
}
|
|
NumberAnimation {
|
|
target: root
|
|
property: "flash"
|
|
to: 1
|
|
duration: 320
|
|
easing.type: Easing.OutCubic
|
|
}
|
|
PauseAnimation {
|
|
duration: 1200
|
|
}
|
|
NumberAnimation {
|
|
target: root
|
|
property: "flash"
|
|
to: 0
|
|
duration: 800
|
|
easing.type: Easing.InOutSine
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
radius: Math.max(8, Theme.radius * 0.5)
|
|
color: area.containsMouse && root.clickable ? Qt.alpha(Theme.text, 0.07) : area.containsMouse ? Qt.alpha(Theme.text, 0.035) : Theme.transparent
|
|
Behavior on color {
|
|
ColorAnimation {
|
|
duration: Theme.duration / 2
|
|
}
|
|
}
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
radius: parent.radius
|
|
color: Theme.accent
|
|
opacity: root.flash * 0.22
|
|
border.width: root.flash > 0 ? 1 : 0
|
|
border.color: Qt.alpha(Theme.accent, root.flash)
|
|
}
|
|
}
|
|
MouseArea {
|
|
id: area
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
acceptedButtons: root.clickable ? Qt.LeftButton : Qt.NoButton
|
|
cursorShape: root.clickable ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
onClicked: root.clicked()
|
|
}
|
|
ColumnLayout {
|
|
id: content
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.leftMargin: 12
|
|
anchors.rightMargin: 12
|
|
spacing: 10
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
spacing: 12
|
|
GlassIcon {
|
|
visible: root.icon !== ""
|
|
glyph: root.icon
|
|
fallback: root.title.charAt(0)
|
|
size: 32
|
|
}
|
|
ColumnLayout {
|
|
Layout.fillWidth: true
|
|
Layout.minimumWidth: 120
|
|
spacing: 2
|
|
Text {
|
|
text: root.title
|
|
visible: text !== ""
|
|
color: Theme.text
|
|
font.pixelSize: 13
|
|
font.weight: Font.Medium
|
|
wrapMode: Text.Wrap
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
text: root.description
|
|
visible: text !== ""
|
|
color: Theme.textSecondary
|
|
font.pixelSize: 11
|
|
wrapMode: Text.Wrap
|
|
Layout.fillWidth: true
|
|
}
|
|
}
|
|
Rectangle {
|
|
objectName: "reset-" + root.setting
|
|
ToolTip.visible: resetArea.containsMouse
|
|
ToolTip.delay: 500
|
|
ToolTip.text: "Reset to default"
|
|
visible: root.modified
|
|
implicitWidth: 26
|
|
implicitHeight: 26
|
|
radius: 13
|
|
color: resetArea.containsMouse ? Qt.alpha(Theme.accent, 0.25) : Qt.alpha(Theme.text, 0.06)
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: "↺"
|
|
color: resetArea.containsMouse ? Theme.text : Theme.textSecondary
|
|
font.pixelSize: 14
|
|
}
|
|
MouseArea {
|
|
id: resetArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: ConfigService.setValue(root.setting, JSON.parse(JSON.stringify(root.defaultValue)))
|
|
}
|
|
}
|
|
RowLayout {
|
|
id: controls
|
|
spacing: 8
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
|
}
|
|
}
|
|
ColumnLayout {
|
|
id: belowColumn
|
|
visible: children.length > 0
|
|
Layout.fillWidth: true
|
|
spacing: 8
|
|
}
|
|
}
|
|
}
|