Compare commits

...

2 Commits

25 changed files with 620 additions and 419 deletions

2
.gitignore vendored
View File

@@ -1 +1 @@
launcher/favorites.txt
launcher/launcher_state.json

View File

@@ -16,7 +16,9 @@ ModuleChip {
id: configWriter
}
width: chipRow.implicitWidth + 24
width: cryptoIcon.visible
? (12 + cryptoIcon.implicitWidth + 7 + chipRow.implicitWidth + 12)
: (chipRow.implicitWidth + 24)
radius: panelRadius
chipColor: t.cryptoBg
@@ -152,6 +154,7 @@ ModuleChip {
if (root.localPairs.length <= 1) return
root.activeCoinIndex = (root.activeCoinIndex - 1 + root.localPairs.length) % root.localPairs.length
root._applyFromCache()
root._restartTyping()
rotateTimer.restart()
}
@@ -159,6 +162,7 @@ ModuleChip {
if (root.localPairs.length <= 1) return
root.activeCoinIndex = (root.activeCoinIndex + 1) % root.localPairs.length
root._applyFromCache()
root._restartTyping()
rotateTimer.restart()
}
@@ -184,6 +188,51 @@ ModuleChip {
sparklineData = entry.sparkline || []
change7d = entry.change7d || 0
hasError = false
root._restartTyping()
}
property bool _typing: false
property int _typedLabel: 0
property int _typedValue: 0
property int _typedIcon: 0
function _restartTyping() {
typeAnim.stop()
_typing = true
_typedLabel = 0
_typedValue = 0
_typedIcon = 0
typeAnimLabel.to = (root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": ").length
typeAnimValue.to = (root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)).length
typeAnimIcon.to = (root.price >= 0 ? 1 : 0)
typeAnim.start()
}
SequentialAnimation {
id: typeAnim
onStopped: { root._typing = false }
NumberAnimation {
id: typeAnimLabel
target: root
property: "_typedLabel"
duration: 200
easing.type: Easing.Linear
}
NumberAnimation {
id: typeAnimValue
target: root
property: "_typedValue"
duration: 200
easing.type: Easing.Linear
}
NumberAnimation {
id: typeAnimIcon
target: root
property: "_typedIcon"
duration: 50
easing.type: Easing.Linear
}
}
function fetchPrice() {
@@ -291,9 +340,26 @@ ModuleChip {
onLocalRefreshSecChanged: refreshTimer.restart()
onLocalRotateSecChanged: rotateTimer.restart()
Text {
id: cryptoIcon
visible: root.localShowIcon
text: "󰿤"
color: t.cryptoIcon
font.pixelSize: 14
anchors {
left: parent.left
leftMargin: 12
verticalCenter: parent.verticalCenter
}
}
RowLayout {
id: chipRow
anchors.centerIn: parent
anchors {
left: cryptoIcon.visible ? cryptoIcon.right : parent.left
leftMargin: cryptoIcon.visible ? 7 : 12
verticalCenter: parent.verticalCenter
}
spacing: 0
SequentialAnimation on opacity {
@@ -310,34 +376,61 @@ ModuleChip {
}
}
Text {
visible: root.localShowIcon
text: "󰿤"
color: t.cryptoIcon
font.pixelSize: 14
Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: 7
Item {
implicitWidth: labelSizer.implicitWidth
implicitHeight: labelSizer.implicitHeight
Text {
id: labelSizer
text: root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": "
color: "transparent"
font.pixelSize: 12
font.bold: true
verticalAlignment: Text.AlignVCenter
}
Text {
text: root._typing
? (root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": ").substring(0, root._typedLabel)
: root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": "
color: t.cryptoLabel
font.pixelSize: 12
font.bold: true
verticalAlignment: Text.AlignVCenter
anchors.fill: labelSizer
}
}
Item {
implicitWidth: valueSizer.implicitWidth
implicitHeight: valueSizer.implicitHeight
Text {
id: valueSizer
text: root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)
color: "transparent"
font.pixelSize: 13
font.bold: true
verticalAlignment: Text.AlignVCenter
}
Text {
text: root._typing
? (root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)).substring(0, root._typedValue)
: root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)
color: t.cryptoValue
font.pixelSize: 13
font.bold: true
verticalAlignment: Text.AlignVCenter
anchors.fill: valueSizer
}
}
Text {
text: root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": "
color: t.cryptoLabel
font.pixelSize: 12
font.bold: true
verticalAlignment: Text.AlignVCenter
}
Text {
text: root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)
color: t.cryptoValue
font.pixelSize: 13
font.bold: true
verticalAlignment: Text.AlignVCenter
}
Text {
visible: root.price >= 0
text: root.change24h >= 0 ? "▲" : "▼"
visible: root._typing || root.price >= 0
text: root._typing
? (root.price >= 0 ? (root.change24h >= 0 ? "▲" : "▼") : "").substring(0, root._typedIcon)
: (root.price >= 0 ? (root.change24h >= 0 ? "▲" : "▼") : "")
color: root.change24h >= 0 ? (t.cryptoUp) : (t.cryptoDown)
font.pixelSize: 9
font.bold: true

View File

@@ -46,7 +46,7 @@ ModuleChip {
signal dismissed(string toastId)
width: parent ? parent.width : 350
width: parent ? parent.width : 400
height: toastCard.height
property real progressVal: 1.0
@@ -65,12 +65,12 @@ ModuleChip {
NumberAnimation {
target: slideTranslate; property: "x"
from: toastRoot.slideX; to: 0
duration: 320; easing.type: Easing.OutCubic
duration: 380; easing.type: Easing.OutCubic
}
NumberAnimation {
target: bubbleScale; property: "yScale"
from: 0; to: 1
duration: 280; easing.type: Easing.OutBack
duration: 320; easing.type: Easing.OutBack
}
}
@@ -112,7 +112,7 @@ ModuleChip {
Rectangle {
id: toastCard
width: parent.width
height: toastContent.implicitHeight + (toastRoot.urgency === NotificationUrgency.Low ? 30 : 24)
height: toastContent.implicitHeight + (toastRoot.urgency === NotificationUrgency.Low ? 31 : 25)
radius: 16
color: cardHover.hovered ? toastRoot.t.notifToastBgHover : toastRoot.t.notifToastBg
@@ -121,19 +121,46 @@ ModuleChip {
: (cardHover.hovered ? toastRoot.t.notifBorderActive : toastRoot.t.notifToastBorder)
border.width: Cfg.Config.popupBorderWidth
Behavior on color { ColorAnimation { duration: 150; easing.type: Easing.OutCubic } }
Behavior on border.color { ColorAnimation { duration: 150 } }
Behavior on color { ColorAnimation { duration: 180; easing.type: Easing.OutCubic } }
Behavior on border.color { ColorAnimation { duration: 180 } }
// Subtle outer glow for critical notifications
Rectangle {
visible: toastRoot.urgency === NotificationUrgency.Critical
anchors.fill: parent
anchors.margins: -3
radius: parent.radius + 3
color: "transparent"
border.color: Qt.rgba(toastRoot.t.notifUrgencyCritical.r, toastRoot.t.notifUrgencyCritical.g, toastRoot.t.notifUrgencyCritical.b, 0.22)
border.width: 2
z: -1
}
HoverHandler { id: cardHover }
TapHandler { onTapped: toastRoot.triggerDismiss() }
// Left accent bar — wider with a soft glow backing
Rectangle {
id: accentGlow
width: 8
height: Math.max(18, toastCard.height - 25)
radius: 4
anchors {
left: parent.left
leftMargin: 7
verticalCenter: parent.verticalCenter
}
color: Qt.rgba(toastRoot.urgencyColor(toastRoot.urgency).r,
toastRoot.urgencyColor(toastRoot.urgency).g,
toastRoot.urgencyColor(toastRoot.urgency).b, 0.18)
}
Rectangle {
width: 4
height: Math.max(16, toastCard.height - 24)
height: Math.max(18, toastCard.height - 25)
radius: 2
anchors {
left: parent.left
leftMargin: 10
leftMargin: 9
verticalCenter: parent.verticalCenter
}
color: toastRoot.urgencyColor(toastRoot.urgency)
@@ -145,20 +172,20 @@ ModuleChip {
left: parent.left
right: parent.right
top: parent.top
leftMargin: 24
rightMargin: 12
topMargin: 12
leftMargin: 25
rightMargin: 13
topMargin: 13
}
spacing: 4
spacing: 5
RowLayout {
Layout.fillWidth: true
spacing: 6
spacing: 7
Text {
text: toastRoot.urgencyIcon(toastRoot.urgency)
color: toastRoot.urgencyColor(toastRoot.urgency)
font.pixelSize: 12
font.pixelSize: 11
font.bold: true
Layout.alignment: Qt.AlignVCenter
renderType: Text.NativeRendering
@@ -166,10 +193,10 @@ ModuleChip {
Text {
text: toastRoot.appName
color: toastRoot.t.notifToastAppName
font.pixelSize: 12
font.pixelSize: 10
font.bold: true
font.capitalization: Font.AllUppercase
font.letterSpacing: 0.4
font.letterSpacing: 0.8
Layout.fillWidth: true
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
@@ -178,17 +205,18 @@ ModuleChip {
Text {
text: toastRoot.timeStr
color: toastRoot.t.notifToastDim
font.pixelSize: 11
font.bold: true
font.pixelSize: 10
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
Rectangle {
Layout.alignment: Qt.AlignVCenter
width: 20; height: 20; radius: 8
color: closeHover.hovered ? toastRoot.t.notifHistoryHover : "transparent"
Behavior on color { ColorAnimation { duration: 100 } }
width: 18; height: 18; radius: 10
color: closeHover.hovered
? Qt.rgba(1, 1, 1, 0.1)
: "transparent"
Behavior on color { ColorAnimation { duration: 120 } }
Text {
anchors.centerIn: parent
@@ -218,16 +246,15 @@ ModuleChip {
Text {
text: toastRoot.body
color: toastRoot.t.notifToastDim
font.pixelSize: 12
font.bold: true
font.pixelSize: 11
Layout.fillWidth: true
wrapMode: Text.WordWrap
maximumLineCount: 3
elide: Text.ElideRight
textFormat: Text.PlainText
textFormat: Text.PlainText
visible: toastRoot.body !== ""
Layout.bottomMargin: toastRoot.urgency === NotificationUrgency.Low ? 6 : 0
lineHeight: 1.2
lineHeight: 1.35
renderType: Text.NativeRendering
}
}
@@ -236,9 +263,9 @@ ModuleChip {
visible: toastRoot.urgency === NotificationUrgency.Low && toastRoot.timeout > 0
anchors {
left: parent.left; right: parent.right; bottom: parent.bottom
margins: 10; bottomMargin: 10
margins: 13; bottomMargin: 10
}
height: 4
height: 2
Rectangle {
anchors.fill: parent
@@ -250,6 +277,7 @@ ModuleChip {
height: parent.height
radius: 2
color: toastRoot.t.notifProgressFill
Behavior on width { NumberAnimation { duration: 80; easing.type: Easing.Linear } }
}
}
}
@@ -271,7 +299,7 @@ ModuleChip {
signal dismissed(int itemIndex)
height: histItemContent.implicitHeight + 16
height: histItemContent.implicitHeight + 18
radius: 10
clip: true
color: histItemHover.hovered ? histRoot.t.notifHistoryHover : "transparent"
@@ -282,25 +310,35 @@ ModuleChip {
SequentialAnimation {
id: dismissAnim
ParallelAnimation {
NumberAnimation { target: histRoot; property: "opacity"; to: 0; duration: 150; easing.type: Easing.OutCubic }
NumberAnimation { target: histRoot; property: "scale"; to: 0.95; duration: 150; easing.type: Easing.OutCubic }
NumberAnimation { target: histRoot; property: "opacity"; to: 0; duration: 180; easing.type: Easing.OutCubic }
NumberAnimation { target: histRoot; property: "scale"; to: 0.94; duration: 180; easing.type: Easing.OutCubic }
}
NumberAnimation { target: histRoot; property: "height"; to: 0; duration: 150; easing.type: Easing.InOutQuad }
NumberAnimation { target: histRoot; property: "height"; to: 0; duration: 160; easing.type: Easing.InOutQuad }
ScriptAction { script: histRoot.dismissed(histRoot.itemIndex) }
}
// Glow backing behind accent bar
Rectangle {
width: 7
height: Math.max(13, histRoot.height - 16)
radius: 3
anchors { left: parent.left; leftMargin: 6; verticalCenter: parent.verticalCenter }
color: Qt.rgba(histRoot.urgencyColor(histRoot.urgency).r,
histRoot.urgencyColor(histRoot.urgency).g,
histRoot.urgencyColor(histRoot.urgency).b, 0.15)
}
Rectangle {
width: 3
height: Math.max(10, histRoot.height - 16)
radius: 1.5
height: Math.max(13, histRoot.height - 16)
radius: 2
anchors { left: parent.left; leftMargin: 8; verticalCenter: parent.verticalCenter }
color: histRoot.urgencyColor(histRoot.urgency)
}
Rectangle {
anchors { right: parent.right; top: parent.top; margins: 6 }
width: 18; height: 18; radius: 8
color: histCloseHover.hovered ? histRoot.t.notifHistoryHover : "transparent"
anchors { right: parent.right; top: parent.top; margins: 6 }
width: 18; height: 18; radius: 9
color: histCloseHover.hovered ? Qt.rgba(1, 1, 1, 0.1) : "transparent"
opacity: histItemHover.hovered ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 150 } }
Behavior on color { ColorAnimation { duration: 150 } }
@@ -311,40 +349,39 @@ ModuleChip {
}
Text {
anchors { right: parent.right; rightMargin: 6; top: parent.top; topMargin: 8 }
anchors { right: parent.right; rightMargin: 8; top: parent.top; topMargin: 8 }
text: histRoot.timeStr
color: histRoot.t.notifToastDim
font.pixelSize: 10
font.bold: true
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
opacity: histItemHover.hovered ? 0 : 1
opacity: histItemHover.hovered ? 0 : 0.8
Behavior on opacity { NumberAnimation { duration: 150 } }
}
ColumnLayout {
id: histItemContent
anchors { left: parent.left; right: parent.right; top: parent.top; leftMargin: 20; rightMargin: 40; topMargin: 8 }
anchors { left: parent.left; right: parent.right; top: parent.top; leftMargin: 21; rightMargin: 39; topMargin: 8 }
spacing: 2
RowLayout {
Layout.fillWidth: true; spacing: 5
Text { text: histRoot.urgencyIcon(histRoot.urgency); color: histRoot.urgencyColor(histRoot.urgency); font.pixelSize: 10; font.bold: true; Layout.alignment: Qt.AlignVCenter; renderType: Text.NativeRendering }
Text {
text: histRoot.appName; color: histRoot.t.notifToastAppName; font.pixelSize: 11; font.bold: true
font.capitalization: Font.AllUppercase; font.letterSpacing: 0.4; Layout.fillWidth: true; elide: Text.ElideRight; verticalAlignment: Text.AlignVCenter
text: histRoot.appName; color: histRoot.t.notifToastAppName; font.pixelSize: 10; font.bold: true
font.capitalization: Font.AllUppercase; font.letterSpacing: 0.6; Layout.fillWidth: true; elide: Text.ElideRight; verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}
Text {
text: histRoot.summary; color: histRoot.t.notifToastText; font.pixelSize: 12; font.bold: true
text: histRoot.summary; color: histRoot.t.notifToastText; font.pixelSize: 13; font.bold: true
Layout.fillWidth: true; elide: Text.ElideRight; textFormat: Text.PlainText; visible: histRoot.summary !== ""
renderType: Text.NativeRendering
}
Text {
text: histRoot.body; color: histRoot.t.notifToastDim; font.pixelSize: 11; font.bold: true; Layout.fillWidth: true
wrapMode: Text.WordWrap; maximumLineCount: 2; elide: Text.ElideRight; textFormat: Text.PlainText; visible: histRoot.body !== ""; lineHeight: 1.2
text: histRoot.body; color: histRoot.t.notifToastDim; font.pixelSize: 10; Layout.fillWidth: true
wrapMode: Text.WordWrap; maximumLineCount: 2; elide: Text.ElideRight; textFormat: Text.PlainText; visible: histRoot.body !== ""; lineHeight: 1.3
renderType: Text.NativeRendering
}
}
@@ -395,9 +432,9 @@ ModuleChip {
visible: root.unreadCount > 0
anchors.top: parent.top
anchors.right: parent.right
width: Math.max(14, badgeLabel.implicitWidth + 6)
height: 14
radius: 7
width: Math.max(16, badgeLabel.implicitWidth + 8)
height: 16
radius: 8
color: t.notifBadgeBg
Behavior on width { NumberAnimation { duration: 150; easing.type: Easing.OutCubic } }
@@ -495,7 +532,7 @@ ModuleChip {
readonly property bool atBottom: pos === "bottomleft" || pos === "bottomright"
anchors { top: true; bottom: true; right: atRight; left: !atRight }
implicitWidth: 350 + root.barMargin + toastPad
implicitWidth: 344 + root.barMargin + toastPad
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.namespace: "main-shell-notifications-toasts"
@@ -512,8 +549,8 @@ ModuleChip {
id: toastCol
x: toastLayer.atRight ? root.barMargin : toastLayer.toastPad
y: !toastLayer.atBottom ? toastLayer.edgeGap : parent.height - toastLayer.edgeGap - toastCol.height
spacing: 8
width: 350
spacing: 10
width: 332
Repeater {
model: activeToasts
@@ -566,7 +603,7 @@ ModuleChip {
Item {
id: histClipContainer
readonly property int cardW: 340
readonly property int cardW: 352
readonly property int screenPad: root.barMargin + 10
x: {
@@ -577,9 +614,9 @@ ModuleChip {
anchors.top: root.isTop ? parent.top : undefined
anchors.bottom: root.isTop ? undefined : parent.bottom
anchors.topMargin: root.isTop ? (root.barHeight + root.barEdgePad + 10) : 0
anchors.bottomMargin: root.isTop ? 0 : (root.barHeight + root.barEdgePad + 10)
height: parent.height - root.barHeight - root.barEdgePad - 10
anchors.topMargin: root.isTop ? (root.barHeight + root.barEdgePad + 12) : 0
anchors.bottomMargin: root.isTop ? 0 : (root.barHeight + root.barEdgePad + 12)
height: parent.height - root.barHeight - root.barEdgePad - 12
clip: true
@@ -588,7 +625,7 @@ ModuleChip {
popupOpen: historyPopup.popupOpen
isTop: root.isTop
animEnabled: historyPopup.visible
height: Math.min(histHeader.implicitHeight + 56 + (notifHistory.count > 0 ? histCol.implicitHeight : 90), 520)
height: Math.min(histHeader.implicitHeight + 58 + (notifHistory.count > 0 ? histCol.implicitHeight : 94), 480)
color: t.notifHistoryBg
radius: Cfg.Config.popupRadius
@@ -598,25 +635,27 @@ ModuleChip {
RowLayout {
id: histHeader
anchors { left: parent.left; right: parent.right; top: parent.top }
anchors.topMargin: 20; anchors.leftMargin: 20; anchors.rightMargin: 20
anchors.topMargin: 16; anchors.leftMargin: 16; anchors.rightMargin: 16
spacing: 10
Text { text: "󰂚"; color: t.notifToastAppName; font.pixelSize: 18; font.bold: true; Layout.alignment: Qt.AlignVCenter; renderType: Text.NativeRendering }
Text {
text: "Notifications"; color: t.notifToastAppName; font.pixelSize: 15; font.bold: true
text: "Notifications"; color: t.notifToastAppName; font.pixelSize: 14; font.bold: true
Layout.fillWidth: true; Layout.alignment: Qt.AlignVCenter; renderType: Text.NativeRendering
}
Rectangle {
Layout.alignment: Qt.AlignVCenter
width: dndRow.implicitWidth + 16
height: 24
radius: 8
width: dndRow.implicitWidth + 19
height: 25
radius: 13
color: root.doNotDisturb
? Qt.rgba(t.notifDnd.r, t.notifDnd.g, t.notifDnd.b, 0.18)
: (dndHover.hovered ? t.notifHistoryHover : "transparent")
border.color: root.doNotDisturb ? t.notifDnd : "transparent"
border.width: Cfg.Config.popupBorderWidth
border.color: root.doNotDisturb
? Qt.rgba(t.notifDnd.r, t.notifDnd.g, t.notifDnd.b, 0.55)
: Qt.rgba(1, 1, 1, 0.08)
border.width: 1
Behavior on color { ColorAnimation { duration: 150 } }
Behavior on border.color { ColorAnimation { duration: 150 } }
@@ -627,7 +666,7 @@ ModuleChip {
Text {
text: "󰂛"
color: root.doNotDisturb ? t.notifDnd : t.notifToastDim
font.pixelSize: 12
font.pixelSize: 11
font.bold: true
anchors.verticalCenter: parent.verticalCenter
Behavior on color { ColorAnimation { duration: 150 } }
@@ -636,7 +675,7 @@ ModuleChip {
Text {
text: root.doNotDisturb ? "On" : "Off"
color: root.doNotDisturb ? t.notifDnd : t.notifToastDim
font.pixelSize: 11
font.pixelSize: 10
font.bold: true
anchors.verticalCenter: parent.verticalCenter
Behavior on color { ColorAnimation { duration: 150 } }
@@ -651,13 +690,15 @@ ModuleChip {
Rectangle {
visible: notifHistory.count > 0
Layout.alignment: Qt.AlignVCenter
width: clearText.implicitWidth + 16
height: 24
radius: 8
width: clearText.implicitWidth + 19
height: 25
radius: 13
color: clearHover.hovered ? t.notifHistoryHover : "transparent"
border.color: Qt.rgba(1, 1, 1, 0.08)
border.width: 1
Behavior on color { ColorAnimation { duration: 150 } }
Text { id: clearText; anchors.centerIn: parent; text: "Clear all"; color: t.notifToastDim; font.pixelSize: 11; font.bold: true; renderType: Text.NativeRendering }
Text { id: clearText; anchors.centerIn: parent; text: "Clear all"; color: t.notifToastDim; font.pixelSize: 10; font.bold: true; renderType: Text.NativeRendering }
HoverHandler { id: clearHover; cursorShape: Qt.PointingHandCursor }
TapHandler { onTapped: clearAllAnim.start() }
}
@@ -666,7 +707,7 @@ ModuleChip {
Rectangle {
id: histDivider
anchors { left: parent.left; right: parent.right; top: histHeader.bottom }
anchors.topMargin: 12; height: 1; color: t.notifSeparator
anchors.topMargin: 10; height: 1; color: t.notifSeparator; opacity: 0.6
}
SequentialAnimation {
@@ -674,11 +715,11 @@ ModuleChip {
ParallelAnimation {
NumberAnimation {
target: histCol; property: "opacity"
to: 0; duration: 220; easing.type: Easing.OutCubic
to: 0; duration: 240; easing.type: Easing.OutCubic
}
NumberAnimation {
target: clearShift; property: "y"
to: -16; duration: 220; easing.type: Easing.OutCubic
to: -20; duration: 240; easing.type: Easing.OutCubic
}
}
ScriptAction {
@@ -693,7 +734,7 @@ ModuleChip {
Flickable {
id: histFlick
anchors { left: parent.left; right: parent.right; top: histDivider.bottom; bottom: parent.bottom }
anchors.leftMargin: 2; anchors.rightMargin: 8
anchors.leftMargin: 4; anchors.rightMargin: 6
anchors.topMargin: 6; anchors.bottomMargin: 8; clip: true
contentHeight: histCol.implicitHeight
flickableDirection: Flickable.VerticalFlick
@@ -703,14 +744,14 @@ ModuleChip {
id: histCol
opacity: 1
transform: Translate { id: clearShift; y: 0 }
width: histFlick.width; spacing: 2; topPadding: 4; bottomPadding: 4; leftPadding: 2; rightPadding: 8
width: histFlick.width; spacing: 2; topPadding: 2; bottomPadding: 2; leftPadding: 4; rightPadding: 6
Item {
width: histCol.width - 16; height: 90; visible: notifHistory.count === 0
width: histCol.width - 16; height: 94; visible: notifHistory.count === 0
ColumnLayout {
anchors.centerIn: parent; spacing: 8
Text { text: "󰂚"; color: t.notifHistoryEmpty; font.pixelSize: 30; font.bold: true; Layout.alignment: Qt.AlignHCenter; renderType: Text.NativeRendering }
Text { text: "No notifications"; color: t.notifHistoryEmpty; font.pixelSize: 12; font.bold: true; Layout.alignment: Qt.AlignHCenter; renderType: Text.NativeRendering }
Text { text: "󰂚"; color: t.notifHistoryEmpty; font.pixelSize: 29; font.bold: true; Layout.alignment: Qt.AlignHCenter; renderType: Text.NativeRendering; opacity: 0.5 }
Text { text: "No notifications"; color: t.notifHistoryEmpty; font.pixelSize: 13; font.bold: true; Layout.alignment: Qt.AlignHCenter; renderType: Text.NativeRendering; opacity: 0.5 }
}
}

View File

@@ -21,7 +21,13 @@ PanelWindow {
property bool popupOpen: false
property real popupCenterX: -1
function _doOpen() { hideTimer.stop(); visible = true; popupOpen = true }
function _doOpen() {
hideTimer.stop()
if (chipRoot) {
popupCenterX = chipRoot.mapToItem(null, 0, 0).x + chipRoot.width / 2
}
visible = true; popupOpen = true
}
function open() {
_doOpen()
}

View File

@@ -118,8 +118,6 @@ QtObject {
// ────────────────────────────────────────────────────────────────────────
// LAUNCHER
// ────────────────────────────────────────────────────────────────────────
property string launcherScript: Quickshell.env("HOME") + "/.config/quickshell/launcher/launcher.sh"
property string launcherCacheDir: "/tmp/qs_launcher"
property bool launcherCloseOnClickOutside: true
property bool launcherSelectFirst: false
property bool launcherMipmapIcons: false
@@ -142,7 +140,7 @@ QtObject {
//
// This list is the *default*; pairs can be added/removed live in the
// Settings popup and those changes are persisted across restarts.
property var cryptoPairs: [{ coin: "bitcoin", currency: "usd" }, { coin: "ethereum", currency: "eur" }, { coin: "monero", currency: "usd" }, { coin: "bitcoin", currency: "eur" }, { coin: "bitcoin", currency: "brl" }, { coin: "ethereum", currency: "usd" }]
property var cryptoPairs: [{ coin: "bitcoin", currency: "usd" }, { coin: "ethereum", currency: "eur" }, { coin: "monero", currency: "usd" }, { coin: "bitcoin", currency: "eur" }, { coin: "bitcoin", currency: "brl" }, { coin: "ethereum", currency: "usd" }, { coin: "zcash", currency: "usd" }]
// ── Compact label decimals ────────────────────────────────────────────────
// 0 → "80k"

View File

@@ -207,6 +207,8 @@ QtObject {
readonly property color launcherPill: "#4481c7c7"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22cbdc3d"
readonly property color launcherSelected: "#44cbdc3d"

View File

@@ -207,6 +207,8 @@ QtObject {
readonly property color launcherPill: "#441e3a5f"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#2200d9ff"
readonly property color launcherSelected: "#4400d9ff"

View File

@@ -215,6 +215,8 @@ QtObject {
readonly property color launcherPill: "#444a5d6e"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#33f2b425"
readonly property color launcherSelected: "#44c19375"

View File

@@ -207,6 +207,8 @@ QtObject {
readonly property color launcherPill: "#444a5d6e"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22ebc6a0"
readonly property color launcherSelected: "#44ebc6a0"

View File

@@ -215,6 +215,8 @@ QtObject {
readonly property color launcherPill: "#44614d4a"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22e0533c"
readonly property color launcherSelected: "#44e0533c"

View File

@@ -207,6 +207,8 @@ QtObject {
readonly property color launcherPill: "#444a566e"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22f0a1ba"
readonly property color launcherSelected: "#44f0a1ba"

View File

@@ -207,6 +207,8 @@ QtObject {
readonly property color launcherPill: "#443d4a6d"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22bdf0ff"
readonly property color launcherSelected: "#44bdf0ff"

View File

@@ -218,6 +218,8 @@ QtObject {
readonly property color launcherPill: "#44284038"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#224a8c5c"
readonly property color launcherSelected: "#444a8c5c"

View File

@@ -216,6 +216,8 @@ QtObject {
readonly property color launcherPill: "#444a5d6e"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22c19375"
readonly property color launcherSelected: "#44c19375"

View File

@@ -215,6 +215,8 @@ QtObject {
readonly property color launcherPill: "#442e7d32"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22ff5722"
readonly property color launcherSelected: "#44ff5722"

View File

@@ -218,6 +218,8 @@ QtObject {
readonly property color launcherPill: "#44203060"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22b068d8"
readonly property color launcherSelected: "#44b068d8"

View File

@@ -208,6 +208,8 @@ QtObject {
readonly property color launcherPill: "#44565f89"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22ffb86c"
readonly property color launcherSelected: "#44ffb86c"

View File

@@ -207,6 +207,8 @@ QtObject {
readonly property color launcherPill: "#4431748f"
readonly property color launcherText: "#ffe0def4"
readonly property color launcherDim: "#ff6e6a86"
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: "#ff9ccfd8"
readonly property color launcherHover: "#4431748f"
readonly property color launcherSelected: "#6631748f"

View File

@@ -218,6 +218,8 @@ QtObject {
readonly property color launcherPill: "#444a4068"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#224ec0b8"
readonly property color launcherSelected: "#444ec0b8"

View File

@@ -215,6 +215,8 @@ QtObject {
readonly property color launcherPill: "#444a5270"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22c4889e"
readonly property color launcherSelected: "#44c4889e"

View File

@@ -207,6 +207,8 @@ QtObject {
readonly property color launcherPill: "#44ffb7ce"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22ff7eb9"
readonly property color launcherSelected: "#44ff7eb9"

View File

@@ -219,6 +219,8 @@ QtObject {
readonly property color launcherPill: "#444a3d6e"
readonly property color launcherText: textMain
readonly property color launcherDim: textDim
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#22b09de8"
readonly property color launcherSelected: "#44b09de8"

View File

@@ -216,6 +216,8 @@ QtObject {
readonly property color launcherPill: "#444a5d6e"
readonly property color launcherText: textMain
readonly property color launcherDim: "#ff92979b"
readonly property color launcherStar: launcherDim
readonly property color launcherStarHover: accent
readonly property color launcherAccent: accent
readonly property color launcherHover: "#2289b4fa"
readonly property color launcherSelected: "#4489b4fa"

View File

@@ -3,8 +3,8 @@ import QtQuick.Layouts
import QtQuick.Controls
import Quickshell
import Quickshell.Wayland
import Quickshell.Io
import Quickshell.Hyprland
import Quickshell.Io
import "../config" as Cfg
import "../components"
@@ -21,6 +21,78 @@ PanelWindow {
readonly property int launcherGap: 12
property var allItems: []
property var favoriteIds: []
property var accessCounts: ({})
property bool _loaded: false
readonly property string _statePath: Quickshell.env("HOME") + "/.config/quickshell/launcher/launcher_state.json"
function buildItems() {
const apps = DesktopEntries.applications.values
const items = []
for (let i = 0; i < apps.length; i++) {
const e = apps[i]
items.push({
name: e.name,
exec: e.execString,
id: e.id,
icon: e.icon,
entry: e,
actions: e.actions
})
}
items.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()))
root.allItems = items
}
Component.onCompleted: buildItems()
Connections {
target: DesktopEntries
function onApplicationsChanged() { root.buildItems() }
}
FileView {
id: stateFile
path: root._statePath
printErrors: false
watchChanges: true
onFileChanged: reload()
onAdapterUpdated: writeAdapter()
adapter: JsonAdapter {
id: stateAdapter
property list<string> favorites: []
property var access: ({})
}
onLoaded: {
root.favoriteIds = stateAdapter.favorites
root.accessCounts = stateAdapter.access
root._loaded = true
}
onLoadFailed: {
root._loaded = true
}
}
function toggleFavorite(itemId) {
const arr = root.favoriteIds.slice()
const idx = arr.indexOf(itemId)
if (idx >= 0)
arr.splice(idx, 1)
else
arr.push(itemId)
root.favoriteIds = arr
stateAdapter.favorites = root.favoriteIds
}
function incrementAccess(itemId) {
const counts = Object.assign({}, root.accessCounts)
counts[itemId] = (counts[itemId] || 0) + 1
root.accessCounts = counts
stateAdapter.access = root.accessCounts
}
GlobalShortcut {
id: launcherShortcut
name: "toggle"
@@ -30,12 +102,14 @@ PanelWindow {
property bool _isOpen: false
readonly property bool isOpen: _isOpen
property bool _keyboardNav: false
property var allItems: []
property bool loading: false
property int lastCacheUpdate: 0
property var favoriteIds: []
readonly property string favoritesPath: Quickshell.env("HOME") + "/.config/quickshell/launcher/favorites.txt"
property string _expandingActions: ""
property string _savedExpandId: ""
property real _savedContentY: 0
property bool _pendingRestore: false
property bool _inRestore: false
property string expandedItemId: ""
readonly property int defaultIndex: Cfg.Config.launcherSelectFirst ? 0 : -1
@@ -48,15 +122,49 @@ PanelWindow {
filtered = allItems.filter(i => i.name.toLowerCase().startsWith(q))
}
const favs = filtered.filter(i => root.favoriteIds.includes(i.id))
const rest = filtered.filter(i => !root.favoriteIds.includes(i.id))
let rest = filtered.filter(i => !root.favoriteIds.includes(i.id))
rest.sort((a, b) => (root.accessCounts[b.id] || 0) - (root.accessCounts[a.id] || 0))
const result = []
if (favs.length > 0)
result.push(...favs.map(i => Object.assign({}, i, { section: "Favorites" })))
if (rest.length > 0)
result.push(...rest.map(i => Object.assign({}, i, { section: "All Applications" })))
function pushItem(item) {
result.push(Object.assign({}, item, { isHeader: false, isAction: false }))
if (root.expandedItemId && item.id === root.expandedItemId && item.actions && item.actions.length > 0) {
for (let j = 0; j < item.actions.length; j++) {
const a = item.actions[j]
result.push({
isHeader: false,
isAction: true,
name: a.name,
id: item.id + ":" + a.id,
icon: a.icon,
actionObj: a
})
}
}
}
if (favs.length > 0) {
result.push({ isHeader: true, section: "Favorites" })
for (let i = 0; i < favs.length; i++)
pushItem(favs[i])
}
if (rest.length > 0) {
result.push({ isHeader: true, section: "All Applications" })
for (let i = 0; i < rest.length; i++)
pushItem(rest[i])
}
return result
}
function skipHeader(idx, dir) {
while (idx >= 0 && idx < root.filteredItems.length) {
const item = root.filteredItems[idx]
if (item && !item.isHeader) return idx
idx += dir
}
return -1
}
function toggle() {
if (!_isOpen) {
var fm = Hyprland.focusedMonitor
@@ -71,15 +179,16 @@ PanelWindow {
closeTimer.stop()
visible = true
_isOpen = true
expandedItemId = ""
searchInput.text = ""
resultsList.currentIndex = root.defaultIndex
loadItems()
loadFavorites()
Qt.callLater(() => resultsList.positionViewAtBeginning())
Qt.callLater(() => searchInput.forceActiveFocus())
}
function close() {
_isOpen = false
expandedItemId = ""
closeTimer.restart()
}
@@ -90,104 +199,18 @@ PanelWindow {
}
}
function loadItems() {
loading = true
var now = Date.now()
var staleMs = 300000
if (now - lastCacheUpdate < staleMs) {
readCache()
return
}
readCache()
lastCacheUpdate = now
updateProc.command = [Cfg.Config.launcherScript, "--update-only"]
updateProc.running = true
}
function readCache() {
const path = Cfg.Config.launcherCacheDir + "/drun.txt"
dataProc.rawOutput = ""
dataProc.command = ["cat", path]
dataProc.running = true
}
function shellQuote(str) {
return "'" + str.replace(/'/g, "'\\''") + "'"
}
function parseExec(str) {
const args = []
let current = ""
let inSingle = false
let inDouble = false
for (let i = 0; i < str.length; i++) {
const ch = str[i]
if (inSingle) {
if (ch === "'") inSingle = false
else current += ch
} else if (inDouble) {
if (ch === '"') inDouble = false
else current += ch
} else if (ch === "'") {
inSingle = true
} else if (ch === '"') {
inDouble = true
} else if (/\s/.test(ch)) {
if (current.length > 0) {
args.push(current)
current = ""
}
} else {
current += ch
}
}
if (current.length > 0) args.push(current)
return args
}
function loadFavorites() {
favoritesReadProc.command = ["sh", "-c", "cat " + shellQuote(favoritesPath) + " 2>/dev/null || true"]
favoritesReadProc.running = true
}
function saveFavorites() {
if (favoriteIds.length === 0) {
favoritesWriteProc.command = ["sh", "-c", ": > " + shellQuote(favoritesPath)]
} else {
const quoted = favoriteIds.map(id => shellQuote(id)).join(" ")
favoritesWriteProc.command = ["sh", "-c",
"printf '%s\\n' " + quoted + " > " + shellQuote(favoritesPath)]
}
favoritesWriteProc.running = true
}
function toggleFavorite(itemId) {
const arr = favoriteIds.slice()
const idx = arr.indexOf(itemId)
if (idx >= 0) {
arr.splice(idx, 1)
} else {
arr.push(itemId)
}
favoriteIds = arr
saveFavorites()
}
function launch(item) {
if (!item || !item.exec) return
if (!item || !item.entry) return
item.entry.execute()
console.log("Launching: " + item.name)
root.incrementAccess(item.id)
close()
}
let cleanExec = item.exec.replace(/%[fFuUik]/g, "").trim()
const logPath = "/tmp/qml_launch.log"
const args = parseExec(cleanExec)
const cmd = args.map(a => shellQuote(a)).join(" ") + " > " + shellQuote(logPath) + " 2>&1 < /dev/null &"
launchProc.command = ["sh", "-c", cmd]
launchProc.running = true
console.log("Launching: " + cleanExec)
function executeAction(item) {
if (!item || !item.actionObj) return
item.actionObj.execute()
console.log("Executing action: " + item.name)
close()
}
@@ -206,53 +229,9 @@ PanelWindow {
PopupHideTimer {
id: closeTimer
onTriggered: {
root.visible = false
root.allItems = []
}
onTriggered: root.visible = false
}
Process {
id: updateProc
onRunningChanged: if (!running) root.readCache()
}
Process {
id: dataProc
property string rawOutput: ""
stdout: SplitParser { onRead: data => dataProc.rawOutput += data + "\n" }
onRunningChanged: {
if (!running && rawOutput) {
const lines = rawOutput.trim().split("\n")
const items = []
for (let i = 0; i < lines.length; i++) {
const p = lines[i].split("\t")
if (p.length >= 3) items.push({ name: p[0], exec: p[1], id: p[2], icon: p[3] || "" })
}
root.allItems = items
root.loading = false
}
}
}
Process { id: launchProc }
Process {
id: favoritesReadProc
property string rawData: ""
stdout: SplitParser { onRead: data => favoritesReadProc.rawData += data + "\n" }
onRunningChanged: {
if (!running) {
if (rawData.trim()) {
root.favoriteIds = rawData.trim().split("\n").filter(l => l.length > 0)
}
rawData = ""
}
}
}
Process { id: favoritesWriteProc }
MouseArea {
anchors.fill: parent
@@ -282,7 +261,7 @@ PanelWindow {
height: targetHeight
Behavior on height {
enabled: root._isOpen
NumberAnimation { duration: 154; easing.type: Easing.OutCubic }
NumberAnimation { duration: 80; easing.type: Easing.OutCubic }
}
radius: Cfg.Config.popupRadius
@@ -325,32 +304,72 @@ PanelWindow {
verticalAlignment: TextInput.AlignVCenter
selectionColor: t.launcherAccent
onTextChanged: resultsList.currentIndex = root.defaultIndex
onTextChanged: {
resultsList.currentIndex = root.defaultIndex
root.expandedItemId = ""
}
Keys.onReturnPressed: {
if (root.filteredItems.length > 0) {
root.launch(root.filteredItems[Math.max(0, resultsList.currentIndex)])
const idx = root.skipHeader(Math.max(0, resultsList.currentIndex), 1)
if (idx < 0) return
const item = root.filteredItems[idx]
if (item.isAction)
root.executeAction(item)
else
root.launch(item)
}
Keys.onTabPressed: (event) => {
event.accepted = true
root._keyboardNav = true
const idx = root.skipHeader(Math.max(0, resultsList.currentIndex), 1)
if (idx < 0) return
const item = root.filteredItems[idx]
if (!item || item.isHeader || item.isAction) return
root._savedContentY = resultsList.contentY
root._savedExpandId = item.id
root._expandingActions = item.id
if (root.expandedItemId === item.id) {
root._pendingRestore = true
root.expandedItemId = ""
} else if (item.actions && item.actions.length > 0) {
root._pendingRestore = true
root.expandedItemId = item.id
}
Qt.callLater(() => {
for (let i = 0; i < resultsList.count; i++) {
const it = root.filteredItems[i]
if (it.id === item.id && !it.isAction && !it.isHeader) {
resultsList.currentIndex = i
resultsList.positionViewAtIndex(i, ListView.Contain)
break
}
}
})
}
Keys.onDownPressed: {
root._keyboardNav = true
if (resultsList.currentIndex < 0) {
resultsList.currentIndex = 0;
} else {
resultsList.currentIndex = Math.min(resultsList.currentIndex + 1, resultsList.count - 1)
var next = resultsList.currentIndex < 0 ? 0 : resultsList.currentIndex + 1
if (next >= resultsList.count) next = resultsList.count - 1
next = root.skipHeader(next, 1)
if (next < 0) next = root.skipHeader(0, 1)
if (next >= 0) {
resultsList.currentIndex = next
resultsList.positionViewAtIndex(next, ListView.Contain)
}
resultsList.positionViewAtIndex(resultsList.currentIndex, ListView.Contain)
}
Keys.onUpPressed: {
root._keyboardNav = true
if (resultsList.currentIndex < 0) {
resultsList.currentIndex = resultsList.count - 1;
} else {
resultsList.currentIndex = Math.max(resultsList.currentIndex - 1, 0)
var next = resultsList.currentIndex < 0 ? resultsList.count - 1 : resultsList.currentIndex - 1
if (next < 0) next = 0
next = root.skipHeader(next, -1)
if (next < 0) next = root.skipHeader(resultsList.count - 1, -1)
if (next >= 0) {
resultsList.currentIndex = next
resultsList.positionViewAtIndex(next, ListView.Contain)
}
resultsList.positionViewAtIndex(resultsList.currentIndex, ListView.Contain)
}
}
}
@@ -361,55 +380,117 @@ PanelWindow {
Layout.fillWidth: true
Layout.preferredHeight: listHeight
property int listHeight: Math.min(contentHeight, 400)
Behavior on listHeight {
NumberAnimation { duration: 154; easing.type: Easing.OutCubic }
// Avoid reacting to contentHeight changes from lazy delegate
// instantiation during scroll — only animate on model count changes.
property int listHeight: 0
NumberAnimation {
id: listHeightAnim
target: resultsList
property: "listHeight"
duration: 80
easing.type: Easing.OutCubic
}
function _syncListHeight() {
var h = Math.min(contentHeight, 400)
if (h === listHeight) return
listHeightAnim.stop()
listHeightAnim.from = listHeight
listHeightAnim.to = h
listHeightAnim.start()
}
onCountChanged: Qt.callLater(_syncListHeight)
Component.onCompleted: Qt.callLater(_syncListHeight)
clip: true
model: root.filteredItems
currentIndex: root.defaultIndex
spacing: 2
snapMode: ListView.NoSnap
highlightRangeMode: ListView.NoHighlightRange
cacheBuffer: 400
reuseItems: true
pixelAligned: false
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.VerticalFlick
section.property: "section"
section.criteria: ViewSection.FullString
section.delegate: Rectangle {
width: resultsList.width
height: 28
color: "transparent"
Text {
anchors { left: parent.left; leftMargin: 12; verticalCenter: parent.verticalCenter }
text: section
color: t.launcherDim
font.pixelSize: 11
font.weight: Font.Bold
onModelChanged: {
if (root._expandingActions !== "") {
root._expandingActions = ""
if (root._savedExpandId !== "") {
Qt.callLater(() => {
for (let i = 0; i < resultsList.count; i++) {
const it = root.filteredItems[i]
if (it.id === root._savedExpandId && !it.isAction && !it.isHeader) {
resultsList.currentIndex = i
resultsList.positionViewAtIndex(i, ListView.Contain)
break
}
}
root._pendingRestore = false
root._savedExpandId = ""
})
} else {
root._pendingRestore = false
}
} else {
currentIndex = root.defaultIndex
for (let i = 0; i < count; i++) {
const md = root.filteredItems[i]
if (md && !md.isHeader && !md.isAction) {
currentIndex = i
break
}
}
Qt.callLater(() => positionViewAtBeginning())
}
}
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
Connections {
target: resultsList
function onContentYChanged() {
if (root._pendingRestore && !root._inRestore && Math.abs(resultsList.contentY - root._savedContentY) > 1) {
root._inRestore = true
resultsList.contentY = root._savedContentY
root._inRestore = false
}
}
}
onModelChanged: currentIndex = root.defaultIndex
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
add: Transition {
NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 100; easing.type: Easing.InQuad }
}
delegate: Rectangle {
id: itemDelegate
width: resultsList.width
height: 38
radius: 8
property bool hovered: false
color: hovered ? t.launcherHover
radius: modelData.isHeader ? 0 : 8
color: modelData.isHeader ? "transparent"
: (starHovered || hovered) ? t.launcherHover
: (resultsList.currentIndex === index && index !== -1
? t.launcherSelected : "transparent")
clip: modelData.isAction
property bool hovered: false
property bool starHovered: false
Text {
visible: modelData.isHeader
anchors { left: parent.left; leftMargin: 12; verticalCenter: parent.verticalCenter }
text: modelData.section || ""
color: t.launcherDim
font.pixelSize: 13
font.weight: Font.Bold
}
RowLayout {
visible: !modelData.isHeader
anchors.fill: parent
anchors.leftMargin: 12
anchors.leftMargin: modelData.isAction ? 28 : 12
anchors.rightMargin: 12
spacing: 12
Item {
visible: !modelData.isAction
width: 22; height: 22
Layout.alignment: Qt.AlignVCenter
@@ -417,10 +498,10 @@ PanelWindow {
id: appIcon
anchors.fill: parent
source: modelData.icon ? "image://icon/" + modelData.icon : ""
sourceSize: Qt.size(64, 64)
sourceSize: Qt.size(64, 64)
fillMode: Image.PreserveAspectFit
smooth: true
mipmap: Cfg.Config.launcherMipmapIcons
mipmap: Cfg.Config.launcherMipmapIcons
visible: status === Image.Ready
}
@@ -434,37 +515,86 @@ PanelWindow {
}
Text {
text: modelData.name
color: t.launcherText
visible: modelData.isAction
text: ""
color: t.launcherDim
font.pixelSize: 14
Layout.alignment: Qt.AlignVCenter
}
Text {
text: modelData.name
color: modelData.isAction ? t.launcherDim : t.launcherText
font.pixelSize: modelData.isAction ? 13 : 14
Layout.fillWidth: true
elide: Text.ElideRight
}
Text {
visible: !modelData.isAction && modelData.actions && modelData.actions.length > 0
text: root.expandedItemId === modelData.id ? "▲" : "▼"
color: t.launcherDim
font.pixelSize: 9
Layout.alignment: Qt.AlignVCenter
}
Item {
width: 22; height: 22
visible: !modelData.isAction
width: 26; height: 26
Layout.alignment: Qt.AlignVCenter
Text {
id: starText
anchors.centerIn: parent
text: root.favoriteIds.includes(modelData.id) ? "★" : "☆"
color: root.favoriteIds.includes(modelData.id) ? t.launcherAccent : t.launcherDim
font.pixelSize: 14
font.pixelSize: 18
readonly property bool isFav: root.favoriteIds.includes(modelData.id)
color: starHovered ? t.launcherStarHover
: (isFav ? t.launcherAccent : t.launcherStar)
Behavior on color {
ColorAnimation { duration: 180; easing.type: Easing.OutCubic }
}
}
}
}
MouseArea {
acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent
hoverEnabled: true
onEntered: parent.hovered = true
onExited: parent.hovered = false
onExited: { parent.hovered = false; parent.starHovered = false }
onPositionChanged: mouse => {
parent.starHovered = !modelData.isHeader && !modelData.isAction && (mouse.x >= width - 46)
}
onClicked: mouse => {
if (mouse.x >= width - 46) {
root.toggleFavorite(modelData.id)
} else {
root.launch(modelData)
if (modelData.isHeader) return
if (mouse.button === Qt.RightButton) {
if (!modelData.isAction && modelData.actions && modelData.actions.length > 0) {
root._savedContentY = resultsList.contentY
root._savedExpandId = modelData.id
root._expandingActions = modelData.id
root._pendingRestore = true
if (root.expandedItemId === modelData.id)
root.expandedItemId = ""
else
root.expandedItemId = modelData.id
}
return
}
if (modelData.isAction) {
root.executeAction(modelData)
return
}
if (mouse.x >= width - 46)
root.toggleFavorite(modelData.id)
else
root.launch(modelData)
}
}
}

View File

@@ -1,103 +0,0 @@
#!/usr/bin/env bash
CACHE_DIR="/tmp/qs_launcher"
DRUN_CACHE="$CACHE_DIR/drun.txt"
RUN_CACHE="$CACHE_DIR/run.txt"
mkdir -p "$CACHE_DIR"
get_desktop_files() {
IFS=':' read -ra DIRS <<< \
"${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
for dir in "${DIRS[@]}"; do
APP_DIR="$dir/applications"
[ -d "$APP_DIR" ] || continue
find "$APP_DIR" \
-maxdepth 1 \
-name "*.desktop" \
2>/dev/null
done | while read -r f; do
name=$(
grep -m1 '^Name=' "$f" \
| cut -d= -f2-
)
exec=$(
grep -m1 '^Exec=' "$f" \
| cut -d= -f2- \
| sed 's/%[fFuUik]//g'
)
type=$(
grep -m1 '^Type=' "$f" \
| cut -d= -f2-
)
nodisplay=$(
grep -m1 '^NoDisplay=' "$f" \
| cut -d= -f2- \
| tr '[:upper:]' '[:lower:]'
)
icon=$(
grep -m1 '^Icon=' "$f" \
| cut -d= -f2-
)
[[ "$type" == "Application" ]] || continue
[[ "$nodisplay" != "true" ]] || continue
[[ -n "$name" ]] || continue
printf "%s\t%s\t%s\t%s\n" \
"$name" \
"$exec" \
"$(basename "$f" .desktop)" \
"$icon"
done
}
get_binaries() {
compgen -c \
| sort -u \
| head -600 \
| awk '{
print $1 "\t" $1 "\t" $1
}'
}
sort_and_dedup() {
sort -f -t$'\t' -k1,1 \
| awk -F'\t' '!seen[$1]++'
}
build_drun() {
get_desktop_files | sort_and_dedup
}
build_run() {
{ get_desktop_files; get_binaries; } | sort_and_dedup
}
update_cache() {
build_drun > "$DRUN_CACHE.tmp"
build_run > "$RUN_CACHE.tmp"
mv "$DRUN_CACHE.tmp" "$DRUN_CACHE"
mv "$RUN_CACHE.tmp" "$RUN_CACHE"
}
if [ "$1" == "--update-only" ]; then
update_cache
exit 0
fi