Grow the notch launcher down once you search

The empty launcher stays in the widened notch, now laid out exactly
like the launcher window's bar. Typing (or the magnifying glass / Down)
hands over to the launcher window, which opens at the notch's size with
the text already in it and only grows down with the results; clearing
the search shrinks it back into the notch. The query and browse state
are shared through ShellState, keys typed during the hand-over carry
across, and the bar keeps its keyboard claim so focus returns on its own.
The launcher window's open state is read from plain properties so it
never maps for a frame on a stale value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-14 15:09:46 +01:00
1 parent 1f029922ec
commit 415b1b3cd6
5 files changed
+143 -194

No files matched your search

+5 -1
View File
@@ -37,7 +37,11 @@ PanelWindow {
// The notch's search takes the keyboard while it is open on this screen; // The notch's search takes the keyboard while it is open on this screen;
// a click anywhere else closes it. // a click anywhere else closes it.
readonly property bool searching: notch && ShellState.notchSearch && ScreenService.current(ShellState.launcherScreen) === screen readonly property bool searching: notch && ShellState.notchSearch && ScreenService.current(ShellState.launcherScreen) === screen
WlrLayershell.keyboardFocus: searching ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None // Holds the keyboard for as long as the launcher is open here. The launcher
// window's own claim (overlay layer) wins while it is up; when it hands
// back, the keyboard returns here without asking again.
readonly property bool typing: notch && ShellState.notchLauncher && ScreenService.current(ShellState.launcherScreen) === screen
WlrLayershell.keyboardFocus: typing ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
// The grab starts once the bar holds the keyboard; started together with // The grab starts once the bar holds the keyboard; started together with
// the focus change, Hyprland clears it at once and the search closes. // the focus change, Hyprland clears it at once and the search closes.
property bool grabbing: false property bool grabbing: false
+16 -3
View File
@@ -129,9 +129,22 @@ Singleton {
// "emoji" is the Emoji Picker. // "emoji" is the Emoji Picker.
// Changing it on an open launcher switches in place. // Changing it on an open launcher switches in place.
property string launcherMode: "apps" property string launcherMode: "apps"
// Notch mode searches apps in the notch pill itself, the way a notification // Notch mode opens the launcher in the notch pill itself, the way a
// widens it; clipboard history and emoji still open the launcher window. // notification widens it. While the search is empty it stays there
readonly property bool notchSearch: notchMode && launcherOpen && launcherMode === "apps" // (notchSearch); typing or browsing hands over to the launcher window,
// which grows down from the widened pill. Both share the query.
property string launcherQuery: ""
property bool launcherBrowse: false
readonly property bool notchLauncher: notchMode && launcherOpen && launcherMode === "apps"
readonly property bool notchSearch: notchLauncher && launcherQuery === "" && !launcherBrowse
onLauncherOpenChanged: {
launcherQuery = "";
launcherBrowse = false;
}
onLauncherModeChanged: {
launcherQuery = "";
launcherBrowse = false;
}
function activeScreen() { function activeScreen() {
return ScreenService.active; return ScreenService.active;
} }
+31 -12
View File
@@ -85,7 +85,10 @@ PanelWindow {
readonly property bool notch: ShellState.notchMode readonly property bool notch: ShellState.notchMode
// Notch mode searches apps inside the notch itself (NotchSearch); this // Notch mode searches apps inside the notch itself (NotchSearch); this
// window only opens there for clipboard history and emoji. // window only opens there for clipboard history and emoji.
readonly property bool open: ShellState.launcherOpen && !ShellState.notchSearch // Read from the plain properties, not ShellState.notchSearch, so it never
// reads a stale value mid-update and maps for a frame.
readonly property bool open: ShellState.launcherOpen && !(ShellState.notchMode && ShellState.launcherMode === "apps" && ShellState.launcherQuery === "" && !ShellState.launcherBrowse)
onOpenChanged: reset()
// Notch mode morphs the collapsed notch into the launcher, as the notch // Notch mode morphs the collapsed notch into the launcher, as the notch
// panel does: solid shape throughout, width leading the height a little, // panel does: solid shape throughout, width leading the height a little,
// contents fading in once it is mostly open and out first. // contents fading in once it is mostly open and out first.
@@ -184,18 +187,33 @@ PanelWindow {
launchError = ApplicationsService.error; launchError = ApplicationsService.error;
} }
// Fresh state each time the window opens. // Fresh state each time the window opens.
// Fresh state each time the window opens; from the notch's search it
// carries on with what was typed there.
function reset() { function reset() {
if (!open) if (!open)
return; return;
search.text = ""; fromNotch = notch && ShellState.launcherMode === "apps";
browsing = false; search.text = fromNotch ? ShellState.launcherQuery : "";
browsing = fromNotch && ShellState.launcherBrowse;
launchError = ""; launchError = "";
selectedIndex = 0; selectedIndex = 0;
ClipboardService.refresh(); ClipboardService.refresh();
if (emojiMode) if (emojiMode)
EmojiService.load(); EmojiService.load();
Qt.callLater(() => search.forceActiveFocus()); Qt.callLater(() => {
search.forceActiveFocus();
search.cursorPosition = search.text.length;
});
} }
// Opened from the notch's search: it starts at the widened notch's size
// with the bar already showing, and only grows down.
property bool fromNotch: false
readonly property bool compact: notch && fromNotch && ShellState.notchLauncher
// Typing and browsing are shared with the notch's search; emptying both
// hands back to it.
readonly property bool sharing: notch && open && ShellState.launcherMode === "apps"
onBrowsingChanged: if (sharing)
ShellState.launcherBrowse = browsing
function toggleBrowse() { function toggleBrowse() {
if (clipboardMode || emojiMode) { if (clipboardMode || emojiMode) {
ShellState.launcherMode = "apps"; ShellState.launcherMode = "apps";
@@ -217,11 +235,10 @@ PanelWindow {
} }
Connections { Connections {
target: ShellState target: ShellState
function onLauncherOpenChanged() { // Keys typed in the notch before this window has the keyboard.
root.reset(); function onLauncherQueryChanged() {
} if (root.open && !search.activeFocus && search.text !== ShellState.launcherQuery)
function onNotchSearchChanged() { search.text = ShellState.launcherQuery;
root.reset();
} }
function onLauncherModeChanged() { function onLauncherModeChanged() {
if (root.emojiMode) if (root.emojiMode)
@@ -357,7 +374,7 @@ PanelWindow {
width: 1 width: 1
height: Math.round(BarDrawers.bottom * 0.5) height: Math.round(BarDrawers.bottom * 0.5)
color: Theme.hairline color: Theme.hairline
opacity: root.contentOpacity opacity: root.compact ? 1 : root.contentOpacity
} }
GlassPanel { GlassPanel {
id: panel id: panel
@@ -365,13 +382,13 @@ PanelWindow {
x: Math.round((root.width - width) / 2) x: Math.round((root.width - width) / 2)
y: root.notch ? 0 : Math.round(root.height * 0.22) y: root.notch ? 0 : Math.round(root.height * 0.22)
// Notch mode grows out of the collapsed notch and shrinks back into it. // Notch mode grows out of the collapsed notch and shrinks back into it.
width: root.notch ? ShellState.notchPillWidth + (root.targetWidth - ShellState.notchPillWidth) * root.wp : root.open ? root.targetWidth : Math.min(320, root.targetWidth) width: root.compact ? root.targetWidth : root.notch ? ShellState.notchPillWidth + (root.targetWidth - ShellState.notchPillWidth) * root.wp : root.open ? root.targetWidth : Math.min(320, root.targetWidth)
height: root.notch ? BarDrawers.bottom + (root.heldHeight - BarDrawers.bottom) * root.progress : root.barHeight + root.bodyHeight height: root.notch ? BarDrawers.bottom + (root.heldHeight - BarDrawers.bottom) * root.progress : root.barHeight + root.bodyHeight
color: root.notch ? Theme.transparent : Qt.alpha(Theme.surface, surfaceOpacity) color: root.notch ? Theme.transparent : Qt.alpha(Theme.surface, surfaceOpacity)
border.width: root.notch ? 0 : 1 border.width: root.notch ? 0 : 1
plain: root.notch plain: root.notch
radius: Math.min(Theme.radius + 6, root.barHeight / 2) radius: Math.min(Theme.radius + 6, root.barHeight / 2)
opacity: root.notch ? root.contentOpacity : root.open ? 1 : 0 opacity: root.compact ? 1 : root.notch ? root.contentOpacity : root.open ? 1 : 0
scale: root.open || root.notch ? 1 : 1 - 0.04 * Theme.intensity scale: root.open || root.notch ? 1 : 1 - 0.04 * Theme.intensity
clip: true clip: true
Behavior on width { Behavior on width {
@@ -464,6 +481,8 @@ PanelWindow {
padding: 0 padding: 0
maximumLength: 256 maximumLength: 256
onTextEdited: root.launchError = "" onTextEdited: root.launchError = ""
onTextChanged: if (root.sharing && text !== ShellState.launcherQuery)
ShellState.launcherQuery = text
Keys.onEscapePressed: { Keys.onEscapePressed: {
if (text !== "") if (text !== "")
clear(); clear();
+85 -175
View File
@@ -1,61 +1,37 @@
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Controls
import "../components"
import "../core" import "../core"
import "../services"
import "../theme" import "../theme"
// The launcher in notch mode: a search field and a row of top matches inside // The launcher's empty state in notch mode: its search bar inside the widened
// the widened notch, the way a notification shows there. Enter launches the // notch, laid out exactly like the launcher window's bar. The first keystroke
// highlighted match, Tab and the arrow keys move along the row, Escape clears // (or the magnifying glass) hands over to the launcher window, which opens at
// and then closes. Clipboard history and emoji open the launcher window. // this size and grows down with the results; clearing the search hands back.
Item { Item {
id: root id: root
property bool active: false property bool active: false
readonly property string query: input.text.trim() // The launcher window's bar is this tall; rows centre on it.
readonly property bool commandMode: query.startsWith(">") readonly property int barHeight: 60
readonly property int maxShown: 6 readonly property int pillSize: 36
readonly property var results: (commandMode ? commands.results : apps.results).slice(0, maxShown) property string pillHover: ""
property int selectedIndex: 0
property string launchError: ""
readonly property var selected: results[selectedIndex] || null
onResultsChanged: selectedIndex = 0
onActiveChanged: { onActiveChanged: {
input.text = ""; if (!active)
launchError = "";
selectedIndex = 0;
if (active)
Qt.callLater(() => input.forceActiveFocus());
}
AppSearch {
id: apps
enabled: root.active && root.query !== "" && !root.commandMode
query: root.query
limit: root.maxShown
}
CommandSearch {
id: commands
enabled: root.active && root.commandMode
query: root.query
limit: root.maxShown
}
function select(offset) {
if (results.length)
selectedIndex = (selectedIndex + offset + results.length) % results.length;
}
function activate(index) {
const result = results[index];
if (!result)
return; return;
if (result.command) { if (input.text !== ShellState.launcherQuery)
const command = CommandRegistry.commands.find(c => c.id === result.id); input.text = ShellState.launcherQuery;
if (!command || !command.stay) Qt.callLater(() => {
ShellState.launcherOpen = false; input.forceActiveFocus();
CommandRegistry.execute(result.id); input.cursorPosition = input.text.length;
} else if (ApplicationsService.launch(result.entry, null)) });
ShellState.launcherOpen = false; }
else Connections {
launchError = ApplicationsService.error; target: ShellState
function onLauncherQueryChanged() {
if (input.text !== ShellState.launcherQuery)
input.text = ShellState.launcherQuery;
}
} }
// Swallows clicks so they reach the field, not the pill behind it. // Swallows clicks so they reach the field, not the pill behind it.
@@ -63,169 +39,103 @@ Item {
anchors.fill: parent anchors.fill: parent
onClicked: input.forceActiveFocus() onClicked: input.forceActiveFocus()
} }
Rectangle {
x: 12
y: (root.barHeight - height) / 2
width: 38
height: 38
radius: 12
color: browseArea.containsMouse ? Theme.hover : Theme.transparent
Accessible.role: Accessible.Button
Accessible.name: "Show all applications"
Text { Text {
id: glass anchors.centerIn: parent
x: 14
anchors.verticalCenter: parent.verticalCenter
text: Icons.available ? "󰍉" : "⌕" text: Icons.available ? "󰍉" : "⌕"
font.family: Icons.available ? Icons.family : "" font.family: Icons.available ? Icons.family : ""
font.pixelSize: 17
color: Theme.textSecondary color: Theme.textSecondary
} font.pixelSize: 20
// Typed text, then the highlighted match's name in grey after it.
Item {
id: field
anchors.left: glass.right
anchors.leftMargin: 10
anchors.right: strip.left
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
height: 24
clip: true
TextInput {
id: input
objectName: "notchSearchInput"
anchors.verticalCenter: parent.verticalCenter
width: Math.max(1, Math.min(contentWidth + 2, field.width))
color: Theme.text
selectionColor: Theme.accent
selectedTextColor: Theme.text
font.pixelSize: 15
maximumLength: 256
onTextEdited: root.launchError = ""
Keys.onEscapePressed: {
if (text !== "")
clear();
else
ShellState.launcherOpen = false;
}
Keys.onTabPressed: root.select(1)
Keys.onBacktabPressed: root.select(-1)
Keys.onDownPressed: root.select(1)
Keys.onUpPressed: root.select(-1)
Keys.onRightPressed: event => {
if (cursorPosition === text.length && root.results.length)
root.select(1);
else
event.accepted = false;
}
Keys.onLeftPressed: event => {
if (cursorPosition === text.length && root.selectedIndex > 0)
root.select(-1);
else
event.accepted = false;
}
Keys.onReturnPressed: root.activate(root.selectedIndex)
Keys.onEnterPressed: root.activate(root.selectedIndex)
}
Text {
anchors.verticalCenter: parent.verticalCenter
x: input.text === "" ? 0 : input.width + 8
width: Math.max(0, field.width - x)
elide: Text.ElideRight
font.pixelSize: 15
color: root.launchError ? Theme.urgent : Theme.textSecondary
text: root.launchError ? root.launchError : input.text === "" ? "Search apps" : root.selected ? "— " + root.selected.title : "No matches"
}
}
// Top matches; the highlighted one launches on Enter.
Row {
id: strip
anchors.right: modes.left
anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
spacing: 4
Repeater {
model: root.results
Rectangle {
id: tile
required property var modelData
required property int index
readonly property bool current: index === root.selectedIndex
width: 34
height: 34
radius: 10
color: current ? Qt.alpha(Theme.accent, 0.35) : tileArea.containsMouse ? Theme.hover : Theme.transparent
border.width: current ? 1 : 0
border.color: Qt.alpha(Theme.accent, 0.8)
Accessible.role: Accessible.Button
Accessible.name: modelData.title
Image {
id: tileIcon
anchors.centerIn: parent
width: 24
height: 24
source: tile.modelData.entry ? ApplicationsService.icon(tile.modelData.entry) : ""
sourceSize: Qt.size(48, 48)
asynchronous: true
smooth: true
mipmap: true
}
Text {
anchors.centerIn: parent
visible: tileIcon.status !== Image.Ready
text: tile.modelData.command ? (Icons.available ? "󰒓" : ">") : tile.modelData.title.charAt(0).toUpperCase()
font.family: Icons.available ? Icons.family : ""
font.pixelSize: 15
color: Theme.text
} }
MouseArea { MouseArea {
id: tileArea id: browseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: root.selectedIndex = tile.index onClicked: ShellState.launcherBrowse = true
onClicked: root.activate(tile.index)
} }
} }
TextField {
id: input
objectName: "notchSearchInput"
x: 60
y: (root.barHeight - height) / 2
width: pills.x - x - 18
height: 40
placeholderText: root.pillHover || "Search :3"
color: Theme.text
placeholderTextColor: Theme.textSecondary
selectByMouse: true
font.pixelSize: 22
font.weight: Font.Light
background: Item {}
padding: 0
maximumLength: 256
// Any text opens the launcher window with it.
onTextChanged: if (ShellState.notchLauncher && text !== ShellState.launcherQuery)
ShellState.launcherQuery = text
Keys.onEscapePressed: ShellState.launcherOpen = false
Keys.onDownPressed: ShellState.launcherBrowse = true
} }
} // Clipboard history and emoji, as in the launcher's bar.
// Clipboard history and emoji open the full launcher window.
Row { Row {
id: modes id: pills
anchors.right: parent.right x: root.width - width - 14
anchors.rightMargin: 12 y: (root.barHeight - root.pillSize) / 2
anchors.verticalCenter: parent.verticalCenter spacing: 6
spacing: 4
Repeater { Repeater {
model: [ model: [
{ {
mode: "clipboard", mode: "clipboard",
label: "Clipboard",
glyph: "󰅌", glyph: "󰅌",
fallback: "C", fallback: "⎘"
name: "Clipboard history"
}, },
{ {
mode: "emoji", mode: "emoji",
label: "Emoji",
glyph: "󰞅", glyph: "󰞅",
fallback: ":)", fallback: "☺"
name: "Emoji"
} }
] ]
Rectangle { GlassPanel {
id: mode id: pill
required property var modelData required property var modelData
width: 28 width: root.pillSize
height: 28 height: width
radius: 14 radius: width / 2
color: modeArea.containsMouse ? Theme.hover : Theme.fill color: pillArea.containsMouse ? Theme.hover : Theme.fill
border.width: 1
border.color: Theme.hairline border.color: Theme.hairline
plain: true
Accessible.role: Accessible.Button Accessible.role: Accessible.Button
Accessible.name: modelData.name Accessible.name: modelData.label
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: Icons.available ? mode.modelData.glyph : mode.modelData.fallback text: Icons.available ? pill.modelData.glyph : pill.modelData.fallback
font.family: Icons.available ? Icons.family : "" font.family: Icons.available ? Icons.family : ""
font.pixelSize: 14 font.pixelSize: 17
color: Theme.text color: Theme.text
} }
MouseArea { MouseArea {
id: modeArea id: pillArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: ShellState.openLauncher(mode.modelData.mode) onContainsMouseChanged: {
if (containsMouse)
root.pillHover = pill.modelData.label;
else if (root.pillHover === pill.modelData.label)
root.pillHover = "";
}
onClicked: ShellState.openLauncher(pill.modelData.mode)
} }
} }
} }
+6 -3
View File
@@ -26,12 +26,15 @@ Item {
if (latest) if (latest)
notice = latest; notice = latest;
} }
readonly property bool searching: ShellState.notchSearch && ScreenService.current(ShellState.launcherScreen) === barScreen && visible // Wide while the launcher is open here, also under the launcher window
// once a search grows it down.
readonly property bool searching: ShellState.notchLauncher && ScreenService.current(ShellState.launcherScreen) === barScreen
readonly property bool showing: !!latest && owner && visible && !searching readonly property bool showing: !!latest && owner && visible && !searching
// Holds the last banner while the notch closes around it. // Holds the last banner while the notch closes around it.
property var notice: null property var notice: null
readonly property int noticeWidth: 340 readonly property int noticeWidth: 340
readonly property int searchWidth: 520 // The launcher window's width, so it can take over at the same size.
readonly property int searchWidth: ConfigService.ready ? ConfigService.data.launcher.width : 680
readonly property real bodyWidth: ShellState.notchPillWidth + (searching ? searchWidth : showing ? noticeWidth : 0) readonly property real bodyWidth: ShellState.notchPillWidth + (searching ? searchWidth : showing ? noticeWidth : 0)
implicitWidth: bodyWidth + 2 * BarDrawers.ear implicitWidth: bodyWidth + 2 * BarDrawers.ear
implicitHeight: BarDrawers.bottom implicitHeight: BarDrawers.bottom
@@ -232,7 +235,7 @@ Item {
NotchSearch { NotchSearch {
width: root.searchWidth width: root.searchWidth
height: parent.height height: parent.height
active: root.searching active: root.searching && ShellState.notchSearch
} }
} }
// 0 (critical) stays until dismissed. Each banner's time counts from its // 0 (critical) stays until dismissed. Each banner's time counts from its