Files
glassMxrph/quickshell/settings/pages/Notch.qml
T
mxandClaude Opus 5.5 bc197339fa Add bar spots beside the notch, and Caffeine and Night Light modules
Notch mode gets two more module lists, notch.innerLeft and
notch.innerRight: spots right beside the notch at the same distance on
both sides. They follow the notch's edges as it springs wider for media,
never draw pills (plugins and the tray drop theirs there), and fade out
while the notch is open or widened. Picking a module for one of the four
side spots in Settings -> Notch moves it there from the others.

Caffeine and Night Light are now bar modules too; Night Light polls its
state every 30 s while only the bar watches it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 23:27:01 +01:00

263 lines
9.5 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
// The four spots in the bar row; a module sits in one of them at a time.
readonly property var sideKeys: ["left", "innerLeft", "innerRight", "right"]
// Adds or removes a bar module from one of the notch's module lists.
// Adding it to a side spot moves it there from the other side spots.
function toggleModule(key, id) {
const list = (options[key] || []).slice();
const at = list.indexOf(id);
if (at >= 0) {
list.splice(at, 1);
return ConfigService.setValue("notch." + key, list);
}
list.push(id);
const next = Object.assign({}, options, {
[key]: list
});
if (sideKeys.includes(key))
for (const other of sideKeys)
if (other !== key)
next[other] = (options[other] || []).filter(m => m !== id);
ConfigService.setValue("notch", next);
}
// 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+N switches between notch mode and the full bar."
PreferenceToggle {
label: "Notch mode"
description: root.options.enabled ? "On: islands and a notch" : "Off: the full bar"
icon: "󰹑"
setting: "notch.enabled"
}
SettingRow {
title: "Preview"
description: "Super+C, Super+X or a click on the notch open it too"
icon: "󰈈"
GlassButton {
objectName: "notchOpenButton"
text: "Open notch"
enabled: root.options.enabled
onClicked: ShellState.openNotch()
}
}
}
SettingsSection {
title: "Islands"
description: "The bar modules either side of the notch."
enabled: root.options.enabled
PreferenceChoice {
label: "Island style"
description: "float: modules on the wallpaper; pill: rounded pills; notch: hung from the top edge like the notch. Pill and notch use the notch colour."
icon: "󰕰"
setting: "notch.islandStyle"
choices: ["float", "pill", "notch"]
}
ModulePicker {
title: "Left island"
icon: "󰁍"
key: "left"
}
ModulePicker {
title: "Right island"
icon: "󰁔"
key: "right"
}
ModulePicker {
title: "Left of the notch"
description: "Right beside the notch, always without a pill"
icon: "󰁍"
key: "innerLeft"
}
ModulePicker {
title: "Right of the notch"
description: "Right beside the notch, always without a pill"
icon: "󰁔"
key: "innerRight"
}
PreferenceChoice {
label: "Workspace style"
description: "\"bar\" uses the style from Settings → Bar"
icon: "󰕮"
setting: "notch.workspaceStyle"
choices: ["bar", "numbers", "roman", "kanji", "dots", "pacman"]
}
}
SettingsSection {
title: "Open notch"
description: "Dashboard pages on the left (scroll to switch), controls and weather in the middle, notifications on the right. The cog edits its tiles in place, separately from the Control Center."
enabled: root.options.enabled
PreferenceToggle {
label: "Open on Media while audio plays"
description: "Otherwise it opens on the last page"
icon: "󰝚"
setting: "notch.mediaFirst"
}
ModulePicker {
title: "Module strip"
description: "Bar modules left of the clock, e.g. AI usage or the screen recorder. The mouse wheel scrolls it when it overflows."
icon: "󰹑"
key: "strip"
}
}
SettingsSection {
title: "Colour"
description: "0% opacity is the normal glass. Raise it towards a solid colour: e.g. 50% with a purple colour, or 100% black for OLED."
enabled: root.options.enabled
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())
}
}
PreferenceSlider {
label: "Opacity"
icon: "󰃟"
setting: "notch.opacity"
from: 0
to: 100
step: 1
unit: "%"
}
PreferenceToggle {
label: "Glassy when open"
description: "The open notch fades back to the normal glass; the docked notch keeps the colour"
icon: "󰂵"
setting: "notch.glassOnOpen"
}
PreferenceToggle {
visible: root.options.glassOnOpen
label: "Launcher keeps notch colour"
description: "Off: the launcher turns glassy too"
icon: "󰍉"
setting: "notch.launcherMatch"
}
PreferenceSlider {
visible: root.options.glassOnOpen
label: "Colour change speed"
description: "How fast it turns glassy when opening (closing never outlasts the close)"
icon: "󰏘"
setting: "notch.colorSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
}
SettingsSection {
title: "Animation"
description: "Notch and launcher; 100% follows the shell's animation duration."
enabled: root.options.enabled
PreferenceSlider {
label: "Opening speed"
icon: "󰓅"
setting: "notch.openSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
PreferenceSlider {
label: "Closing speed"
icon: "󰾆"
setting: "notch.closeSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
PreferenceSlider {
label: "Panel opening speed"
description: "Quick Fix, tray menus and other panels that drop out of an island"
icon: "󰖌"
setting: "notch.panelOpenSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
PreferenceSlider {
label: "Panel closing speed"
icon: "󰖌"
setting: "notch.panelCloseSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
}
}