lots of changes

This commit is contained in:
Zacharias-Brohn
2025-11-19 17:01:20 +01:00
parent ddae364005
commit 07e399f6d9
19 changed files with 611 additions and 53 deletions
+77
View File
@@ -0,0 +1,77 @@
pragma ComponentBehavior: Bound
import QtQuick
import qs.Helpers
Item {
id: root
property string source: SearchWallpapers.current
property Image current: one
anchors.fill: parent
onSourceChanged: {
if (!source) {
current = null;
} else if (current === one) {
two.update();
} else {
one.update();
}
}
Component.onCompleted: {
console.log(root.source)
if (source)
Qt.callLater(() => one.update());
}
Img {
id: one
}
Img {
id: two
}
component Img: CachingImage {
id: img
function update(): void {
if (path === root.source) {
root.current = this;
} else {
path = root.source;
}
}
anchors.fill: parent
opacity: 0
scale: SearchWallpapers.showPreview ? 1 : 0.8
asynchronous: true
onStatusChanged: {
if (status === Image.Ready) {
root.current = this;
}
}
states: State {
name: "visible"
when: root.current === img
PropertyChanges {
img.opacity: 1
img.scale: 1
}
}
transitions: Transition {
Anim {
target: img
properties: "opacity,scale"
}
}
}
}
+4 -1
View File
@@ -83,13 +83,16 @@ TextField {
Search.launch(appListLoader.item.currentItem.modelData);
launcherWindow.visible = false;
} else if ( wallpaperPickerLoader.active ) {
WallpaperPath.currentWallpaperPath = wallpaperPickerLoader.item.currentItem.modelData.path;
SearchWallpapers.setWallpaper(wallpaperPickerLoader.item.currentItem.modelData.path)
if ( Config.wallust ) {
Wallust.generateColors(WallpaperPath.currentWallpaperPath);
}
closeAnim.start();
}
event.accepted = true;
} else if ( event.key === Qt.Key_Escape ) {
if ( wallpaperPickerLoader.active )
SearchWallpapers.stopPreview();
closeAnim.start();
event.accepted = true;
}
+20 -3
View File
@@ -19,6 +19,7 @@ Repeater {
root.flagChanged();
}
}
Column {
id: groupColumn
required property string modelData
@@ -28,6 +29,7 @@ Repeater {
property bool shouldShow: false
property bool isExpanded: false
property bool collapseAnimRunning: false
function closeAll(): void {
for ( const n of NotifServer.notClosed.filter( n => n.appName === modelData ))
@@ -49,7 +51,7 @@ Repeater {
id: addTrans
SequentialAnimation {
PauseAnimation {
duration: ( addTrans.ViewTransition.index - addTrans.ViewTransition.targetIndexes[ 0 ]) * 50
duration: ( addTrans.ViewTransition.index - addTrans.ViewTransition.targetIndexes[ 0 ]) * 30
}
ParallelAnimation {
NumberAnimation {
@@ -77,6 +79,16 @@ Repeater {
}
}
Timer {
interval: addTrans.ViewTransition.targetIndexes.length * 30 + 100
running: groupColumn.isExpanded
repeat: false
onTriggered: {
groupColumn.shouldShow = true;
console.log("ran timer");
}
}
move: Transition {
id: moveTrans
NumberAnimation {
@@ -84,6 +96,11 @@ Repeater {
duration: 100;
easing.type: Easing.OutCubic
}
NumberAnimation {
properties: "opacity, scale";
to: 1.0;
}
}
RowLayout {
@@ -120,11 +137,11 @@ Repeater {
anchors.fill: parent
hoverEnabled: true
onClicked: {
groupColumn.shouldShow = false;
groupColumn.collapseAnimRunning = true;
}
}
}
}
NotifGroupRepeater { }
NotifGroupRepeater { id: groupRepeater }
}
}
+6
View File
@@ -259,6 +259,12 @@ Scope {
}
Component.onCompleted: currentIndex = SearchWallpapers.list.findIndex( w => w.path === WallpaperPath.currentWallpaperPath )
Component.onDestruction: SearchWallpapers.stopPreview()
onCurrentItemChanged: {
if ( currentItem )
SearchWallpapers.preview( currentItem.modelData.path );
}
cacheItemCount: 5
snapMode: PathView.SnapToItem
+25 -25
View File
@@ -4,21 +4,21 @@ import QtQuick
import QtQuick.Layouts
import qs.Config
import qs.Daemons
import qs.Helpers
Repeater {
id: groupListView
model: ScriptModel {
id: groupModel
values: groupColumn.isExpanded ? groupColumn.notifications : groupColumn.notifications.slice( 0, 1 )
values: groupColumn.isExpanded || groupColumn.shouldShow ? groupColumn.notifications : groupColumn.notifications.slice( 0, 1 )
}
Rectangle {
id: groupHeader
required property int index
required property NotifServer.Notif modelData
property alias notifHeight: groupHeader.height
property bool previewHidden: groupColumn.shouldShow && index > 0
property bool previewHidden: !groupColumn.shouldShow && index > 0
width: parent.width
height: contentColumn.height + 15
@@ -26,10 +26,12 @@ Repeater {
border.color: "#555555"
border.width: 1
radius: 8
opacity: previewHidden ? 0 : 1.0
opacity: previewHidden ? 0 : 1
scale: previewHidden ? 0.7 : 1.0
Component.onCompleted: modelData.lock(this);
Component.onCompleted: {
modelData.lock(this);
}
Component.onDestruction: modelData.unlock(this);
MouseArea {
@@ -40,7 +42,6 @@ Repeater {
groupHeader.modelData.actions[0].invoke();
}
} else {
groupColumn.shouldShow = true;
groupColumn.isExpanded = true;
}
}
@@ -48,7 +49,7 @@ Repeater {
ParallelAnimation {
id: collapseAnim
running: !groupColumn.shouldShow && index > 0
running: groupColumn.collapseAnimRunning
Anim {
target: groupHeader
@@ -66,6 +67,8 @@ Repeater {
}
onFinished: {
groupColumn.isExpanded = false;
groupColumn.shouldShow = false;
groupColumn.collapseAnimRunning = false;
}
}
@@ -107,13 +110,6 @@ Repeater {
}
}
// Behavior on height {
// Anim {
// duration: MaterialEasing.expressiveDefaultSpatialTime
// easing.bezierCurve: MaterialEasing.expressiveDefaultSpatial
// }
// }
Column {
id: contentColumn
anchors.top: parent.top
@@ -122,7 +118,6 @@ Repeater {
anchors.leftMargin: 10
anchors.rightMargin: 10
anchors.topMargin: 5
// width: parent.width - 20
spacing: 10
RowLayout {
id: infoRow
@@ -130,19 +125,19 @@ Repeater {
spacing: 10
IconImage {
source: groupHeader.modelData.image
source: groupHeader.modelData.image === "" ? Qt.resolvedUrl(groupHeader.modelData.appIcon) : Qt.resolvedUrl(groupHeader.modelData.image)
Layout.preferredWidth: 48
Layout.preferredHeight: 48
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.topMargin: 5
visible: groupHeader.modelData.image !== ""
visible: source !== ""
}
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Text {
TextRender {
text: groupHeader.modelData.summary
color: "white"
font.bold: true
@@ -152,21 +147,26 @@ Repeater {
Layout.alignment: Qt.AlignTop
}
Text {
TextRender {
text: groupHeader.modelData.body
font.pointSize: 12
color: "#dddddd"
font.pointSize: 12
elide: Text.ElideRight
lineHeightMode: Text.FixedHeight
lineHeight: 20
textFormat: Text.MarkdownText
wrapMode: Text.WordWrap
maximumLineCount: 5
linkColor: Config.accentColor.accents.primaryAlt
onLinkActivated: link => {
Quickshell.execDetached(["app2unit", "-O", "--", link]);
}
Layout.fillWidth: true
Layout.fillHeight: true
}
}
Text {
TextRender {
text: groupHeader.modelData.timeStr
font.pointSize: 10
color: "#666666"
@@ -191,7 +191,7 @@ Repeater {
required property var modelData
color: buttonArea.containsMouse ? "#15FFFFFF" : "#09FFFFFF"
radius: 4
Text {
TextRender {
anchors.centerIn: parent
text: actionButton.modelData.text
color: "white"
@@ -220,7 +220,7 @@ Repeater {
color: closeArea.containsMouse ? "#FF6077" : "transparent"
radius: 9
Text {
TextRender {
anchors.centerIn: parent
text: "✕"
color: closeArea.containsMouse ? "white" : "#888888"
+1 -1
View File
@@ -71,7 +71,7 @@ PanelWindow {
id: showAnimation
target: backgroundRect
property: "x"
to: root.bar.screen.width - backgroundRect.implicitWidth - 10
to: Math.round(root.bar.screen.width - backgroundRect.implicitWidth - 10)
from: root.bar.screen.width
duration: MaterialEasing.expressiveEffectsTime
easing.bezierCurve: MaterialEasing.expressiveEffects
+18 -2
View File
@@ -4,8 +4,10 @@ pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Config
Singleton {
id: root
property double memoryTotal: 1
property double memoryFree: 1
property double memoryUsed: memoryTotal - memoryFree
@@ -19,6 +21,8 @@ Singleton {
property double gpuUsage: 0
property double gpuMemUsage: 0
property double totalMem: 0
readonly property string gpuType: Config.gpuType.toUpperCase() || autoGpuType
property string autoGpuType: "NONE"
Timer {
interval: 1
@@ -52,7 +56,9 @@ Singleton {
previousCpuStats = { total, idle }
}
processGpu.running = true
if ( root.gpuType === "NVIDIA" ) {
processGpu.running = true
}
interval = 1000
}
@@ -61,10 +67,20 @@ Singleton {
FileView { id: fileMeminfo; path: "/proc/meminfo" }
FileView { id: fileStat; path: "/proc/stat" }
Process {
id: gpuTypeCheck
running: !Config.gpuType
command: ["sh", "-c", "if command -v nvidia-smi &>/dev/null && nvidia-smi -L &>/dev/null; then echo NVIDIA; elif ls /sys/class/drm/card*/device/gpu_busy_percent 2>/dev/null | grep -q .; then echo GENERIC; else echo NONE; fi"]
stdout: StdioCollector {
onStreamFinished: root.autoGpuType = text.trim()
}
}
Process {
id: oneshotMem
command: ["nvidia-smi", "--query-gpu=memory.total", "--format=csv,noheader,nounits"]
running: true
running: root.gpuType === "NVIDIA" && totalMem === 0
stdout: StdioCollector {
onStreamFinished: {
totalMem = Number(this.text.trim())
+8 -2
View File
@@ -146,11 +146,11 @@ PanelWindow {
RowLayout {
spacing: 12
IconImage {
source: rootItem.modelData.image
source: rootItem.modelData.image === "" ? Qt.resolvedUrl(rootItem.modelData.appIcon) : Qt.resolvedUrl(rootItem.modelData.image)
Layout.preferredWidth: 48
Layout.preferredHeight: 48
Layout.alignment: Qt.AlignHCenter | Qt.AlignLeft
visible: rootItem.modelData.image !== ""
// visible: rootItem.modelData.image !== ""
}
ColumnLayout {
@@ -185,10 +185,16 @@ PanelWindow {
text: rootItem.modelData.body
color: "#dddddd"
font.pointSize: 14
textFormat: Text.MarkdownText
elide: Text.ElideRight
wrapMode: Text.WordWrap
maximumLineCount: 4
width: parent.width
linkColor: Config.accentColor.accents.primaryAlt
onLinkActivated: link => {
Quickshell.execDetached(["app2unit", "-O", "--", link]);
}
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ Singleton {
repeat: true
onTriggered: {
updatesProc.running = true
interval = 60000
interval = 5000
}
}