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
+151 -202

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;
// a click anywhere else closes it.
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 focus change, Hyprland clears it at once and the search closes.
property bool grabbing: false
+16 -3
View File
@@ -129,9 +129,22 @@ Singleton {
// "emoji" is the Emoji Picker.
// Changing it on an open launcher switches in place.
property string launcherMode: "apps"
// Notch mode searches apps in the notch pill itself, the way a notification
// widens it; clipboard history and emoji still open the launcher window.
readonly property bool notchSearch: notchMode && launcherOpen && launcherMode === "apps"
// Notch mode opens the launcher in the notch pill itself, the way a
// notification widens it. While the search is empty it stays there
// (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() {
return ScreenService.active;
}
+31 -12
View File
@@ -85,7 +85,10 @@ PanelWindow {
readonly property bool notch: ShellState.notchMode
// Notch mode searches apps inside the notch itself (NotchSearch); this
// 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
// panel does: solid shape throughout, width leading the height a little,
// contents fading in once it is mostly open and out first.
@@ -184,18 +187,33 @@ PanelWindow {
launchError = ApplicationsService.error;
}
// 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() {
if (!open)
return;
search.text = "";
browsing = false;
fromNotch = notch && ShellState.launcherMode === "apps";
search.text = fromNotch ? ShellState.launcherQuery : "";
browsing = fromNotch && ShellState.launcherBrowse;
launchError = "";
selectedIndex = 0;
ClipboardService.refresh();
if (emojiMode)
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() {
if (clipboardMode || emojiMode) {
ShellState.launcherMode = "apps";
@@ -217,11 +235,10 @@ PanelWindow {
}
Connections {
target: ShellState
function onLauncherOpenChanged() {
root.reset();
}
function onNotchSearchChanged() {
root.reset();
// Keys typed in the notch before this window has the keyboard.
function onLauncherQueryChanged() {
if (root.open && !search.activeFocus && search.text !== ShellState.launcherQuery)
search.text = ShellState.launcherQuery;
}
function onLauncherModeChanged() {
if (root.emojiMode)
@@ -357,7 +374,7 @@ PanelWindow {
width: 1
height: Math.round(BarDrawers.bottom * 0.5)
color: Theme.hairline
opacity: root.contentOpacity
opacity: root.compact ? 1 : root.contentOpacity
}
GlassPanel {
id: panel
@@ -365,13 +382,13 @@ PanelWindow {
x: Math.round((root.width - width) / 2)
y: root.notch ? 0 : Math.round(root.height * 0.22)
// 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
color: root.notch ? Theme.transparent : Qt.alpha(Theme.surface, surfaceOpacity)
border.width: root.notch ? 0 : 1
plain: root.notch
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
clip: true
Behavior on width {
@@ -464,6 +481,8 @@ PanelWindow {
padding: 0
maximumLength: 256
onTextEdited: root.launchError = ""
onTextChanged: if (root.sharing && text !== ShellState.launcherQuery)
ShellState.launcherQuery = text
Keys.onEscapePressed: {
if (text !== "")
clear();
+93 -183
View File
@@ -1,61 +1,37 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import "../components"
import "../core"
import "../services"
import "../theme"
// The launcher in notch mode: a search field and a row of top matches inside
// the widened notch, the way a notification shows there. Enter launches the
// highlighted match, Tab and the arrow keys move along the row, Escape clears
// and then closes. Clipboard history and emoji open the launcher window.
// The launcher's empty state in notch mode: its search bar inside the widened
// notch, laid out exactly like the launcher window's bar. The first keystroke
// (or the magnifying glass) hands over to the launcher window, which opens at
// this size and grows down with the results; clearing the search hands back.
Item {
id: root
property bool active: false
readonly property string query: input.text.trim()
readonly property bool commandMode: query.startsWith(">")
readonly property int maxShown: 6
readonly property var results: (commandMode ? commands.results : apps.results).slice(0, maxShown)
property int selectedIndex: 0
property string launchError: ""
readonly property var selected: results[selectedIndex] || null
onResultsChanged: selectedIndex = 0
// The launcher window's bar is this tall; rows centre on it.
readonly property int barHeight: 60
readonly property int pillSize: 36
property string pillHover: ""
onActiveChanged: {
input.text = "";
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)
if (!active)
return;
if (result.command) {
const command = CommandRegistry.commands.find(c => c.id === result.id);
if (!command || !command.stay)
ShellState.launcherOpen = false;
CommandRegistry.execute(result.id);
} else if (ApplicationsService.launch(result.entry, null))
ShellState.launcherOpen = false;
else
launchError = ApplicationsService.error;
if (input.text !== ShellState.launcherQuery)
input.text = ShellState.launcherQuery;
Qt.callLater(() => {
input.forceActiveFocus();
input.cursorPosition = input.text.length;
});
}
Connections {
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.
@@ -63,169 +39,103 @@ Item {
anchors.fill: parent
onClicked: input.forceActiveFocus()
}
Text {
id: glass
x: 14
anchors.verticalCenter: parent.verticalCenter
text: Icons.available ? "󰍉" : "⌕"
font.family: Icons.available ? Icons.family : ""
font.pixelSize: 17
color: Theme.textSecondary
}
// 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)
}
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 {
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"
anchors.centerIn: parent
text: Icons.available ? "󰍉" : "⌕"
font.family: Icons.available ? Icons.family : ""
color: Theme.textSecondary
font.pixelSize: 20
}
MouseArea {
id: browseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: ShellState.launcherBrowse = true
}
}
// 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 {
id: tileArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: root.selectedIndex = tile.index
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 open the full launcher window.
// Clipboard history and emoji, as in the launcher's bar.
Row {
id: modes
anchors.right: parent.right
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
spacing: 4
id: pills
x: root.width - width - 14
y: (root.barHeight - root.pillSize) / 2
spacing: 6
Repeater {
model: [
{
mode: "clipboard",
label: "Clipboard",
glyph: "󰅌",
fallback: "C",
name: "Clipboard history"
fallback: "⎘"
},
{
mode: "emoji",
label: "Emoji",
glyph: "󰞅",
fallback: ":)",
name: "Emoji"
fallback: "☺"
}
]
Rectangle {
id: mode
GlassPanel {
id: pill
required property var modelData
width: 28
height: 28
radius: 14
color: modeArea.containsMouse ? Theme.hover : Theme.fill
border.width: 1
width: root.pillSize
height: width
radius: width / 2
color: pillArea.containsMouse ? Theme.hover : Theme.fill
border.color: Theme.hairline
plain: true
Accessible.role: Accessible.Button
Accessible.name: modelData.name
Accessible.name: modelData.label
Text {
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.pixelSize: 14
font.pixelSize: 17
color: Theme.text
}
MouseArea {
id: modeArea
id: pillArea
anchors.fill: parent
hoverEnabled: true
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)
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
// Holds the last banner while the notch closes around it.
property var notice: null
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)
implicitWidth: bodyWidth + 2 * BarDrawers.ear
implicitHeight: BarDrawers.bottom
@@ -232,7 +235,7 @@ Item {
NotchSearch {
width: root.searchWidth
height: parent.height
active: root.searching
active: root.searching && ShellState.notchSearch
}
}
// 0 (critical) stays until dismissed. Each banner's time counts from its