diff --git a/.config/quickshell/modules/common/widgets/Favicon.qml b/.config/quickshell/modules/common/widgets/Favicon.qml index c7133b08..e3688100 100644 --- a/.config/quickshell/modules/common/widgets/Favicon.qml +++ b/.config/quickshell/modules/common/widgets/Favicon.qml @@ -15,14 +15,16 @@ import Quickshell.Hyprland IconImage { id: root property string url + property string displayText property real size: 32 property string downloadUserAgent: ConfigOptions?.networking.userAgent ?? "" property string faviconDownloadPath: FileUtils.trimFileProtocol(`${XdgDirectories.cache}/media/favicons`) - property string domainName: url.includes("vertexaisearch") ? displayText : StringUtils.getBaseUrl(url) + property string domainName: url.includes("vertexaisearch") ? displayText : StringUtils.getDomain(url) property string faviconUrl: `https://www.google.com/s2/favicons?domain=${domainName}&sz=32` property string fileName: `${domainName}.ico` property string faviconFilePath: `${faviconDownloadPath}/${fileName}` + property string urlToLoad Process { id: faviconDownloadProcess @@ -31,11 +33,13 @@ IconImage { onExited: (exitCode, exitStatus) => { console.log("Favicon download process exited with code:", exitCode, "and status:", exitStatus) console.log("Favicon file path:", faviconFilePath) - root.faviconUrl = root.faviconFilePath + root.urlToLoad = root.faviconFilePath } } Component.onCompleted: { + console.log("URL: ", root.url) + console.log("DOMAIN: ", root.domainName) console.log("faviconDownloadPath: ", faviconDownloadPath) console.log("faviconFilePath: ", faviconFilePath) console.log("faviconUrl: ", root.faviconUrl) @@ -45,7 +49,7 @@ IconImage { faviconDownloadProcess.running = true } - source: Qt.resolvedUrl(root.faviconUrl) + source: Qt.resolvedUrl(root.urlToLoad) implicitSize: root.size layer.enabled: true diff --git a/.config/quickshell/modules/overview/SearchItem.qml b/.config/quickshell/modules/overview/SearchItem.qml index eb1d7ed2..6f04165d 100644 --- a/.config/quickshell/modules/overview/SearchItem.qml +++ b/.config/quickshell/modules/overview/SearchItem.qml @@ -56,8 +56,16 @@ RippleButton { return result; } - property string displayContent: highlightContent(root.itemName, root.query) + + property list urls: { + if (!root.itemName) return []; + // Regular expression to match URLs + const urlRegex = /https?:\/\/[^\s<>"{}|\\^`[\]]+/gi; + const matches = root.itemName.match(urlRegex) + .filter(url => !url.includes("…")) // Elided = invalid + return matches ? matches : []; + } visible: root.entryShown property int horizontalMargin: 10 @@ -144,16 +152,26 @@ RippleButton { visible: root.itemType && root.itemType != qsTr("App") text: root.itemType } - StyledText { - Layout.fillWidth: true - id: nameText - textFormat: Text.StyledText // RichText also works, but StyledText ensures elide work - font.pixelSize: Appearance.font.pixelSize.small - font.family: Appearance.font.family[root.fontType] - color: Appearance.m3colors.m3onSurface - horizontalAlignment: Text.AlignLeft - elide: Text.ElideRight - text: `${root.displayContent}` + RowLayout { + Repeater { + model: root.query == root.itemName ? [] : root.urls + Favicon { + required property var modelData + size: parent.height + url: modelData + } + } + StyledText { + Layout.fillWidth: true + id: nameText + textFormat: Text.StyledText // RichText also works, but StyledText ensures elide work + font.pixelSize: Appearance.font.pixelSize.small + font.family: Appearance.font.family[root.fontType] + color: Appearance.m3colors.m3onSurface + horizontalAlignment: Text.AlignLeft + elide: Text.ElideRight + text: `${root.displayContent}` + } } }