summaryrefslogtreecommitdiff
path: root/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml
diff options
context:
space:
mode:
authorAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
committerAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
commit70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch)
treeab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml
parent5d94c0a7d44a2255b81815a52a7056a94a39842d (diff)
downloadRaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz
RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml')
-rw-r--r--raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml62
1 files changed, 0 insertions, 62 deletions
diff --git a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml
deleted file mode 100644
index 93471ba..0000000
--- a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-import QtQuick
-import Quickshell.Io
-
-Item {
- id: root
-
- property alias path: socket.path
- property alias parser: socket.parser
- property bool connected: false
-
- property int reconnectBaseMs: 400
- property int reconnectMaxMs: 15000
-
- property int _reconnectAttempt: 0
-
- signal connectionStateChanged()
-
- onConnectedChanged: {
- socket.connected = connected
- }
-
- Socket {
- id: socket
-
- onConnectionStateChanged: {
- root.connectionStateChanged()
- if (connected) {
- root._reconnectAttempt = 0
- return
- }
- if (root.connected) {
- root._scheduleReconnect()
- }
- }
- }
-
- Timer {
- id: reconnectTimer
- interval: 0
- repeat: false
- onTriggered: {
- socket.connected = false
- Qt.callLater(() => socket.connected = true)
- }
- }
-
- function send(data) {
- const json = typeof data === "string" ? data : JSON.stringify(data)
- const message = json.endsWith("\n") ? json : json + "\n"
- socket.write(message)
- socket.flush()
- }
-
- function _scheduleReconnect() {
- const pow = Math.min(_reconnectAttempt, 10)
- const base = Math.min(reconnectBaseMs * Math.pow(2, pow), reconnectMaxMs)
- const jitter = Math.floor(Math.random() * Math.floor(base / 4))
- reconnectTimer.interval = base + jitter
- reconnectTimer.restart()
- _reconnectAttempt++
- }
-}