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>
863 lines
38 KiB
QML
863 lines
38 KiB
QML
pragma ComponentBehavior: Bound
|
||
import QtQuick
|
||
import QtQuick.Controls
|
||
import QtQuick.Layouts
|
||
import Quickshell
|
||
import Quickshell.Wayland
|
||
import "../components"
|
||
import "../services"
|
||
import "../theme"
|
||
import "../core"
|
||
import "controls"
|
||
import "pages" as Pages
|
||
|
||
// The layer surface is sized to the panel so compositor glass (HyprGlass)
|
||
// shapes its refraction edges to the panel instead of to the whole screen.
|
||
// While dragging it temporarily spans the screen, giving a stable pointer frame.
|
||
// Runtime selects the concrete layer window.
|
||
// qmllint disable uncreatable-type
|
||
PanelWindow {
|
||
// qmllint enable uncreatable-type
|
||
id: root
|
||
screen: ScreenService.current(ShellState.targetScreen)
|
||
visible: ShellState.settingsOpen || panel.opacity > 0.01
|
||
anchors {
|
||
top: true
|
||
left: true
|
||
bottom: root.dragging
|
||
right: root.dragging
|
||
}
|
||
// Margins is present at runtime but unresolved in 0.3.1 qmltypes.
|
||
// qmllint disable unqualified unresolved-type
|
||
margins {
|
||
left: root.dragging ? 0 : root.panelX
|
||
top: root.dragging ? 0 : root.panelY
|
||
}
|
||
// qmllint enable unqualified unresolved-type
|
||
implicitWidth: panel.width
|
||
implicitHeight: panel.height
|
||
color: Theme.transparent
|
||
exclusionMode: ExclusionMode.Ignore
|
||
WlrLayershell.namespace: "glassMxrph-settings"
|
||
WlrLayershell.layer: WlrLayer.Overlay
|
||
WlrLayershell.keyboardFocus: ShellState.settingsOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||
Component.onCompleted: ShellState.settingsWindow = root
|
||
Component.onDestruction: ShellState.settingsWindow = null
|
||
|
||
readonly property int screenWidth: screen ? screen.width : 1920
|
||
readonly property int screenHeight: screen ? screen.height : 1080
|
||
readonly property bool wide: panel.width >= 780
|
||
|
||
// Placement: centred until the user drags the panel; double-click a header to recentre.
|
||
property bool placed: false
|
||
property real placedX: 0
|
||
property real placedY: 0
|
||
readonly property real panelX: Math.round(placed ? Math.max(0, Math.min(screenWidth - panel.width, placedX)) : (screenWidth - panel.width) / 2)
|
||
readonly property real panelY: Math.round(placed ? Math.max(0, Math.min(screenHeight - panel.height, placedY)) : (screenHeight - panel.height) / 2)
|
||
property bool dragging: false
|
||
// True once the compositor has actually resized the surface to the screen.
|
||
readonly property bool spanning: width > panel.width + 1
|
||
property point dragStart
|
||
property point dragOrigin
|
||
function screenPoint(item, x, y) {
|
||
const p = item.mapToItem(null, x, y);
|
||
return spanning ? p : Qt.point(p.x + dragOrigin.x, p.y + dragOrigin.y);
|
||
}
|
||
function beginDrag(item, x, y) {
|
||
dragOrigin = Qt.point(panelX, panelY);
|
||
dragStart = screenPoint(item, x, y);
|
||
placedX = panelX;
|
||
placedY = panelY;
|
||
placed = true;
|
||
dragging = true;
|
||
}
|
||
function moveDrag(item, x, y) {
|
||
if (!dragging)
|
||
return;
|
||
const p = screenPoint(item, x, y);
|
||
placedX = dragOrigin.x + p.x - dragStart.x;
|
||
placedY = dragOrigin.y + p.y - dragStart.y;
|
||
}
|
||
function endDrag() {
|
||
dragging = false;
|
||
}
|
||
function recenter() {
|
||
placed = false;
|
||
}
|
||
readonly property var currentPage: SettingsRegistry.page(ShellState.settingsPage) || SettingsRegistry.page("about")
|
||
readonly property var currentGroup: SettingsRegistry.groups.find(g => g.id === currentPage.group) || null
|
||
|
||
// Sidebar entries: group captions followed by their pages.
|
||
readonly property int captionHeight: 30
|
||
readonly property int gapHeight: 12
|
||
readonly property int itemHeight: 40
|
||
readonly property int itemSpacing: 2
|
||
readonly property var navEntries: {
|
||
const entries = [];
|
||
for (const group of SettingsRegistry.groups) {
|
||
const pages = SettingsRegistry.pages.filter(p => p.group === group.id);
|
||
if (pages.length === 0)
|
||
continue;
|
||
entries.push({
|
||
kind: group.title ? "caption" : "gap",
|
||
title: group.title
|
||
});
|
||
for (const p of pages)
|
||
entries.push({
|
||
kind: "page",
|
||
page: p
|
||
});
|
||
}
|
||
return entries;
|
||
}
|
||
function entryHeight(entry) {
|
||
return entry.kind === "page" ? itemHeight : entry.kind === "caption" ? captionHeight : gapHeight;
|
||
}
|
||
function entryY(pageId) {
|
||
let y = 0;
|
||
for (const entry of navEntries) {
|
||
if (entry.kind === "page" && entry.page.id === pageId)
|
||
return y;
|
||
y += entryHeight(entry) + itemSpacing;
|
||
}
|
||
return -1;
|
||
}
|
||
function step(direction) {
|
||
const ids = SettingsRegistry.pages.map(p => p.id);
|
||
const index = ids.indexOf(ShellState.settingsPage);
|
||
ShellState.openSettings(ids[(index + direction + ids.length) % ids.length]);
|
||
}
|
||
|
||
// Search
|
||
property bool searchActive: false
|
||
property int searchIndex: 0
|
||
readonly property var searchResults: SettingsRegistry.search(searchField.text)
|
||
function openSearch() {
|
||
searchActive = true;
|
||
searchField.forceActiveFocus();
|
||
}
|
||
function closeSearch() {
|
||
searchActive = false;
|
||
searchField.clear();
|
||
panel.forceActiveFocus();
|
||
}
|
||
function chooseResult(result) {
|
||
if (!result)
|
||
return;
|
||
closeSearch();
|
||
ShellState.revealSetting(result.page, result.setting);
|
||
}
|
||
onSearchResultsChanged: searchIndex = 0
|
||
// Keep the selected sidebar entry in view.
|
||
function revealNavEntry() {
|
||
const y = entryY(ShellState.settingsPage);
|
||
if (y < 0 || nav.height <= 0)
|
||
return;
|
||
if (y < nav.contentY)
|
||
nav.contentY = y;
|
||
else if (y + itemHeight > nav.contentY + nav.height)
|
||
nav.contentY = Math.min(nav.contentHeight - nav.height, y + itemHeight - nav.height);
|
||
}
|
||
Connections {
|
||
target: ShellState
|
||
function onSettingsOpenChanged() {
|
||
if (!ShellState.settingsOpen && root.searchActive)
|
||
root.closeSearch();
|
||
if (ShellState.settingsOpen)
|
||
Qt.callLater(root.revealNavEntry);
|
||
}
|
||
}
|
||
Timer {
|
||
// Clear the reveal request once matching rows have flashed.
|
||
running: ShellState.settingsHighlight !== ""
|
||
interval: 3000
|
||
onTriggered: ShellState.settingsHighlight = ""
|
||
}
|
||
|
||
// Drag handle for moving the panel; double-click recentres it.
|
||
component DragArea: MouseArea {
|
||
id: handle
|
||
anchors.fill: parent
|
||
cursorShape: pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor
|
||
onPressed: mouse => root.beginDrag(handle, mouse.x, mouse.y)
|
||
onPositionChanged: mouse => root.moveDrag(handle, mouse.x, mouse.y)
|
||
onReleased: root.endDrag()
|
||
onCanceled: root.endDrag()
|
||
onDoubleClicked: root.recenter()
|
||
}
|
||
|
||
// Hyprland routes every pointer event to a layer with exclusive keyboard
|
||
// focus, so clicks outside the panel arrive here with out-of-bounds
|
||
// coordinates. Qt Quick still delivers them to items extending past the
|
||
// window, so this catcher (behind the panel) dismisses on outside clicks.
|
||
MouseArea {
|
||
objectName: "settingsOutside"
|
||
x: -20000
|
||
y: -20000
|
||
width: 40000
|
||
height: 40000
|
||
onPressed: ShellState.settingsOpen = false
|
||
}
|
||
GlassPopup {
|
||
id: panel
|
||
objectName: "settingsSurface"
|
||
opened: ShellState.settingsOpen
|
||
x: root.spanning ? root.panelX : 0
|
||
y: root.spanning ? root.panelY : 0
|
||
width: Math.min(1080, root.screenWidth - 40)
|
||
height: Math.min(780, root.screenHeight - 40)
|
||
focus: ShellState.settingsOpen
|
||
onOpenedChanged: if (opened)
|
||
forceActiveFocus()
|
||
Keys.onEscapePressed: ShellState.settingsOpen = false
|
||
Keys.onPressed: event => {
|
||
if (event.modifiers & Qt.ControlModifier) {
|
||
if (event.key === Qt.Key_F) {
|
||
root.openSearch();
|
||
event.accepted = true;
|
||
} else if (event.key === Qt.Key_PageDown || event.key === Qt.Key_Tab) {
|
||
root.step(1);
|
||
event.accepted = true;
|
||
} else if (event.key === Qt.Key_PageUp || event.key === Qt.Key_Backtab) {
|
||
root.step(-1);
|
||
event.accepted = true;
|
||
}
|
||
}
|
||
}
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
}
|
||
RowLayout {
|
||
anchors.fill: parent
|
||
spacing: 0
|
||
|
||
// Sidebar
|
||
Rectangle {
|
||
id: sidebar
|
||
visible: root.wide
|
||
Layout.fillHeight: true
|
||
Layout.preferredWidth: 252
|
||
topLeftRadius: panel.radius
|
||
bottomLeftRadius: panel.radius
|
||
color: Qt.alpha(Theme.tint, 0.15)
|
||
ColumnLayout {
|
||
anchors.fill: parent
|
||
anchors.margins: 14
|
||
spacing: 12
|
||
|
||
Item {
|
||
Layout.fillWidth: true
|
||
Layout.preferredHeight: 36
|
||
DragArea {
|
||
objectName: "settingsDragHandle"
|
||
}
|
||
Text {
|
||
anchors.left: parent.left
|
||
anchors.leftMargin: 6
|
||
anchors.verticalCenter: parent.verticalCenter
|
||
text: "Settings"
|
||
color: Theme.text
|
||
font.pixelSize: 17
|
||
font.weight: Font.DemiBold
|
||
opacity: root.searchActive ? 0 : 1
|
||
scale: root.searchActive ? 0.92 : 1
|
||
visible: opacity > 0.01
|
||
Behavior on opacity {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
easing.type: Easing.OutCubic
|
||
}
|
||
}
|
||
Behavior on scale {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
easing.type: Easing.OutCubic
|
||
}
|
||
}
|
||
}
|
||
// The search button widens into the search field.
|
||
Item {
|
||
id: searchMorph
|
||
property real progress: root.searchActive ? 1 : 0
|
||
Behavior on progress {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
easing.type: Easing.OutCubic
|
||
}
|
||
}
|
||
anchors.right: parent.right
|
||
anchors.verticalCenter: parent.verticalCenter
|
||
width: 36 + (parent.width - 36) * progress
|
||
height: 36
|
||
clip: true
|
||
GlassTextField {
|
||
id: searchField
|
||
objectName: "settingsSearch"
|
||
anchors.fill: parent
|
||
leftPadding: 36
|
||
rightPadding: 36
|
||
placeholderText: "Search settings…"
|
||
opacity: searchMorph.progress
|
||
enabled: root.searchActive
|
||
background: Rectangle {
|
||
radius: height / 2
|
||
color: Theme.surfaceVariant
|
||
border.color: searchField.activeFocus ? Theme.accent : Theme.border
|
||
}
|
||
Keys.onEscapePressed: root.closeSearch()
|
||
Keys.onDownPressed: root.searchIndex = Math.min(root.searchResults.length - 1, root.searchIndex + 1)
|
||
Keys.onUpPressed: root.searchIndex = Math.max(0, root.searchIndex - 1)
|
||
Keys.onReturnPressed: root.chooseResult(root.searchResults[root.searchIndex])
|
||
Keys.onEnterPressed: root.chooseResult(root.searchResults[root.searchIndex])
|
||
}
|
||
Rectangle {
|
||
width: 36
|
||
height: 36
|
||
radius: 18
|
||
color: !root.searchActive && searchButton.containsMouse ? Qt.alpha(Theme.text, 0.1) : Theme.transparent
|
||
GlassIcon {
|
||
anchors.centerIn: parent
|
||
glyph: ""
|
||
fallback: "⌕"
|
||
size: 28
|
||
glyphSize: 16
|
||
color: Theme.transparent
|
||
border.width: 0
|
||
glyphColor: root.searchActive ? Theme.textSecondary : Theme.text
|
||
}
|
||
MouseArea {
|
||
id: searchButton
|
||
objectName: "settingsSearchButton"
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
cursorShape: Qt.PointingHandCursor
|
||
onClicked: root.searchActive ? searchField.forceActiveFocus() : root.openSearch()
|
||
}
|
||
}
|
||
Rectangle {
|
||
anchors.right: parent.right
|
||
width: 36
|
||
height: 36
|
||
radius: 18
|
||
visible: searchMorph.progress > 0.5
|
||
opacity: searchMorph.progress
|
||
color: closeSearchArea.containsMouse ? Qt.alpha(Theme.text, 0.1) : Theme.transparent
|
||
Text {
|
||
anchors.centerIn: parent
|
||
text: "×"
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 18
|
||
}
|
||
MouseArea {
|
||
id: closeSearchArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
cursorShape: Qt.PointingHandCursor
|
||
onClicked: root.closeSearch()
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
Item {
|
||
Layout.fillWidth: true
|
||
Layout.fillHeight: true
|
||
|
||
// Navigation
|
||
Flickable {
|
||
id: nav
|
||
anchors.fill: parent
|
||
clip: true
|
||
contentHeight: navColumn.implicitHeight
|
||
boundsBehavior: Flickable.StopAtBounds
|
||
opacity: root.searchActive ? 0 : 1
|
||
visible: opacity > 0.01
|
||
Behavior on opacity {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
}
|
||
}
|
||
ScrollBar.vertical: ScrollBar {
|
||
policy: ScrollBar.AsNeeded
|
||
opacity: active ? 1 : 0
|
||
Behavior on opacity {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
}
|
||
}
|
||
contentItem: Rectangle {
|
||
implicitWidth: 3
|
||
radius: 2
|
||
color: Qt.alpha(Theme.text, 0.2)
|
||
}
|
||
}
|
||
Rectangle {
|
||
id: activeHighlight
|
||
readonly property real target: root.entryY(ShellState.settingsPage)
|
||
visible: target >= 0
|
||
width: nav.width
|
||
height: root.itemHeight
|
||
y: target
|
||
radius: Math.max(10, Theme.radius * 0.55)
|
||
color: Theme.accent
|
||
Behavior on y {
|
||
NumberAnimation {
|
||
duration: Theme.duration * 1.3
|
||
easing.type: Easing.OutQuint
|
||
}
|
||
}
|
||
}
|
||
Column {
|
||
id: navColumn
|
||
width: nav.width
|
||
spacing: root.itemSpacing
|
||
Repeater {
|
||
model: root.navEntries
|
||
Item {
|
||
id: entry
|
||
required property var modelData
|
||
readonly property bool isPage: modelData.kind === "page"
|
||
readonly property bool selected: isPage && modelData.page.id === ShellState.settingsPage
|
||
width: navColumn.width
|
||
height: root.entryHeight(modelData)
|
||
Text {
|
||
visible: entry.modelData.kind === "caption"
|
||
anchors.left: parent.left
|
||
anchors.leftMargin: 8
|
||
anchors.bottom: parent.bottom
|
||
anchors.bottomMargin: 6
|
||
text: String(entry.modelData.title || "").toUpperCase()
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 10
|
||
font.weight: Font.DemiBold
|
||
font.letterSpacing: 1.2
|
||
}
|
||
Rectangle {
|
||
visible: entry.isPage
|
||
anchors.fill: parent
|
||
radius: activeHighlight.radius
|
||
color: !entry.selected && itemArea.containsMouse ? Qt.alpha(Theme.text, 0.07) : Theme.transparent
|
||
scale: itemArea.pressed ? 0.98 : 1
|
||
Behavior on color {
|
||
ColorAnimation {
|
||
duration: Theme.duration / 2
|
||
}
|
||
}
|
||
Behavior on scale {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
easing.type: Easing.OutQuint
|
||
}
|
||
}
|
||
RowLayout {
|
||
anchors.fill: parent
|
||
// Selected items shift right as the highlight lands.
|
||
anchors.leftMargin: 6 + (entry.selected ? 3 * Theme.intensity : 0)
|
||
anchors.rightMargin: 10
|
||
spacing: 10
|
||
Behavior on anchors.leftMargin {
|
||
NumberAnimation {
|
||
duration: Theme.duration * 1.3
|
||
easing.type: Easing.OutQuint
|
||
}
|
||
}
|
||
GlassIcon {
|
||
glyph: entry.isPage ? entry.modelData.page.icon : ""
|
||
image: entry.isPage ? entry.modelData.page.image || "" : ""
|
||
fallback: entry.isPage ? entry.modelData.page.title.charAt(0) : ""
|
||
size: 28
|
||
glyphSize: 15
|
||
color: entry.selected ? Qt.alpha(Theme.accentText, 0.14) : Theme.surfaceVariant
|
||
glyphColor: entry.selected ? Theme.accentText : Theme.text
|
||
}
|
||
Text {
|
||
text: entry.isPage ? entry.modelData.page.title : ""
|
||
color: entry.selected ? Theme.accentText : itemArea.containsMouse ? Theme.text : Qt.alpha(Theme.text, 0.82)
|
||
font.pixelSize: 13
|
||
font.weight: entry.selected ? Font.DemiBold : Font.Medium
|
||
elide: Text.ElideRight
|
||
Layout.fillWidth: true
|
||
Behavior on color {
|
||
ColorAnimation {
|
||
duration: Theme.duration / 2
|
||
}
|
||
}
|
||
}
|
||
}
|
||
MouseArea {
|
||
id: itemArea
|
||
objectName: entry.isPage ? "settingsNav-" + entry.modelData.page.id : ""
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
cursorShape: Qt.PointingHandCursor
|
||
onClicked: ShellState.openSettings(entry.modelData.page.id)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// Search results
|
||
ListView {
|
||
id: results
|
||
objectName: "settingsSearchResults"
|
||
anchors.fill: parent
|
||
clip: true
|
||
spacing: 4
|
||
model: root.searchResults
|
||
currentIndex: root.searchIndex
|
||
opacity: root.searchActive ? 1 : 0
|
||
visible: opacity > 0.01
|
||
boundsBehavior: Flickable.StopAtBounds
|
||
highlightFollowsCurrentItem: false
|
||
onCurrentIndexChanged: positionViewAtIndex(currentIndex, ListView.Contain)
|
||
Behavior on opacity {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
}
|
||
}
|
||
delegate: Rectangle {
|
||
id: result
|
||
required property var modelData
|
||
required property int index
|
||
readonly property bool selected: index === root.searchIndex
|
||
width: results.width
|
||
height: 50
|
||
radius: Math.max(10, Theme.radius * 0.55)
|
||
color: selected ? Theme.accent : resultArea.containsMouse ? Qt.alpha(Theme.text, 0.08) : Theme.fill
|
||
Behavior on color {
|
||
ColorAnimation {
|
||
duration: Theme.duration / 2
|
||
}
|
||
}
|
||
RowLayout {
|
||
anchors.fill: parent
|
||
anchors.leftMargin: 8 + (result.selected ? 3 : 0)
|
||
anchors.rightMargin: 10
|
||
spacing: 10
|
||
Behavior on anchors.leftMargin {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
easing.type: Easing.OutQuint
|
||
}
|
||
}
|
||
GlassIcon {
|
||
glyph: result.modelData.icon
|
||
image: result.modelData.image || ""
|
||
fallback: result.modelData.detail.charAt(0)
|
||
size: 28
|
||
glyphSize: 14
|
||
color: result.selected ? Qt.alpha(Theme.accentText, 0.14) : Theme.surfaceVariant
|
||
glyphColor: result.selected ? Theme.accentText : Theme.text
|
||
}
|
||
ColumnLayout {
|
||
Layout.fillWidth: true
|
||
spacing: 1
|
||
Text {
|
||
text: result.modelData.title
|
||
color: result.selected ? Theme.accentText : Theme.text
|
||
font.pixelSize: 12
|
||
font.weight: Font.DemiBold
|
||
elide: Text.ElideRight
|
||
Layout.fillWidth: true
|
||
}
|
||
Text {
|
||
text: result.modelData.setting ? "in " + result.modelData.detail : result.modelData.detail
|
||
color: result.selected ? Qt.alpha(Theme.accentText, 0.75) : Theme.textSecondary
|
||
font.pixelSize: 10
|
||
elide: Text.ElideRight
|
||
Layout.fillWidth: true
|
||
}
|
||
}
|
||
}
|
||
MouseArea {
|
||
id: resultArea
|
||
anchors.fill: parent
|
||
hoverEnabled: true
|
||
cursorShape: Qt.PointingHandCursor
|
||
onEntered: root.searchIndex = result.index
|
||
onClicked: root.chooseResult(result.modelData)
|
||
}
|
||
}
|
||
Text {
|
||
anchors.centerIn: parent
|
||
visible: root.searchActive && results.count === 0
|
||
width: parent.width - 20
|
||
horizontalAlignment: Text.AlignHCenter
|
||
wrapMode: Text.Wrap
|
||
text: searchField.text.trim() ? "No settings match “" + searchField.text.trim() + "”" : "Type to search pages and settings"
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 12
|
||
}
|
||
}
|
||
}
|
||
|
||
Text {
|
||
Layout.fillWidth: true
|
||
Layout.leftMargin: 6
|
||
text: root.searchActive ? "↑↓ select · Enter open · Esc back" : "Ctrl+F search · Ctrl+Tab next page"
|
||
color: Qt.alpha(Theme.textSecondary, 0.8)
|
||
font.pixelSize: 10
|
||
elide: Text.ElideRight
|
||
}
|
||
}
|
||
}
|
||
Rectangle {
|
||
visible: root.wide
|
||
Layout.fillHeight: true
|
||
Layout.preferredWidth: 1
|
||
color: Theme.border
|
||
}
|
||
|
||
// Content
|
||
ColumnLayout {
|
||
Layout.fillWidth: true
|
||
Layout.fillHeight: true
|
||
Layout.margins: 24
|
||
Layout.rightMargin: 14
|
||
spacing: 18
|
||
// Page header, also a drag handle for the panel.
|
||
Item {
|
||
Layout.fillWidth: true
|
||
implicitHeight: pageHeader.implicitHeight
|
||
DragArea {}
|
||
RowLayout {
|
||
id: pageHeader
|
||
anchors.fill: parent
|
||
anchors.rightMargin: 10
|
||
spacing: 14
|
||
GlassIcon {
|
||
glyph: root.currentPage.icon
|
||
image: root.currentPage.image || ""
|
||
fallback: root.currentPage.title.charAt(0)
|
||
active: true
|
||
size: 46
|
||
glyphSize: 22
|
||
}
|
||
ColumnLayout {
|
||
Layout.fillWidth: true
|
||
spacing: 1
|
||
Text {
|
||
visible: !!root.currentGroup && root.currentGroup.title !== ""
|
||
text: root.currentGroup ? root.currentGroup.title.toUpperCase() : ""
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 10
|
||
font.weight: Font.DemiBold
|
||
font.letterSpacing: 1.2
|
||
}
|
||
Text {
|
||
text: root.currentPage.title
|
||
color: Theme.text
|
||
font.pixelSize: 22
|
||
font.weight: Font.DemiBold
|
||
Layout.fillWidth: true
|
||
elide: Text.ElideRight
|
||
}
|
||
Text {
|
||
text: root.currentPage.description
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 12
|
||
Layout.fillWidth: true
|
||
elide: Text.ElideRight
|
||
}
|
||
}
|
||
GlassIconButton {
|
||
text: "×"
|
||
onClicked: ShellState.settingsOpen = false
|
||
Accessible.name: "Close settings"
|
||
}
|
||
}
|
||
}
|
||
GlassComboBox {
|
||
visible: !root.wide
|
||
Layout.fillWidth: true
|
||
Layout.rightMargin: 10
|
||
model: SettingsRegistry.pages
|
||
textRole: "title"
|
||
valueRole: "id"
|
||
currentIndex: SettingsRegistry.pages.findIndex(p => p.id === ShellState.settingsPage)
|
||
onActivated: ShellState.openSettings(currentValue)
|
||
}
|
||
Item {
|
||
id: pageHost
|
||
Layout.fillWidth: true
|
||
Layout.fillHeight: true
|
||
clip: true
|
||
property real enter: 1
|
||
NumberAnimation {
|
||
id: enterAnimation
|
||
target: pageHost
|
||
property: "enter"
|
||
from: 0
|
||
to: 1
|
||
duration: Theme.duration * 1.4
|
||
easing.type: Easing.OutCubic
|
||
}
|
||
Connections {
|
||
target: ShellState
|
||
function onSettingsPageChanged() {
|
||
enterAnimation.restart();
|
||
Qt.callLater(root.revealNavEntry);
|
||
}
|
||
}
|
||
Loader {
|
||
id: page
|
||
objectName: "settingsPageLoader"
|
||
width: parent.width
|
||
height: parent.height
|
||
y: (1 - pageHost.enter) * 14 * Theme.intensity
|
||
opacity: pageHost.enter
|
||
active: ConfigService.ready && ShellState.settingsOpen
|
||
sourceComponent: {
|
||
switch (ShellState.settingsPage) {
|
||
case "metrics":
|
||
return metrics;
|
||
case "appearance":
|
||
return appearance;
|
||
case "wallpaper":
|
||
return wallpaper;
|
||
case "widgets":
|
||
return widgets;
|
||
case "bar":
|
||
return bar;
|
||
case "tray":
|
||
return tray;
|
||
case "dock":
|
||
return dock;
|
||
case "media":
|
||
return media;
|
||
case "osd":
|
||
return osd;
|
||
case "dashboard":
|
||
return dashboardPage;
|
||
case "plugins":
|
||
return pluginsPage;
|
||
case "launcher":
|
||
return launcher;
|
||
case "controlcenter":
|
||
return controlcenter;
|
||
case "network":
|
||
return network;
|
||
case "bluetooth":
|
||
return bluetooth;
|
||
case "audio":
|
||
return audio;
|
||
case "displays":
|
||
return displays;
|
||
case "notifications":
|
||
return notifications;
|
||
case "power":
|
||
return power;
|
||
case "lock":
|
||
return lockPage;
|
||
default:
|
||
return about;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
Text {
|
||
visible: ConfigService.error !== ""
|
||
text: ConfigService.error
|
||
color: Theme.urgent
|
||
wrapMode: Text.Wrap
|
||
Layout.fillWidth: true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
Component {
|
||
id: metrics
|
||
Pages.Metrics {}
|
||
}
|
||
Component {
|
||
id: appearance
|
||
Pages.Appearance {}
|
||
}
|
||
Component {
|
||
id: wallpaper
|
||
Pages.Wallpaper {}
|
||
}
|
||
Component {
|
||
id: widgets
|
||
Pages.Widgets {}
|
||
}
|
||
Component {
|
||
id: bar
|
||
Pages.Bar {}
|
||
}
|
||
Component {
|
||
id: tray
|
||
SettingsPage {
|
||
Pages.Tray {
|
||
Layout.fillWidth: true
|
||
}
|
||
}
|
||
}
|
||
Component {
|
||
id: dock
|
||
Pages.Dock {}
|
||
}
|
||
Component {
|
||
id: media
|
||
Pages.Media {}
|
||
}
|
||
Component {
|
||
id: osd
|
||
Pages.Osd {}
|
||
}
|
||
Component {
|
||
id: launcher
|
||
SettingsPage {
|
||
Pages.Launcher {
|
||
Layout.fillWidth: true
|
||
}
|
||
}
|
||
}
|
||
Component {
|
||
id: controlcenter
|
||
Pages.ControlCenter {}
|
||
}
|
||
Component {
|
||
id: network
|
||
Pages.Network {}
|
||
}
|
||
Component {
|
||
id: bluetooth
|
||
Pages.Bluetooth {}
|
||
}
|
||
Component {
|
||
id: audio
|
||
Pages.Audio {}
|
||
}
|
||
Component {
|
||
id: displays
|
||
Pages.Displays {}
|
||
}
|
||
Component {
|
||
id: notifications
|
||
Pages.Notifications {}
|
||
}
|
||
Component {
|
||
id: power
|
||
Pages.Power {}
|
||
}
|
||
Component {
|
||
id: pluginsPage
|
||
Pages.Plugins {}
|
||
}
|
||
Component {
|
||
id: dashboardPage
|
||
Pages.Dashboard {}
|
||
}
|
||
Component {
|
||
id: lockPage
|
||
Pages.Lock {}
|
||
}
|
||
Component {
|
||
id: about
|
||
Pages.About {}
|
||
}
|
||
}
|