mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-05 06:59:50 -05:00
Initial commit
This commit is contained in:
commit
05cd51b54e
148 changed files with 10112 additions and 0 deletions
74
.stversions/notifications/Notifications~20250509-203451.qml
Normal file
74
.stversions/notifications/Notifications~20250509-203451.qml
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
import ".."
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
required property var screen
|
||||
|
||||
NotificationServer {
|
||||
id: notificationServer
|
||||
actionsSupported: true
|
||||
persistenceSupported: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: notificationServer
|
||||
|
||||
function onNotification(notification) {
|
||||
notificationLoader.item.visible = true;
|
||||
notification.tracked = true;
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: notificationLoader
|
||||
loading: true
|
||||
|
||||
PanelWindow {
|
||||
id: notificationWindow
|
||||
color: "transparent"
|
||||
width: 500
|
||||
visible: false
|
||||
exclusionMode: ExclusionMode.Normal
|
||||
mask: Region {
|
||||
item: notifLayout
|
||||
}
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
bottom: true
|
||||
right: true
|
||||
}
|
||||
|
||||
margins {
|
||||
top: 5
|
||||
bottom: 5
|
||||
right: 5
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: notifLayout
|
||||
spacing: 15
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
margins: 5
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: notificationServer.trackedNotifications
|
||||
|
||||
Toast {
|
||||
required property var modelData
|
||||
notification: modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
.stversions/notifications/Notifications~20250605-105246.qml
Normal file
23
.stversions/notifications/Notifications~20250605-105246.qml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
|
||||
Singleton {
|
||||
property alias notificationServer: notifServer
|
||||
|
||||
NotificationServer {
|
||||
id: notifServer
|
||||
actionsSupported: true
|
||||
persistenceSupported: true
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: notifServer
|
||||
|
||||
function onNotification(notification) {
|
||||
notification.tracked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
213
.stversions/notifications/Toast~20250509-203448.qml
Normal file
213
.stversions/notifications/Toast~20250509-203448.qml
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.Notifications
|
||||
import "../widgets/" as Widgets
|
||||
import ".."
|
||||
import "../.."
|
||||
|
||||
Rectangle {
|
||||
id: notificationRoot
|
||||
required property var notification
|
||||
radius: 5
|
||||
color: ShellGlobals.colors.base
|
||||
width: parent.width
|
||||
height: column.implicitHeight + 30
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
spread: 0.01
|
||||
samples: 25
|
||||
color: "#80000000"
|
||||
}
|
||||
|
||||
Item {
|
||||
id: timerController
|
||||
property int totalDuration: 5000
|
||||
property int remainingTime: totalDuration
|
||||
property bool isRunning: false
|
||||
property real lastTime: 0
|
||||
|
||||
Timer {
|
||||
id: internalTimer
|
||||
interval: 16
|
||||
repeat: true
|
||||
running: timerController.isRunning
|
||||
|
||||
onTriggered: {
|
||||
var currentTime = Date.now();
|
||||
if (timerController.lastTime > 0) {
|
||||
var delta = currentTime - timerController.lastTime;
|
||||
timerController.remainingTime -= delta;
|
||||
if (timerController.remainingTime <= 0) {
|
||||
timerController.isRunning = false;
|
||||
notification.expire();
|
||||
}
|
||||
}
|
||||
timerController.lastTime = currentTime;
|
||||
}
|
||||
}
|
||||
|
||||
function start() {
|
||||
if (!isRunning) {
|
||||
lastTime = Date.now();
|
||||
isRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
function pause() {
|
||||
isRunning = false;
|
||||
lastTime = 0;
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: notificationArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
|
||||
onContainsMouseChanged: {
|
||||
progressAnimation.paused = containsMouse;
|
||||
if (containsMouse) {
|
||||
timerController.pause();
|
||||
} else {
|
||||
timerController.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: column
|
||||
spacing: 5
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 15
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
RowLayout {
|
||||
id: topRow
|
||||
spacing: 10
|
||||
|
||||
IconImage {
|
||||
visible: notification.appIcon != ""
|
||||
source: Quickshell.iconPath(notification.appIcon)
|
||||
implicitSize: 24
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Text {
|
||||
id: appName
|
||||
text: notification.appName
|
||||
color: ShellGlobals.colors.text
|
||||
font.pointSize: 11
|
||||
font.bold: true
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: false
|
||||
}
|
||||
|
||||
Widgets.Separator {}
|
||||
|
||||
Text {
|
||||
id: summaryText
|
||||
text: notification.summary
|
||||
color: ShellGlobals.colors.text
|
||||
font.pointSize: 11
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: closeButton
|
||||
width: 24
|
||||
height: 24
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
Canvas {
|
||||
id: progressCircle
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
|
||||
property real progress: 1.0
|
||||
onProgressChanged: requestPaint()
|
||||
|
||||
onPaint: {
|
||||
var ctx = getContext("2d");
|
||||
ctx.reset();
|
||||
|
||||
var centerX = width / 2;
|
||||
var centerY = height / 2;
|
||||
var radius = Math.min(width, height) / 2 - 2;
|
||||
|
||||
ctx.beginPath();
|
||||
ctx.arc(centerX, centerY, radius, -Math.PI / 2, -Math.PI / 2 + 2 * Math.PI * progress);
|
||||
ctx.strokeStyle = ShellGlobals.colors.accent;
|
||||
ctx.lineWidth = 2;
|
||||
ctx.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: progressAnimation
|
||||
target: progressCircle
|
||||
property: "progress"
|
||||
from: 1.0
|
||||
to: 0.0
|
||||
duration: 5000
|
||||
running: true
|
||||
easing.type: Easing.Linear
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: closeButtonBg
|
||||
anchors.centerIn: parent
|
||||
width: 16
|
||||
height: 16
|
||||
color: "#FF474D"
|
||||
radius: 10
|
||||
visible: closeButtonArea.containsMouse
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: closeButtonArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onPressed: {
|
||||
notification.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
IconImage {
|
||||
source: "image://icon/window-close"
|
||||
implicitSize: 16
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
ColumnLayout {
|
||||
Text {
|
||||
id: bodyText
|
||||
text: notification.body
|
||||
color: ShellGlobals.colors.text
|
||||
font.pointSize: 11
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue