Files
glassMxrph/quickshell/settings/pages/Notch.qml
T
mxandClaude Opus 5.5 e4ca1f5d9c Add notch opacity and colour; open plugin panels from the notch strip
- Settings → Notch → Look: opacity (0% glass to 100% solid) and colour
  for the notch, the open notch and the notch-mode launcher.
- Bar popouts and plugin panels add the open notch's screen offset, so
  tooltips and panels from the strip land under their module.
- Opening a plugin panel keeps the notch open; the notch hands keyboard
  focus to the panel and takes it back when it closes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 17:18:58 +01:00

161 lines
6.1 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import "../controls"
import "../../components"
import "../../core"
import "../../services"
import "../../theme"
SettingsPage {
id: root
readonly property var options: ConfigService.data.notch
// Adds or removes a bar module from one of the notch's module lists.
function toggleModule(key, id) {
const list = (options[key] || []).slice();
const at = list.indexOf(id);
if (at >= 0)
list.splice(at, 1);
else
list.push(id);
ConfigService.setValue("notch." + key, list);
}
// Chips for every bar module; filled ones are shown there, in click order.
component ModulePicker: SettingRow {
id: picker
property string key
below: Flow {
Layout.fillWidth: true
spacing: 6
Repeater {
model: ModuleRegistry.available
Rectangle {
id: chip
required property string modelData
readonly property bool on: (root.options[picker.key] || []).includes(modelData)
objectName: "notchModule-" + picker.key + "-" + modelData
implicitWidth: chipLabel.implicitWidth + 24
implicitHeight: 28
radius: 14
color: on ? (chipArea.containsMouse ? Theme.accentHover : Theme.accent) : chipArea.containsMouse ? Theme.hover : Theme.fill
border.width: on ? 0 : 1
border.color: Theme.hairline
Accessible.role: Accessible.CheckBox
Accessible.name: ModuleRegistry.title(modelData)
Accessible.checked: on
Text {
id: chipLabel
anchors.centerIn: parent
text: ModuleRegistry.title(chip.modelData)
color: chip.on ? Theme.accentText : Theme.text
font.pixelSize: 12
font.weight: Font.Medium
}
MouseArea {
id: chipArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.toggleModule(picker.key, chip.modelData)
}
}
}
}
}
SettingsSection {
title: "Notch"
description: "Splits the bar into side islands with a notch at the top centre. Super+C, Super+X and a click on the notch open it: dashboard pages on the left (scroll to switch), controls and weather in the middle, notifications on the right. The launcher drops out of it."
PreferenceToggle {
label: "Notch"
description: root.options.enabled ? "On: notch mode" : "Off: the full bar"
icon: "󰹑"
setting: "notch.enabled"
}
}
SettingsSection {
title: "Look"
description: "0% is the normal glass. Raise the opacity towards a solid colour: e.g. 50% with a purple colour, or 100% black for OLED."
enabled: root.options.enabled
PreferenceSlider {
label: "Notch opacity"
icon: "󰃟"
setting: "notch.opacity"
from: 0
to: 100
step: 1
unit: "%"
}
SettingRow {
title: "Notch colour"
description: root.options.color ? "Custom colour" : "Glass tint (Appearance)"
icon: "󰏘"
setting: "notch.color"
GlassTextField {
Layout.preferredWidth: 120
color: Theme.text
selectByMouse: true
placeholderText: "Glass tint"
text: root.options.color
validator: RegularExpressionValidator {
regularExpression: /(#[0-9a-fA-F]{6})?/
}
onEditingFinished: if (acceptableInput)
ConfigService.setValue("notch.color", text)
}
GlassButton {
text: "Black"
onClicked: ConfigService.setValue("notch.color", "#000000")
}
below: GlassColorPicker {
Layout.fillWidth: true
selectedColor: root.options.color || Theme.tint
onChosen: color => ConfigService.setValue("notch.color", color.toString())
}
}
}
SettingsSection {
title: "Opening"
enabled: root.options.enabled
PreferenceToggle {
label: "Open on Media while audio plays"
description: "Otherwise it opens on the last page"
icon: "󰝚"
setting: "notch.mediaFirst"
}
SettingRow {
title: "Preview"
icon: "󰈈"
GlassButton {
objectName: "notchOpenButton"
text: "Open notch"
enabled: root.options.enabled
onClicked: ShellState.openNotch()
}
}
}
SettingsSection {
title: "Modules"
description: "Which bar modules show in notch mode. The strip sits left of the clock in the open notch; the mouse wheel scrolls it sideways when it overflows."
enabled: root.options.enabled
ModulePicker {
title: "Notch strip"
description: "Left of the clock in the open notch, e.g. AI usage or the screen recorder"
icon: "󰹑"
key: "strip"
}
ModulePicker {
title: "Left island"
icon: "󰁍"
key: "left"
}
ModulePicker {
title: "Right island"
icon: "󰁔"
key: "right"
}
}
SettingNote {
text: "Super+N switches between notch mode and the full bar. The middle column uses your Control Center tiles; the cog in the open notch edits the notch's own layout, separate from the Control Center. Reset there to follow the Control Center again."
}
}