From 08297376a85a1719518507e54fca9de954d2376a Mon Sep 17 00:00:00 2001 From: Petri Hienonen Date: Thu, 23 May 2024 13:56:00 +0300 Subject: Agenix configuration --- home/quickshell/bar/BarText.qml | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 home/quickshell/bar/BarText.qml (limited to 'home/quickshell/bar/BarText.qml') diff --git a/home/quickshell/bar/BarText.qml b/home/quickshell/bar/BarText.qml new file mode 100644 index 0000000..4cf42cc --- /dev/null +++ b/home/quickshell/bar/BarText.qml @@ -0,0 +1,57 @@ +import Quickshell +import Quickshell.Io +import Quickshell.Widgets +import QtQuick +import QtQuick.Layouts +import QtQuick.Effects +import Qt5Compat.GraphicalEffects + +Text { + property string mainFont: "FiraCode" + property string symbolFont: "Symbols Nerd Font Mono" + property int pointSize: 12 + property int symbolSize: pointSize * 1.4 + property string symbolText + property bool dim + text: wrapSymbols(symbolText) + anchors.centerIn: parent + color: dim ? "#CCCCCC" : "white" + textFormat: Text.RichText + font { + family: mainFont + pointSize: pointSize + } + + Text { + visible: false + id: textcopy + text: parent.text + textFormat: parent.textFormat + color: parent.color + font: parent.font + } + + DropShadow { + anchors.fill: parent + horizontalOffset: 1 + verticalOffset: 1 + color: "#000000" + source: textcopy + } + + function wrapSymbols(text) { + if (!text) + return "" + + const isSymbol = (codePoint) => + (codePoint >= 0xE000 && codePoint <= 0xF8FF) // Private Use Area + || (codePoint >= 0xF0000 && codePoint <= 0xFFFFF) // Supplementary Private Use Area-A + || (codePoint >= 0x100000 && codePoint <= 0x10FFFF); // Supplementary Private Use Area-B + + return text.replace(/./gu, (c) => isSymbol(c.codePointAt(0)) + ? `${c}` + // ? c + : c); + } +} + -- cgit v1.2.3-70-g09d2