fixed notifications font rendering
This commit is contained in:
@@ -5,18 +5,11 @@ import Quickshell.Wayland
|
||||
import Quickshell.Io
|
||||
|
||||
import "../../config" as Cfg
|
||||
import "../../components"
|
||||
|
||||
Rectangle {
|
||||
ModuleChip {
|
||||
id: root
|
||||
|
||||
property real panelRadius: Cfg.Config.radius / 2
|
||||
property int borderWidth: Cfg.Config.panelBorderWidth
|
||||
property bool isTop: true
|
||||
property var targetScreen: null
|
||||
property int barHeight: Cfg.Config.barHeight
|
||||
property int barMargin: Cfg.Config.margin
|
||||
|
||||
readonly property var t: Cfg.Config.theme
|
||||
readonly property var cfg: Cfg.Config
|
||||
|
||||
readonly property string configPath:
|
||||
@@ -43,36 +36,24 @@ Rectangle {
|
||||
Behavior on color { ColorAnimation { duration: 150 } }
|
||||
Behavior on border.color { ColorAnimation { duration: 150 } }
|
||||
|
||||
property var localPairs: [{ coin: cfg.cryptoCoinId ?? "bitcoin", currency: cfg.cryptoVsCurrency ?? "usd" }]
|
||||
property var localPairs: [{ coin: "bitcoin", currency: "usd" }]
|
||||
property int activeCoinIndex: 0
|
||||
readonly property string localCoinId: localPairs.length > 0
|
||||
? localPairs[activeCoinIndex % localPairs.length].coin
|
||||
: (cfg.cryptoCoinId ?? "bitcoin")
|
||||
: "bitcoin"
|
||||
readonly property string localActiveCurrency: localPairs.length > 0
|
||||
? localPairs[activeCoinIndex % localPairs.length].currency
|
||||
: (cfg.cryptoVsCurrency ?? "usd")
|
||||
: "usd"
|
||||
|
||||
property string localVsCur: cfg.cryptoVsCurrency ?? "usd"
|
||||
property string localVsCur: "usd"
|
||||
property int localDecimals: cfg.cryptoDecimals ?? 1
|
||||
property int localRefreshSec: cfg.cryptoRefreshSec ?? 60
|
||||
property bool localShowIcon: cfg.cryptoShowIcon ?? true
|
||||
|
||||
function resolveWithPersistence() {
|
||||
const cfgCoin = cfg.cryptoCoinId ?? "bitcoin"
|
||||
const cfgCur = cfg.cryptoVsCurrency ?? "usd"
|
||||
|
||||
let cfgPairs
|
||||
if (typeof cfg.cryptoPairs !== "undefined" && Array.isArray(cfg.cryptoPairs) && cfg.cryptoPairs.length > 0) {
|
||||
cfgPairs = cfg.cryptoPairs
|
||||
} else if (typeof cfg.cryptoCoinIds !== "undefined" && Array.isArray(cfg.cryptoCoinIds) && cfg.cryptoCoinIds.length > 0) {
|
||||
cfgPairs = cfg.cryptoCoinIds.map(c => ({ coin: c, currency: cfgCur }))
|
||||
} else {
|
||||
cfgPairs = [{ coin: cfgCoin, currency: cfgCur }]
|
||||
}
|
||||
|
||||
root.localPairs = cfgPairs
|
||||
root.localVsCur = cfgPairs.length > 0 ? cfgPairs[0].currency : cfgCur
|
||||
root.displayCurrency = cfgPairs.length > 0 ? cfgPairs[0].currency : cfgCur
|
||||
root.localPairs = Array.isArray(cfg.cryptoPairs) && cfg.cryptoPairs.length > 0 ? cfg.cryptoPairs : [{ coin: "bitcoin", currency: "usd" }]
|
||||
root.localVsCur = root.localPairs[0].currency
|
||||
root.displayCurrency = root.localPairs[0].currency
|
||||
root.activeCoinIndex = 0
|
||||
root.localDecimals = cfg.cryptoDecimals ?? 1
|
||||
root.localRefreshSec = cfg.cryptoRefreshSec ?? 60
|
||||
@@ -123,7 +104,7 @@ Rectangle {
|
||||
property string coinSymbol: localCoinId.toUpperCase().slice(0, 4)
|
||||
property string coinName: ""
|
||||
property string lastUpdated: ""
|
||||
property string displayCurrency: cfg.cryptoVsCurrency ?? "usd"
|
||||
property string displayCurrency: "usd"
|
||||
property bool loading: false
|
||||
property bool loadingVisible: false
|
||||
property bool hasError: false
|
||||
@@ -289,54 +270,18 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
PopupPanel {
|
||||
id: cryptoPopup
|
||||
screen: root.targetScreen
|
||||
visible: false
|
||||
color: "transparent"
|
||||
ns: "crypto"
|
||||
chipRoot: root
|
||||
cardWidth: 300
|
||||
hasKeyboardFocus: true
|
||||
|
||||
property bool popupOpen: false
|
||||
property real popupCenterX: 0
|
||||
|
||||
function open() { popupCenterX = root.mapToItem(null, 0, 0).x + root.width / 2; hideTimer.stop(); visible = true; popupOpen = true }
|
||||
function close() { popupOpen = false; hideTimer.restart() }
|
||||
function toggle() { popupOpen ? close() : open() }
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
interval: Cfg.Config.popupAnimDuration + 70
|
||||
onTriggered: cryptoPopup.visible = false
|
||||
function open() {
|
||||
popupCenterX = root.mapToItem(null, 0, 0).x + root.width / 2
|
||||
_doOpen()
|
||||
}
|
||||
|
||||
anchors { top: true; bottom: true; left: true; right: true }
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
WlrLayershell.namespace: "main-shell-crypto"
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
mask: popupOpen ? null : _noInput
|
||||
Region { id: _noInput }
|
||||
|
||||
TapHandler { onTapped: cryptoPopup.close() }
|
||||
|
||||
Item {
|
||||
id: popClip
|
||||
readonly property int cardW: 300
|
||||
readonly property int screenPad: root.barMargin + 10
|
||||
|
||||
x: {
|
||||
let cx = cryptoPopup.popupCenterX
|
||||
return Math.max(screenPad,
|
||||
Math.min(cx - cardW / 2, parent.width - cardW - screenPad))
|
||||
}
|
||||
width: cardW
|
||||
|
||||
anchors.top: root.isTop ? parent.top : undefined
|
||||
anchors.bottom: root.isTop ? undefined : parent.bottom
|
||||
anchors.topMargin: root.isTop ? (root.barHeight + 10) : 0
|
||||
anchors.bottomMargin: root.isTop ? 0 : (root.barHeight + 10)
|
||||
height: parent.height - root.barHeight - 10
|
||||
clip: true
|
||||
|
||||
Rectangle {
|
||||
id: card
|
||||
width: parent.width
|
||||
@@ -1166,19 +1111,9 @@ Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent; cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
const cfgCoin = cfg.cryptoCoinId ?? "bitcoin"
|
||||
const cfgCur = cfg.cryptoVsCurrency ?? "usd"
|
||||
let cfgPairs
|
||||
if (typeof cfg.cryptoPairs !== "undefined" && Array.isArray(cfg.cryptoPairs) && cfg.cryptoPairs.length > 0) {
|
||||
cfgPairs = cfg.cryptoPairs
|
||||
} else if (typeof cfg.cryptoCoinIds !== "undefined" && Array.isArray(cfg.cryptoCoinIds) && cfg.cryptoCoinIds.length > 0) {
|
||||
cfgPairs = cfg.cryptoCoinIds.map(c => ({ coin: c, currency: cfgCur }))
|
||||
} else {
|
||||
cfgPairs = [{ coin: cfgCoin, currency: cfgCur }]
|
||||
}
|
||||
root.localPairs = cfgPairs
|
||||
root.localVsCur = cfgCur
|
||||
root.displayCurrency = cfgPairs.length > 0 ? cfgPairs[0].currency : cfgCur
|
||||
root.localPairs = Array.isArray(cfg.cryptoPairs) && cfg.cryptoPairs.length > 0 ? cfg.cryptoPairs : [{ coin: "bitcoin", currency: "usd" }]
|
||||
root.localVsCur = "usd"
|
||||
root.displayCurrency = root.localPairs.length > 0 ? root.localPairs[0].currency : "usd"
|
||||
root.activeCoinIndex = 0
|
||||
root.localDecimals = cfg.cryptoDecimals ?? 1
|
||||
root.localRefreshSec = cfg.cryptoRefreshSec ?? 60
|
||||
@@ -1195,6 +1130,5 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user