The launcher's contents (search, results, app grid, commands, clipboard history and emoji) move into LauncherView, which the launcher window hosts normally and the notch hosts in notch mode. In the notch it is one more face of the same shape: the search sits in the band beside the clock, sized to the band so it never clips, and the notch springs wider and then down to fit whatever is below (springs as on pocket-dots, scaled by the notch speed settings). The bar window grows tall only while it is open, with input still masked to the shapes. The separate window, the hand-over between them and the compact search are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
619 lines
26 KiB
QML
619 lines
26 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import "../components"
|
|
import "../services"
|
|
import "../theme"
|
|
import "../core"
|
|
|
|
// Everything the launcher shows and does, without a window: the search bar,
|
|
// ranked results, the application grid (magnifying glass, or ↓ in an empty
|
|
// bar), commands (>), Clipboard History and the Emoji Picker. The launcher
|
|
// window hosts it normally; in notch mode the notch hosts it, so every mode
|
|
// lives in the one launcher either way.
|
|
//
|
|
// The host sizes it: width is the launcher's width, and the host gives it
|
|
// barHeight + bodyHeight of height. maxBodyHeight caps the body.
|
|
Item {
|
|
id: root
|
|
// Whether the launcher is showing here; it resets each time it opens.
|
|
property bool active: false
|
|
// Notch layout: a shorter bar in the notch's band, with room on the left
|
|
// (barInset) for the notch's clock, and the mode pills inside the bar.
|
|
property bool notch: false
|
|
property real band: 60
|
|
property real barInset: 0
|
|
property real maxBodyHeight: 460
|
|
|
|
readonly property var options: ConfigService.ready ? ConfigService.data.launcher : ({
|
|
width: 680,
|
|
maxResults: 50,
|
|
showDescriptions: true
|
|
})
|
|
readonly property string query: search.text.trim()
|
|
readonly property bool clipboardMode: ShellState.launcherMode === "clipboard"
|
|
readonly property bool emojiMode: ShellState.launcherMode === "emoji"
|
|
readonly property bool commandMode: !clipboardMode && !emojiMode && query.startsWith(">")
|
|
property bool browsing: false
|
|
readonly property bool showList: clipboardMode || !emojiMode && query !== ""
|
|
readonly property bool showGrid: !showList && !emojiMode && browsing
|
|
// Arrow keys move through whichever grid is showing.
|
|
readonly property int columns: emojiMode ? emojiColumns : showGrid ? gridColumns : 1
|
|
readonly property var allApps: ApplicationsService.launchable.map(entry => ({
|
|
id: entry.id,
|
|
title: entry.name,
|
|
description: entry.genericName || entry.comment || entry.id,
|
|
entry: entry
|
|
}))
|
|
readonly property var clipboardResults: clipboardMode && active ? ClipboardService.filter(query).map(e => ({
|
|
id: e.id,
|
|
title: e.text.replace(/\s+/g, " ").trim(),
|
|
description: "",
|
|
clip: e
|
|
})) : []
|
|
readonly property var emojiResults: emojiMode && active ? EmojiService.filter(query).map(e => ({
|
|
id: e.emoji,
|
|
title: e.name,
|
|
description: "",
|
|
glyph: e
|
|
})) : []
|
|
readonly property var results: clipboardMode ? clipboardResults : emojiMode ? emojiResults : showList ? (commandMode ? commands.results : apps.results) : showGrid ? allApps : []
|
|
property int selectedIndex: 0
|
|
property string launchError: ""
|
|
// A hovered mode pill names itself in the empty search bar.
|
|
property string pillHover: ""
|
|
|
|
readonly property real barHeight: notch ? band : 60
|
|
// Controls in the bar scale down to fit a short notch band.
|
|
readonly property real buttonSize: notch ? Math.min(34, band - 8) : 38
|
|
readonly property real pillSize: notch ? Math.min(32, band - 10) : 36
|
|
readonly property int fontSize: notch ? Math.max(13, Math.min(20, Math.round(band * 0.45))) : 22
|
|
// Clipboard mode shows the latest five rows; the rest scroll.
|
|
readonly property real clipboardRows: 5 * 48 - 2
|
|
// Emoji mode shows six rows of the grid; the rest scroll.
|
|
readonly property int emojiCell: 52
|
|
readonly property int emojiColumns: Math.max(1, Math.floor((width - 24) / emojiCell))
|
|
readonly property real emojiRows: 6 * emojiCell
|
|
readonly property int gridColumns: Math.max(1, Math.floor((width - 24) / 112))
|
|
readonly property real bodyHeight: emojiMode ? Math.min(maxBodyHeight, Math.max(84, Math.min(emojiGrid.contentHeight, emojiRows) + 42)) : showList ? Math.min(maxBodyHeight, Math.max(84, (clipboardMode ? Math.min(list.contentHeight, clipboardRows) : list.contentHeight) + 46 + (launchError ? 22 : 0))) : showGrid ? Math.min(maxBodyHeight, grid.contentHeight + 46) : 0
|
|
// Mode switches resize without animating, so >clipboard lands in place.
|
|
property bool snapping: false
|
|
Timer {
|
|
id: unsnap
|
|
interval: 120
|
|
onTriggered: root.snapping = false
|
|
}
|
|
onResultsChanged: {
|
|
selectedIndex = 0;
|
|
list.contentY = 0;
|
|
grid.contentY = 0;
|
|
emojiGrid.contentY = 0;
|
|
emojiGrid.hovered = "";
|
|
}
|
|
onActiveChanged: reset()
|
|
function select(offset) {
|
|
if (!results.length)
|
|
return;
|
|
selectedIndex = Math.max(0, Math.min(results.length - 1, selectedIndex + offset));
|
|
if (emojiMode)
|
|
emojiGrid.positionViewAtIndex(selectedIndex, GridView.Contain);
|
|
else if (showGrid)
|
|
grid.positionViewAtIndex(selectedIndex, GridView.Contain);
|
|
else
|
|
list.positionViewAtIndex(selectedIndex, ListView.Contain);
|
|
}
|
|
function activate(index) {
|
|
const result = results[index];
|
|
if (!result)
|
|
return;
|
|
if (result.clip) {
|
|
ClipboardService.copy(result.clip);
|
|
ShellState.launcherOpen = false;
|
|
} else if (result.glyph) {
|
|
EmojiService.copy(result.glyph);
|
|
ShellState.launcherOpen = false;
|
|
} else 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;
|
|
}
|
|
// Fresh state each time it opens.
|
|
function reset() {
|
|
if (!active)
|
|
return;
|
|
search.text = "";
|
|
browsing = false;
|
|
launchError = "";
|
|
selectedIndex = 0;
|
|
ClipboardService.refresh();
|
|
if (emojiMode)
|
|
EmojiService.load();
|
|
Qt.callLater(() => search.forceActiveFocus());
|
|
}
|
|
function focusSearch() {
|
|
search.forceActiveFocus();
|
|
}
|
|
function toggleBrowse() {
|
|
if (clipboardMode || emojiMode) {
|
|
ShellState.launcherMode = "apps";
|
|
return;
|
|
}
|
|
browsing = !browsing;
|
|
if (browsing)
|
|
search.clear();
|
|
selectedIndex = 0;
|
|
search.forceActiveFocus();
|
|
}
|
|
// A mode pill: toggles its mode; the active one is filled.
|
|
function toggleMode(mode) {
|
|
ShellState.launcherMode = ShellState.launcherMode === mode ? "apps" : mode;
|
|
search.forceActiveFocus();
|
|
}
|
|
readonly property var modes: [
|
|
{
|
|
mode: "clipboard",
|
|
label: "Clipboard",
|
|
glyph: "",
|
|
fallback: "⎘"
|
|
},
|
|
{
|
|
mode: "emoji",
|
|
label: "Emoji",
|
|
glyph: "",
|
|
fallback: "☺"
|
|
}
|
|
]
|
|
Connections {
|
|
target: ShellState
|
|
function onLauncherModeChanged() {
|
|
if (root.emojiMode)
|
|
EmojiService.load();
|
|
if (!root.active)
|
|
return;
|
|
root.snapping = true;
|
|
unsnap.restart();
|
|
search.text = "";
|
|
root.browsing = false;
|
|
root.launchError = "";
|
|
root.selectedIndex = 0;
|
|
search.forceActiveFocus();
|
|
}
|
|
}
|
|
AppSearch {
|
|
id: apps
|
|
enabled: root.active && root.showList && !root.commandMode
|
|
query: search.text
|
|
limit: root.options.maxResults
|
|
}
|
|
CommandSearch {
|
|
id: commands
|
|
enabled: root.active && root.commandMode
|
|
query: search.text
|
|
limit: root.options.maxResults
|
|
}
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
} // Consume inside clicks without dismissing.
|
|
|
|
// Search bar
|
|
RowLayout {
|
|
id: bar
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.top: parent.top
|
|
height: root.barHeight
|
|
anchors.leftMargin: root.barInset + 12
|
|
anchors.rightMargin: root.notch ? 14 : 18
|
|
spacing: 10
|
|
Rectangle {
|
|
objectName: "launcherBrowse"
|
|
Layout.preferredWidth: root.buttonSize
|
|
Layout.preferredHeight: root.buttonSize
|
|
radius: root.buttonSize * 0.32
|
|
color: root.browsing ? Theme.accent : browseArea.containsMouse ? Theme.hover : Theme.transparent
|
|
Accessible.role: Accessible.Button
|
|
Accessible.name: root.clipboardMode || root.emojiMode ? "Back to search" : root.browsing ? "Hide applications" : "Show all applications"
|
|
Behavior on color {
|
|
ColorAnimation {
|
|
duration: Theme.duration / 2
|
|
}
|
|
}
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: root.commandMode ? ">" : !Icons.available ? (root.clipboardMode ? "⎘" : root.emojiMode ? "☺" : "⌕") : root.clipboardMode ? "" : root.emojiMode ? "" : ""
|
|
font.family: Icons.available && !root.commandMode ? Icons.family : ""
|
|
color: root.browsing ? Theme.accentText : Theme.textSecondary
|
|
font.pixelSize: Math.round(root.buttonSize * 0.53)
|
|
}
|
|
MouseArea {
|
|
id: browseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: root.toggleBrowse()
|
|
}
|
|
GlassToolTip {
|
|
visible: browseArea.containsMouse
|
|
delay: 600
|
|
text: root.clipboardMode || root.emojiMode ? "Back to search" : root.browsing ? "Hide applications" : "All applications"
|
|
}
|
|
}
|
|
TextField {
|
|
id: search
|
|
objectName: "launcherSearch"
|
|
Layout.fillWidth: true
|
|
Layout.preferredHeight: Math.min(40, root.barHeight - 4)
|
|
placeholderText: root.pillHover || (root.clipboardMode ? "Clipboard History" : root.emojiMode ? "Search emoji" : root.browsing ? "Search applications" : "Search :3")
|
|
color: Theme.text
|
|
placeholderTextColor: Theme.textSecondary
|
|
selectByMouse: true
|
|
font.pixelSize: root.fontSize
|
|
font.weight: Font.Light
|
|
background: Item {}
|
|
padding: 0
|
|
verticalAlignment: TextInput.AlignVCenter
|
|
maximumLength: 256
|
|
onTextEdited: root.launchError = ""
|
|
Keys.onEscapePressed: {
|
|
if (text !== "")
|
|
clear();
|
|
else if (root.browsing)
|
|
root.browsing = false;
|
|
else
|
|
ShellState.launcherOpen = false;
|
|
}
|
|
Keys.onDownPressed: {
|
|
if (!root.showList && !root.browsing && !root.emojiMode)
|
|
root.browsing = true;
|
|
else
|
|
root.select(root.columns);
|
|
}
|
|
Keys.onUpPressed: root.select(-root.columns)
|
|
Keys.onRightPressed: event => {
|
|
if (root.columns > 1 || event.modifiers & Qt.ControlModifier)
|
|
root.select(1);
|
|
else
|
|
event.accepted = false;
|
|
}
|
|
Keys.onLeftPressed: event => {
|
|
if (root.columns > 1 || event.modifiers & Qt.ControlModifier)
|
|
root.select(-1);
|
|
else
|
|
event.accepted = false;
|
|
}
|
|
// Shift+Delete removes the selected clipboard entry from history.
|
|
Keys.onDeletePressed: event => {
|
|
if (root.clipboardMode && event.modifiers & Qt.ShiftModifier && root.results[root.selectedIndex])
|
|
ClipboardService.remove(root.results[root.selectedIndex].clip);
|
|
else
|
|
event.accepted = false;
|
|
}
|
|
Keys.onTabPressed: root.select(1)
|
|
Keys.onBacktabPressed: root.select(-1)
|
|
Keys.onReturnPressed: root.activate(root.selectedIndex)
|
|
Keys.onEnterPressed: root.activate(root.selectedIndex)
|
|
}
|
|
// In the notch the mode pills sit in the bar; the window puts its own
|
|
// beside the panel.
|
|
Row {
|
|
id: pills
|
|
objectName: "launcherPills"
|
|
visible: root.notch
|
|
spacing: 6
|
|
Repeater {
|
|
model: root.notch ? root.modes : []
|
|
GlassPanel {
|
|
id: pill
|
|
required property var modelData
|
|
readonly property bool active: ShellState.launcherMode === modelData.mode
|
|
objectName: "launcherPill-" + modelData.mode
|
|
width: root.pillSize
|
|
height: width
|
|
radius: width / 2
|
|
color: active ? Theme.accent : pillArea.containsMouse ? Theme.hover : Theme.fill
|
|
border.color: Theme.hairline
|
|
plain: true
|
|
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: Math.round(root.pillSize * 0.47)
|
|
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: root.toggleMode(pill.modelData.mode)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Results (typing) or the application grid (magnifying glass).
|
|
Item {
|
|
id: body
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.top: bar.bottom
|
|
anchors.bottom: parent.bottom
|
|
visible: root.bodyHeight > 0 || root.height > root.barHeight + 1
|
|
Rectangle {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.leftMargin: 14
|
|
anchors.rightMargin: 14
|
|
height: 1
|
|
color: root.notch ? Theme.hairline : Theme.border
|
|
}
|
|
Text {
|
|
id: section
|
|
x: 22
|
|
y: 12
|
|
text: root.emojiMode ? (emojiGrid.hovered || (root.results[root.selectedIndex] || {}).title || "") : root.clipboardMode ? (!root.results.length ? "" : root.query ? "Matches" : "Recent") : root.showGrid ? "Applications" : root.commandMode ? "Settings" : root.results.length ? "Top hits" : ""
|
|
color: Theme.textSecondary
|
|
font.pixelSize: 11
|
|
font.weight: Font.DemiBold
|
|
}
|
|
ListView {
|
|
id: list
|
|
objectName: "launcherResults"
|
|
visible: root.showList
|
|
anchors.fill: parent
|
|
anchors.topMargin: 32
|
|
anchors.leftMargin: 8
|
|
anchors.rightMargin: 8
|
|
anchors.bottomMargin: root.launchError ? 30 : 8
|
|
clip: true
|
|
model: root.showList ? root.results : []
|
|
spacing: 2
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
ScrollBar.vertical: ScrollBar {}
|
|
delegate: Rectangle {
|
|
id: resultRow
|
|
required property var modelData
|
|
required property int index
|
|
readonly property bool selected: root.selectedIndex === index
|
|
width: list.width
|
|
height: 46
|
|
radius: 10
|
|
color: selected ? Theme.accent : mouse.containsMouse ? Theme.hover : Theme.transparent
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: 10
|
|
anchors.rightMargin: 12
|
|
spacing: 12
|
|
Item {
|
|
readonly property var copied: resultRow.modelData.clip
|
|
// Copied images get a wider thumbnail slot.
|
|
Layout.preferredWidth: copied && copied.thumb ? 52 : 30
|
|
Layout.preferredHeight: 30
|
|
Image {
|
|
id: icon
|
|
anchors.fill: parent
|
|
source: parent.copied ? (parent.copied.thumb ? "file://" + parent.copied.thumb : "") : resultRow.modelData.entry ? ApplicationsService.icon(resultRow.modelData.entry) : ""
|
|
sourceSize: parent.copied ? Qt.size(104, 60) : Qt.size(60, 60)
|
|
fillMode: Image.PreserveAspectFit
|
|
asynchronous: !!parent.copied
|
|
}
|
|
Text {
|
|
anchors.centerIn: parent
|
|
visible: icon.source.toString() === "" || icon.status === Image.Error
|
|
text: parent.copied ? (Icons.available ? (parent.copied.image ? "" : "") : "¶") : resultRow.modelData.command ? "⚙" : resultRow.modelData.title.slice(0, 2).toUpperCase()
|
|
font.family: parent.copied && Icons.available ? Icons.family : ""
|
|
color: resultRow.selected ? Theme.accentText : Theme.textSecondary
|
|
font.pixelSize: parent.copied ? 18 : 16
|
|
}
|
|
}
|
|
Text {
|
|
text: resultRow.modelData.title
|
|
// Clipboard text is shown as is, never as markup.
|
|
textFormat: Text.PlainText
|
|
Layout.fillWidth: !!resultRow.modelData.clip
|
|
elide: Text.ElideRight
|
|
color: resultRow.selected ? Theme.accentText : Theme.text
|
|
font.pixelSize: 14
|
|
font.weight: Font.Medium
|
|
}
|
|
Text {
|
|
visible: root.options.showDescriptions && !resultRow.modelData.clip
|
|
text: "— " + resultRow.modelData.description
|
|
Layout.fillWidth: true
|
|
elide: Text.ElideRight
|
|
color: resultRow.selected ? Qt.alpha(Theme.accentText, 0.75) : Theme.textSecondary
|
|
font.pixelSize: 12
|
|
}
|
|
Item {
|
|
visible: !root.options.showDescriptions && !resultRow.modelData.clip
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
text: resultRow.modelData.clip ? (resultRow.modelData.clip.image ? "Image" : "Text") : resultRow.modelData.command ? resultRow.modelData.kind : "Application"
|
|
color: resultRow.selected ? Qt.alpha(Theme.accentText, 0.75) : Theme.textSecondary
|
|
font.pixelSize: 11
|
|
}
|
|
}
|
|
MouseArea {
|
|
id: mouse
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
// Hover highlights locally; only keys change keyboard selection.
|
|
// Layout/scroll movement under a stationary pointer must not steal it.
|
|
onClicked: root.activate(resultRow.index)
|
|
}
|
|
Accessible.role: Accessible.Button
|
|
Accessible.name: modelData.title
|
|
Accessible.onPressAction: root.activate(index)
|
|
}
|
|
}
|
|
GridView {
|
|
id: grid
|
|
objectName: "launcherApps"
|
|
visible: root.showGrid
|
|
anchors.fill: parent
|
|
anchors.topMargin: 32
|
|
anchors.leftMargin: 12
|
|
anchors.rightMargin: 12
|
|
anchors.bottomMargin: 10
|
|
clip: true
|
|
model: root.showGrid ? root.results : []
|
|
cellWidth: Math.floor(width / root.gridColumns)
|
|
cellHeight: 100
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
ScrollBar.vertical: ScrollBar {}
|
|
delegate: Item {
|
|
id: tile
|
|
required property var modelData
|
|
required property int index
|
|
readonly property bool selected: root.selectedIndex === index
|
|
width: grid.cellWidth
|
|
height: grid.cellHeight
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
anchors.margins: 4
|
|
radius: 14
|
|
color: tile.selected ? Qt.alpha(Theme.accent, 0.35) : tileArea.containsMouse ? Theme.hover : Theme.transparent
|
|
border.width: tile.selected ? 1 : 0
|
|
border.color: Theme.accentVivid
|
|
}
|
|
Column {
|
|
anchors.centerIn: parent
|
|
spacing: 6
|
|
Image {
|
|
id: tileIcon
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
width: 52
|
|
height: 52
|
|
source: ApplicationsService.icon(tile.modelData.entry)
|
|
sourceSize: Qt.size(104, 104)
|
|
fillMode: Image.PreserveAspectFit
|
|
asynchronous: true
|
|
Text {
|
|
anchors.centerIn: parent
|
|
visible: tileIcon.source.toString() === "" || tileIcon.status === Image.Error
|
|
text: tile.modelData.title.slice(0, 2).toUpperCase()
|
|
color: Theme.textSecondary
|
|
font.pixelSize: 18
|
|
}
|
|
}
|
|
Text {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
width: grid.cellWidth - 12
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: tile.modelData.title
|
|
elide: Text.ElideRight
|
|
color: Theme.text
|
|
font.pixelSize: 11
|
|
}
|
|
}
|
|
MouseArea {
|
|
id: tileArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
onClicked: root.activate(tile.index)
|
|
}
|
|
Accessible.role: Accessible.Button
|
|
Accessible.name: modelData.title
|
|
Accessible.onPressAction: root.activate(index)
|
|
}
|
|
}
|
|
GridView {
|
|
id: emojiGrid
|
|
objectName: "launcherEmoji"
|
|
// Name of the emoji under the pointer, shown instead of the selection's.
|
|
property string hovered: ""
|
|
visible: root.emojiMode
|
|
anchors.fill: parent
|
|
anchors.topMargin: 32
|
|
anchors.leftMargin: 12
|
|
anchors.rightMargin: 12
|
|
anchors.bottomMargin: 10
|
|
clip: true
|
|
model: root.emojiMode ? root.results : []
|
|
cellWidth: Math.floor(width / root.emojiColumns)
|
|
cellHeight: root.emojiCell
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
ScrollBar.vertical: ScrollBar {}
|
|
delegate: Item {
|
|
id: glyph
|
|
required property var modelData
|
|
required property int index
|
|
readonly property bool selected: root.selectedIndex === index
|
|
width: emojiGrid.cellWidth
|
|
height: emojiGrid.cellHeight
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
anchors.margins: 3
|
|
radius: 12
|
|
color: glyph.selected ? Qt.alpha(Theme.accent, 0.35) : glyphArea.containsMouse ? Theme.hover : Theme.transparent
|
|
border.width: glyph.selected ? 1 : 0
|
|
border.color: Theme.accentVivid
|
|
}
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: glyph.modelData.id
|
|
textFormat: Text.PlainText
|
|
font.pixelSize: 28
|
|
}
|
|
MouseArea {
|
|
id: glyphArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
onContainsMouseChanged: {
|
|
if (containsMouse)
|
|
emojiGrid.hovered = glyph.modelData.title;
|
|
else if (emojiGrid.hovered === glyph.modelData.title)
|
|
emojiGrid.hovered = "";
|
|
}
|
|
onClicked: root.activate(glyph.index)
|
|
}
|
|
Accessible.role: Accessible.Button
|
|
Accessible.name: modelData.title
|
|
Accessible.onPressAction: root.activate(index)
|
|
}
|
|
}
|
|
Text {
|
|
anchors.centerIn: parent
|
|
anchors.verticalCenterOffset: 12
|
|
visible: (root.showList || root.emojiMode) && root.results.length === 0
|
|
text: root.emojiMode ? (EmojiService.loaded ? "No matching emoji" : "Loading…") : root.clipboardMode ? (ClipboardService.error || (root.query ? "No matches" : ClipboardService.loaded ? "Clipboard history is empty" : "Loading…")) : root.commandMode ? "No matching settings" : "No results"
|
|
color: Theme.textSecondary
|
|
font.pixelSize: 13
|
|
}
|
|
Text {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.bottom: parent.bottom
|
|
anchors.margins: 12
|
|
visible: !!root.launchError
|
|
elide: Text.ElideRight
|
|
text: root.launchError
|
|
color: Theme.urgent
|
|
font.pixelSize: 12
|
|
}
|
|
}
|
|
}
|