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:
1 parent
1f029922ec
commit
415b1b3cd6
5 files changed
+151
-202
No files matched your search
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user