Settings → Notch switches it on. The bar becomes left and right islands with a notch at the top centre. Super+C, Super+X and a click on the notch open a three-column panel: dashboard pages on the left (Media, Performance, Calendar; the wheel switches them), the Control Center tiles and weather in the middle, and notifications on the right. The Performance card opens the full "Your computer" view. The launcher drops out of the notch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
440 lines
15 KiB
QML
440 lines
15 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
|
||
|
||
// Search lives in the sidebar; these forward to it for shortcuts and tests.
|
||
readonly property bool searchActive: sidebar.searchActive
|
||
readonly property var searchResults: sidebar.searchResults
|
||
function openSearch() {
|
||
sidebar.openSearch();
|
||
}
|
||
function chooseResult(result) {
|
||
sidebar.chooseResult(result);
|
||
}
|
||
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]);
|
||
}
|
||
|
||
Connections {
|
||
target: ShellState
|
||
function onSettingsOpenChanged() {
|
||
if (!ShellState.settingsOpen && root.searchActive)
|
||
sidebar.closeSearch();
|
||
if (ShellState.settingsOpen)
|
||
Qt.callLater(sidebar.revealNavEntry);
|
||
}
|
||
}
|
||
Timer {
|
||
// Clear the reveal request once matching rows have flashed.
|
||
running: ShellState.settingsHighlight !== ""
|
||
interval: 3000
|
||
onTriggered: ShellState.settingsHighlight = ""
|
||
}
|
||
|
||
// 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
|
||
|
||
SettingsSidebar {
|
||
id: sidebar
|
||
window: root
|
||
cornerRadius: panel.radius
|
||
visible: root.wide
|
||
Layout.fillHeight: true
|
||
Layout.preferredWidth: 252
|
||
onSearchClosed: panel.forceActiveFocus()
|
||
}
|
||
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
|
||
SettingsDragArea {
|
||
window: root
|
||
}
|
||
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(sidebar.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 "notch":
|
||
return notchPage;
|
||
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: notchPage
|
||
Pages.Notch {}
|
||
}
|
||
Component {
|
||
id: lockPage
|
||
Pages.Lock {}
|
||
}
|
||
Component {
|
||
id: about
|
||
Pages.About {}
|
||
}
|
||
}
|