Skip to content

Commit e6fe506

Browse files
committed
Linux - custom JavaScript frameless drag
1 parent 539462c commit e6fe506

File tree

4 files changed

+1725
-1714
lines changed

4 files changed

+1725
-1714
lines changed

bridge/webui.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class WebuiBridge {
2929
#winY: number;
3030
#winW: number;
3131
#winH: number;
32+
#customWindowDrag: boolean;
3233
// Frameless Dragging
3334
#enableCustomDragging: boolean = false;
3435
#isDragging: boolean = false;
@@ -94,6 +95,7 @@ class WebuiBridge {
9495
winY = 0,
9596
winW = 0,
9697
winH = 0,
98+
customWindowDrag = false
9799
}: {
98100
secure: boolean;
99101
token: number;
@@ -103,6 +105,7 @@ class WebuiBridge {
103105
winY: number;
104106
winW: number;
105107
winH: number;
108+
customWindowDrag: boolean;
106109
}) {
107110
// Constructor arguments are injected by webui.c
108111
this.#secure = secure;
@@ -113,6 +116,7 @@ class WebuiBridge {
113116
this.#winY = winY;
114117
this.#winW = winW;
115118
this.#winH = winH;
119+
this.#enableCustomDragging = customWindowDrag;
116120
// Token
117121
this.#Token[0] = this.#token;
118122
// Instance
@@ -176,9 +180,8 @@ class WebuiBridge {
176180
let target = e.target;
177181
while (target) {
178182
let computedStyle = window.getComputedStyle(target);
179-
let webkitComputed = computedStyle.getPropertyValue("-webkit-app-region").trim();
180183
let webuiComputed = computedStyle.getPropertyValue("--webui-app-region").trim();
181-
if (webkitComputed === "drag" || webuiComputed === "drag") {
184+
if (webuiComputed === "drag") {
182185
this.#initialMouseX = e.screenX;
183186
this.#initialMouseY = e.screenY;
184187
this.#initialWindowX = this.#currentWindowX;

0 commit comments

Comments
 (0)