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>
This commit is contained in:
1 parent
73de4b06a8
commit
e4ca1f5d9c
12 files changed
+95
-11
No files matched your search
@@ -21,7 +21,10 @@ PanelWindow {
|
|||||||
// so the drawer stays put while the pointer moves between its entries.
|
// so the drawer stays put while the pointer moves between its entries.
|
||||||
readonly property var anchorObject: anchorItem
|
readonly property var anchorObject: anchorItem
|
||||||
readonly property Item placementItem: anchorObject ? (anchorObject.placement || anchorObject) : null
|
readonly property Item placementItem: anchorObject ? (anchorObject.placement || anchorObject) : null
|
||||||
readonly property point anchorPoint: placementItem && anchorWindow ? placementItem.mapToItem(anchorWindow.contentItem, 0, 0) : Qt.point(0, 0)
|
// Window-relative, plus the window's screen offset for centred layers (the notch).
|
||||||
|
readonly property real windowOffsetX: anchorWindow && anchorWindow.screenOffsetX !== undefined ? anchorWindow.screenOffsetX : 0
|
||||||
|
readonly property point windowPoint: placementItem && anchorWindow ? placementItem.mapToItem(anchorWindow.contentItem, 0, 0) : Qt.point(0, 0)
|
||||||
|
readonly property point anchorPoint: Qt.point(windowPoint.x + windowOffsetX, windowPoint.y)
|
||||||
readonly property real availableWidth: screen ? screen.width : 1280
|
readonly property real availableWidth: screen ? screen.width : 1280
|
||||||
readonly property real targetWidth: Math.ceil(root.kind === "window" ? windowCard.implicitWidth : tip.implicitWidth)
|
readonly property real targetWidth: Math.ceil(root.kind === "window" ? windowCard.implicitWidth : tip.implicitWidth)
|
||||||
readonly property real targetHeight: Math.ceil(root.kind === "window" ? windowCard.implicitHeight : tip.implicitHeight)
|
readonly property real targetHeight: Math.ceil(root.kind === "window" ? windowCard.implicitHeight : tip.implicitHeight)
|
||||||
|
|||||||
@@ -83,7 +83,10 @@ PanelWindow {
|
|||||||
readonly property point anchorScreenPos: {
|
readonly property point anchorScreenPos: {
|
||||||
root.open
|
root.open
|
||||||
if (!anchorItem || !anchorWindow) return Qt.point(0, 0)
|
if (!anchorItem || !anchorWindow) return Qt.point(0, 0)
|
||||||
return anchorItem.mapToItem(anchorWindow.contentItem, 0, 0)
|
const p = anchorItem.mapToItem(anchorWindow.contentItem, 0, 0)
|
||||||
|
// Centred layers (the open notch) report their screen offset.
|
||||||
|
const offset = anchorWindow.screenOffsetX !== undefined ? anchorWindow.screenOffsetX : 0
|
||||||
|
return Qt.point(p.x + offset, p.y)
|
||||||
}
|
}
|
||||||
readonly property real anchorW: anchorItem ? anchorItem.width : 0
|
readonly property real anchorW: anchorItem ? anchorItem.width : 0
|
||||||
readonly property real anchorH: anchorItem ? anchorItem.height : 0
|
readonly property real anchorH: anchorItem ? anchorItem.height : 0
|
||||||
|
|||||||
@@ -268,7 +268,9 @@
|
|||||||
"left": ["workspaces"],
|
"left": ["workspaces"],
|
||||||
"right": ["tray"],
|
"right": ["tray"],
|
||||||
"strip": [],
|
"strip": [],
|
||||||
"controls": []
|
"controls": [],
|
||||||
|
"opacity": 0,
|
||||||
|
"color": ""
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ Singleton {
|
|||||||
available: true,
|
available: true,
|
||||||
group: "shell",
|
group: "shell",
|
||||||
icon: "",
|
icon: "",
|
||||||
keywords: ["Notch", "Notch mode", "Open on Media while audio plays", "Pocket-dots", "Left island", "Right island", "Notch strip"]
|
keywords: ["Notch", "Notch mode", "Notch opacity", "Notch colour", "Open on Media while audio plays", "Pocket-dots", "Left island", "Right island", "Notch strip"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "tray",
|
id: "tray",
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ PanelWindow {
|
|||||||
bodyHeight: panel.height
|
bodyHeight: panel.height
|
||||||
ear: BarDrawers.ear
|
ear: BarDrawers.ear
|
||||||
radius: panel.radius
|
radius: panel.radius
|
||||||
|
fillColor: Theme.notchFill
|
||||||
}
|
}
|
||||||
GlassPanel {
|
GlassPanel {
|
||||||
id: panel
|
id: panel
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ PanelWindow {
|
|||||||
readonly property real contentOpacity: Math.max(0, Math.min(1, (progress - 0.55) / 0.4))
|
readonly property real contentOpacity: Math.max(0, Math.min(1, (progress - 0.55) / 0.4))
|
||||||
|
|
||||||
anchors.top: true
|
anchors.top: true
|
||||||
|
// Screen x of this centred layer, so bar popouts (plugin tooltips) anchored
|
||||||
|
// in the strip land under their module.
|
||||||
|
readonly property real screenOffsetX: Math.round((screenWidth - implicitWidth) / 2)
|
||||||
implicitWidth: Math.round(bodyWidth + 2 * ear)
|
implicitWidth: Math.round(bodyWidth + 2 * ear)
|
||||||
implicitHeight: Math.max(1, Math.round(bodyHeight))
|
implicitHeight: Math.max(1, Math.round(bodyHeight))
|
||||||
visible: ShellState.notchOpen || progress > 0.001
|
visible: ShellState.notchOpen || progress > 0.001
|
||||||
@@ -91,7 +94,8 @@ PanelWindow {
|
|||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
// Shares the dashboard's HyprGlass namespace (already whitelisted).
|
// Shares the dashboard's HyprGlass namespace (already whitelisted).
|
||||||
WlrLayershell.namespace: "glassMxrph-dashboard"
|
WlrLayershell.namespace: "glassMxrph-dashboard"
|
||||||
WlrLayershell.keyboardFocus: ShellState.notchOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
// A plugin panel opened from the strip takes focus (and the pointer) while it is open.
|
||||||
|
WlrLayershell.keyboardFocus: ShellState.notchOpen && !PluginService.activePopout ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||||
Component.onCompleted: ShellState.notchWindow = root
|
Component.onCompleted: ShellState.notchWindow = root
|
||||||
Component.onDestruction: ShellState.notchWindow = null
|
Component.onDestruction: ShellState.notchWindow = null
|
||||||
|
|
||||||
@@ -107,6 +111,15 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keyboard focus comes back once a plugin panel from the strip closes.
|
||||||
|
Connections {
|
||||||
|
target: PluginService
|
||||||
|
function onActivePopoutChanged() {
|
||||||
|
if (!PluginService.activePopout && ShellState.notchOpen)
|
||||||
|
body.forceActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Exclusive focus routes outside clicks here (see ControlCenter).
|
// Exclusive focus routes outside clicks here (see ControlCenter).
|
||||||
MouseArea {
|
MouseArea {
|
||||||
objectName: "notchOutside"
|
objectName: "notchOutside"
|
||||||
@@ -122,6 +135,7 @@ PanelWindow {
|
|||||||
bodyHeight: root.bodyHeight
|
bodyHeight: root.bodyHeight
|
||||||
ear: root.ear
|
ear: root.ear
|
||||||
radius: Math.min(Theme.radius + 8, root.bodyHeight / 2)
|
radius: Math.min(Theme.radius + 8, root.bodyHeight / 2)
|
||||||
|
fillColor: Theme.notchFill
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ Item {
|
|||||||
bodyHeight: root.height
|
bodyHeight: root.height
|
||||||
ear: BarDrawers.ear
|
ear: BarDrawers.ear
|
||||||
radius: Math.min(Theme.radius, root.height / 2)
|
radius: Math.min(Theme.radius, root.height / 2)
|
||||||
|
fillColor: Theme.notchFill
|
||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
id: content
|
id: content
|
||||||
|
|||||||
@@ -19,21 +19,26 @@ Singleton {
|
|||||||
error = "This desktop entry is no longer installed.";
|
error = "This desktop entry is no longer installed.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
let command = action ? action.command : entry.command;
|
||||||
if (entry.runInTerminal) {
|
if (entry.runInTerminal) {
|
||||||
const terminal = ConfigService.data.dock.terminalCommand;
|
const terminal = ConfigService.data.dock.terminalCommand;
|
||||||
if (!terminal.length) {
|
if (!terminal.length) {
|
||||||
error = "Set dock.terminalCommand to a terminal command argument array before launching terminal applications.";
|
error = "Set dock.terminalCommand to a terminal command argument array before launching terminal applications.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
command = terminal.concat(command);
|
||||||
|
}
|
||||||
Quickshell.execDetached({
|
Quickshell.execDetached({
|
||||||
command: terminal.concat(action ? action.command : entry.command),
|
command: scoped(command),
|
||||||
workingDirectory: entry.workingDirectory
|
workingDirectory: entry.workingDirectory
|
||||||
});
|
});
|
||||||
} else if (action)
|
|
||||||
action.execute();
|
|
||||||
else
|
|
||||||
entry.execute();
|
|
||||||
error = "";
|
error = "";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// Run the app in its own transient systemd scope. Launched directly, it would
|
||||||
|
// join the shell's cgroup and be killed whenever the shell service restarts.
|
||||||
|
// Falls back to a plain launch where systemd-run is unavailable.
|
||||||
|
function scoped(command) {
|
||||||
|
return ["sh", "-c", 'if command -v systemd-run >/dev/null 2>&1; then exec systemd-run --user --scope --collect --quiet -- "$@"; fi; exec "$@"', "sh"].concat(command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -87,6 +87,7 @@ function validate(c) {
|
|||||||
if(!c.notch || ["enabled","mediaFirst"].some(k=>typeof c.notch[k]!=="boolean"))throw Error("Invalid notch preferences");
|
if(!c.notch || ["enabled","mediaFirst"].some(k=>typeof c.notch[k]!=="boolean"))throw Error("Invalid notch preferences");
|
||||||
for(const key of ["left","right","strip"]) if(!Array.isArray(c.notch[key]) || c.notch[key].some(id=>typeof id!=="string" || !id))throw Error("Invalid notch modules");
|
for(const key of ["left","right","strip"]) if(!Array.isArray(c.notch[key]) || c.notch[key].some(id=>typeof id!=="string" || !id))throw Error("Invalid notch modules");
|
||||||
if(!Array.isArray(c.notch.controls) || c.notch.controls.some(m=>!m || typeof m.id!=="string" || typeof m.enabled!=="boolean" || ["w","h"].some(k=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<1 || m[k]>4)) || [["x",3],["y",63]].some(([k,max])=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<0 || m[k]>max))))throw Error("Invalid notch controls");
|
if(!Array.isArray(c.notch.controls) || c.notch.controls.some(m=>!m || typeof m.id!=="string" || typeof m.enabled!=="boolean" || ["w","h"].some(k=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<1 || m[k]>4)) || [["x",3],["y",63]].some(([k,max])=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<0 || m[k]>max))))throw Error("Invalid notch controls");
|
||||||
|
if(!Number.isFinite(c.notch.opacity) || c.notch.opacity<0 || c.notch.opacity>100 || typeof c.notch.color!=="string" || (c.notch.color!=="" && !/^#[0-9a-fA-F]{6}$/.test(c.notch.color)))throw Error("Invalid notch colour");
|
||||||
if(typeof c.osd.enabled!=="boolean" || !["slide","drop","fade","shrink"].includes(c.osd.animation) || !["top-right","top-center","bottom-center"].includes(c.osd.position) || !Number.isInteger(c.osd.timeout) || c.osd.timeout<500 || c.osd.timeout>5000 || !Number.isInteger(c.osd.step) || c.osd.step<1 || c.osd.step>20)throw Error("Invalid OSD preferences");
|
if(typeof c.osd.enabled!=="boolean" || !["slide","drop","fade","shrink"].includes(c.osd.animation) || !["top-right","top-center","bottom-center"].includes(c.osd.position) || !Number.isInteger(c.osd.timeout) || c.osd.timeout<500 || c.osd.timeout>5000 || !Number.isInteger(c.osd.step) || c.osd.step<1 || c.osd.step>20)throw Error("Invalid OSD preferences");
|
||||||
const notes=c.notifications;
|
const notes=c.notifications;
|
||||||
if(!notes || ["enabled","doNotDisturb","criticalInDnd"].some(k=>typeof notes[k]!=="boolean") || !["slide","drop","fade","shrink"].includes(notes.animation) || !["top-right","top-center"].includes(notes.position) || !Number.isInteger(notes.timeout) || notes.timeout<1000 || notes.timeout>30000 || !Number.isInteger(notes.maxPopups) || notes.maxPopups<1 || notes.maxPopups>6)throw Error("Invalid notification preferences");
|
if(!notes || ["enabled","doNotDisturb","criticalInDnd"].some(k=>typeof notes[k]!=="boolean") || !["slide","drop","fade","shrink"].includes(notes.animation) || !["top-right","top-center"].includes(notes.position) || !Number.isInteger(notes.timeout) || notes.timeout<1000 || notes.timeout>30000 || !Number.isInteger(notes.maxPopups) || notes.maxPopups<1 || notes.maxPopups>6)throw Error("Invalid notification preferences");
|
||||||
|
|||||||
@@ -238,8 +238,9 @@ Singleton {
|
|||||||
if (activePopout && activePopout !== owner && typeof activePopout.close === "function")
|
if (activePopout && activePopout !== owner && typeof activePopout.close === "function")
|
||||||
activePopout.close();
|
activePopout.close();
|
||||||
activePopout = owner;
|
activePopout = owner;
|
||||||
|
// The notch stays open: its strip hosts plugin widgets whose panels
|
||||||
|
// open from it. It hands keyboard focus over while one is open.
|
||||||
ShellState.controlCenterOpen = false;
|
ShellState.controlCenterOpen = false;
|
||||||
ShellState.notchOpen = false;
|
|
||||||
ShellState.dashboardOpen = false;
|
ShellState.dashboardOpen = false;
|
||||||
PopoutState.close();
|
PopoutState.close();
|
||||||
TrayService.close();
|
TrayService.close();
|
||||||
@@ -413,6 +414,10 @@ Singleton {
|
|||||||
if (ShellState.launcherOpen)
|
if (ShellState.launcherOpen)
|
||||||
root.closePopout();
|
root.closePopout();
|
||||||
}
|
}
|
||||||
|
function onNotchOpenChanged() {
|
||||||
|
if (!ShellState.notchOpen)
|
||||||
|
root.closePopout();
|
||||||
|
}
|
||||||
function onSettingsOpenChanged() {
|
function onSettingsOpenChanged() {
|
||||||
if (ShellState.settingsOpen)
|
if (ShellState.settingsOpen)
|
||||||
root.closePopout();
|
root.closePopout();
|
||||||
|
|||||||
@@ -72,6 +72,47 @@ SettingsPage {
|
|||||||
setting: "notch.enabled"
|
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 {
|
SettingsSection {
|
||||||
title: "Opening"
|
title: "Opening"
|
||||||
enabled: root.options.enabled
|
enabled: root.options.enabled
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ Singleton {
|
|||||||
// opacity, controls and cards are translucent shades of it (never grey overlays).
|
// opacity, controls and cards are translucent shades of it (never grey overlays).
|
||||||
readonly property color tint: ConfigService.ready && /^#[0-9a-fA-F]{6}$/.test(ConfigService.data.appearance.glassTint) ? ConfigService.data.appearance.glassTint : "#000000"
|
readonly property color tint: ConfigService.ready && /^#[0-9a-fA-F]{6}$/.test(ConfigService.data.appearance.glassTint) ? ConfigService.data.appearance.glassTint : "#000000"
|
||||||
readonly property color surface: tint
|
readonly property color surface: tint
|
||||||
|
// Notch mode's fill: at opacity 0 it is the normal glass; raising it moves
|
||||||
|
// towards a solid colour (the glass tint unless a notch colour is set).
|
||||||
|
readonly property color notchFill: {
|
||||||
|
const n = ConfigService.ready ? ConfigService.data.notch : null;
|
||||||
|
const c = n && /^#[0-9a-fA-F]{6}$/.test(n.color) ? n.color : tint;
|
||||||
|
const o = n ? Math.max(0, Math.min(100, n.opacity)) / 100 : 0;
|
||||||
|
return Qt.alpha(c, glassOpacity + (1 - glassOpacity) * o);
|
||||||
|
}
|
||||||
readonly property color surfaceVariant: Qt.alpha(tint, 0.38)
|
readonly property color surfaceVariant: Qt.alpha(tint, 0.38)
|
||||||
readonly property color fill: Qt.alpha(tint, 0.22)
|
readonly property color fill: Qt.alpha(tint, 0.22)
|
||||||
readonly property color hover: Qt.alpha(text, 0.09)
|
readonly property color hover: Qt.alpha(text, 0.09)
|
||||||
|
|||||||
Reference in new issue
Block a user