Add Clipboard and Emoji pills beside the launcher bar

Round glass pills to the right of the search bar switch the launcher to
Clipboard History or the Emoji picker and back, naming themselves in the
empty bar on hover. The launcher runtime test now runs without a second
notification server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-10-17 22:13:48 +02:00
1 parent 7f1189606c
commit 9e1ac4efe7
3 files changed
+95 -3

No files matched your search

+76 -2
View File
@@ -69,7 +69,12 @@ PanelWindow {
readonly property var results: clipboardMode ? clipboardResults : emojiMode ? emojiResults : showList ? (commandMode ? commands.results : apps.results) : showGrid ? allApps : [] readonly property var results: clipboardMode ? clipboardResults : emojiMode ? emojiResults : showList ? (commandMode ? commands.results : apps.results) : showGrid ? allApps : []
property int selectedIndex: 0 property int selectedIndex: 0
property string launchError: "" property string launchError: ""
readonly property real targetWidth: Math.min(options.width, root.width - 40) // Room is kept for the mode pills on the right of the bar.
readonly property int pillSize: 48
readonly property real pillsWidth: 2 * pillSize + 2 * 10
readonly property real targetWidth: Math.min(options.width, root.width - 40 - 2 * pillsWidth)
// A hovered mode pill names itself in the empty search bar.
property string pillHover: ""
readonly property int barHeight: 60 readonly property int barHeight: 60
readonly property real maxBodyHeight: Math.min(460, root.height * 0.78 - barHeight - (root.height * 0.22)) readonly property real maxBodyHeight: Math.min(460, root.height * 0.78 - barHeight - (root.height * 0.22))
// Clipboard mode shows the latest five rows; the rest scroll. // Clipboard mode shows the latest five rows; the rest scroll.
@@ -182,6 +187,75 @@ PanelWindow {
anchors.fill: parent anchors.fill: parent
onClicked: ShellState.launcherOpen = false onClicked: ShellState.launcherOpen = false
} }
// Mode pills beside the search bar (macOS Spotlight style): each toggles
// its launcher mode; the active one is filled.
Row {
id: pills
objectName: "launcherPills"
x: panel.x + panel.width + 10
y: panel.y + (root.barHeight - root.pillSize) / 2
spacing: 10
opacity: panel.opacity
scale: panel.scale
Repeater {
model: [
{
mode: "clipboard",
label: "Clipboard",
glyph: "󰅌",
fallback: "⎘"
},
{
mode: "emoji",
label: "Emoji",
glyph: "󰞅",
fallback: "☺"
}
]
GlassPanel {
id: pill
required property var modelData
readonly property bool active: ShellState.launcherMode === modelData.mode
objectName: "launcherPill-" + modelData.mode
width: root.pillSize
height: root.pillSize
radius: width / 2
color: active ? Theme.accent : Qt.alpha(Theme.surface, Math.min(1, surfaceOpacity + (pillArea.containsMouse ? 0.18 : 0)))
Accessible.role: Accessible.Button
Accessible.name: modelData.label
scale: pillArea.pressed ? 0.92 : 1
Behavior on scale {
NumberAnimation {
duration: Theme.duration / 2
easing.type: Easing.OutCubic
}
}
Text {
anchors.centerIn: parent
text: Icons.available ? pill.modelData.glyph : pill.modelData.fallback
font.family: Icons.available ? Icons.family : ""
font.pixelSize: 21
color: pill.active ? Theme.accentText : Theme.text
}
MouseArea {
id: pillArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onContainsMouseChanged: {
if (containsMouse)
root.pillHover = pill.modelData.label;
else if (root.pillHover === pill.modelData.label)
root.pillHover = "";
}
onClicked: {
ShellState.launcherMode = pill.active ? "apps" : pill.modelData.mode;
search.forceActiveFocus();
}
}
}
}
}
GlassPanel { GlassPanel {
id: panel id: panel
objectName: "launcherSurface" objectName: "launcherSurface"
@@ -269,7 +343,7 @@ PanelWindow {
objectName: "launcherSearch" objectName: "launcherSearch"
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 40 Layout.preferredHeight: 40
placeholderText: root.clipboardMode ? "Clipboard History" : root.emojiMode ? "Search emoji" : root.browsing ? "Search applications" : "Search :3" placeholderText: root.pillHover || (root.clipboardMode ? "Clipboard History" : root.emojiMode ? "Search emoji" : root.browsing ? "Search applications" : "Search :3")
color: Theme.text color: Theme.text
placeholderTextColor: Theme.textSecondary placeholderTextColor: Theme.textSecondary
selectByMouse: true selectByMouse: true
+10
View File
@@ -92,9 +92,19 @@ Item {
function browse(): void { function browse(): void {
LauncherState.window.toggleBrowse(); LauncherState.window.toggleBrowse();
} }
function pill(mode: string): bool {
const item = input.findChild(LauncherState.window.contentItem, "launcherPill-" + mode);
if (!item || !item.visible)
return false;
input.mouseClick(item, item.width / 2, item.height / 2);
return true;
}
function screenshot(path: string): bool { function screenshot(path: string): bool {
return input.findChild(LauncherState.window.contentItem, "launcherSurface").grabToImage(result => result.saveToFile(path)); return input.findChild(LauncherState.window.contentItem, "launcherSurface").grabToImage(result => result.saveToFile(path));
} }
function pillsShot(path: string): bool {
return input.findChild(LauncherState.window.contentItem, "launcherPills").grabToImage(result => result.saveToFile(path));
}
function extension(add: bool): bool { function extension(add: bool): bool {
if (!add) { if (!add) {
CommandRegistry.unregisterCommand("fixture"); CommandRegistry.unregisterCommand("fixture");
+9 -1
View File
@@ -61,7 +61,8 @@ Terminal={'true' if suffix=='Terminal' else 'false'}
''') ''')
cfg=temp/'config/glassMxrph/config.json';cfg.parent.mkdir(parents=True) cfg=temp/'config/glassMxrph/config.json';cfg.parent.mkdir(parents=True)
# Hermetic: never scan the user's wallpaper folders (and their image formats). # Hermetic: never scan the user's wallpaper folders (and their image formats).
cfg.write_text(json.dumps({'schemaVersion':3,'dock':{'enabled':False},'wallpaper':{'directories':[str(temp)]}})) # The user's live shell owns the notification bus name; a second server would warn.
cfg.write_text(json.dumps({'schemaVersion':3,'dock':{'enabled':False},'notifications':{'enabled':False},'wallpaper':{'directories':[str(temp)]}}))
env=dict(os.environ,XDG_CONFIG_HOME=tmp+'/config',XDG_STATE_HOME=tmp+'/state',XDG_DATA_HOME=tmp+'/data',GLASSMXRPH_LAUNCHER_TESTING='1',QT_QPA_PLATFORMTHEME='',QT_NO_XDG_DESKTOP_PORTAL='1') env=dict(os.environ,XDG_CONFIG_HOME=tmp+'/config',XDG_STATE_HOME=tmp+'/state',XDG_DATA_HOME=tmp+'/data',GLASSMXRPH_LAUNCHER_TESTING='1',QT_QPA_PLATFORMTHEME='',QT_NO_XDG_DESKTOP_PORTAL='1')
shell=None shell=None
try: try:
@@ -114,6 +115,13 @@ Terminal={'true' if suffix=='Terminal' else 'false'}
open_launcher();query('>') open_launcher();query('>')
eventually(lambda:{r['id'] for r in snapshot()['results']}=={'about','appearance','audio','bar','tray','bluetooth','controlcenter','display','dock','launcher','media','metrics','network','notifications','power','wallpaper','widgets','osd','lock','dashboard','plugins','clipboard','emoji'},'all commands registered') eventually(lambda:{r['id'] for r in snapshot()['results']}=={'about','appearance','audio','bar','tray','bluetooth','controlcenter','display','dock','launcher','media','metrics','network','notifications','power','wallpaper','widgets','osd','lock','dashboard','plugins','clipboard','emoji'},'all commands registered')
time.sleep(.3);assert ipc('launcherTest','screenshot',str(ROOT/'.cache/launcher-preview.png')) time.sleep(.3);assert ipc('launcherTest','screenshot',str(ROOT/'.cache/launcher-preview.png'))
# Mode pills beside the bar switch to clipboard or emoji and back.
assert ipc('launcherTest','pill','clipboard');eventually(lambda:snapshot()['mode']=='clipboard','clipboard pill')
assert ipc('launcherTest','pill','clipboard');eventually(lambda:snapshot()['mode']=='apps','clipboard pill toggles back')
assert ipc('launcherTest','pill','emoji');eventually(lambda:snapshot()['mode']=='emoji' and snapshot()['opened'],'emoji pill')
time.sleep(.4);assert ipc('launcherTest','screenshot',str(ROOT/'.cache/launcher-emoji.png'));assert ipc('launcherTest','pillsShot',str(ROOT/'.cache/launcher-pills.png'))
assert ipc('launcherTest','pill','emoji');eventually(lambda:snapshot()['mode']=='apps','emoji pill toggles back')
query('>')
for text,page in [('>metrics','metrics'),('>dock','dock'),('>media','media'),('>tray','tray'),('>display','displays'),('>launcher','launcher'),('>appearance','appearance'),('>bar','bar'),('>network','network'),('>bluetooth','bluetooth'),('>audio','audio'),('>controlcenter','controlcenter'),('>notifications','notifications'),('>power','power'),('>about','about')]: for text,page in [('>metrics','metrics'),('>dock','dock'),('>media','media'),('>tray','tray'),('>display','displays'),('>launcher','launcher'),('>appearance','appearance'),('>bar','bar'),('>network','network'),('>bluetooth','bluetooth'),('>audio','audio'),('>controlcenter','controlcenter'),('>notifications','notifications'),('>power','power'),('>about','about')]:
query(text) query(text)
ipc('launcherTest','key',ENTER) ipc('launcherTest','key',ENTER)