Files
glassMxrph/quickshell/settings/pages/Notch.qml
T
mxandClaude Opus 5.5 efaace0f15 Add notch speeds and a glassy-when-open option
- Settings → Notch → Look: separate opening, closing and colour-change
  speeds for the notch and the notch-mode launcher.
- "Glassy when open" keeps the custom colour/opacity on the docked notch
  and fades the open notch and launcher back to the normal glass; closing
  never outlasts the shrink, so it docks in the docked colour.

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

197 lines
7.3 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: "%"
}
PreferenceToggle {
label: "Glassy when open"
description: "Keeps the colour and opacity on the docked notch; the open notch and launcher fade back to the normal glass"
icon: "󰂵"
setting: "notch.glassOnOpen"
}
PreferenceSlider {
label: "Opening speed"
description: "Notch and launcher; 100% follows the shell's animation duration"
icon: "󰓅"
setting: "notch.openSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
PreferenceSlider {
label: "Closing speed"
description: "100% follows the shell's animation duration"
icon: "󰾆"
setting: "notch.closeSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
PreferenceSlider {
label: "Colour change speed"
description: "How fast the docked colour turns glassy when opening (closing never outlasts the close)"
icon: "󰏘"
setting: "notch.colorSpeed"
from: 25
to: 300
step: 5
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."
}
}