diff options
| author | Nippy <nippy@rp1.hu> | 2026-05-09 13:33:09 +0200 |
|---|---|---|
| committer | Nippy <nippy@rp1.hu> | 2026-05-09 13:33:09 +0200 |
| commit | a2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5 (patch) | |
| tree | 1a8769217f84bfe9d6216fafaadaf8cdd876d457 /raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml | |
| parent | 34b9c34f982b2596cfa9e368a2d7f74e9a17477c (diff) | |
| download | RaveOS-PKGBUILD-a2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5.tar.gz RaveOS-PKGBUILD-a2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5.zip | |
raveos update
Diffstat (limited to 'raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml')
| -rw-r--r-- | raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml b/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Common/DankSocket.qml deleted file mode 100644 index 93471ba..0000000 --- a/raveos-hyprland-theme/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++ - } -} |