Skip to content

Commit

Permalink
fix: Increase OPEN_TIMEOUT and move injects to own file
Browse files Browse the repository at this point in the history
Closes #351
Closes #350
  • Loading branch information
zusorio committed Nov 5, 2024
1 parent d8c600e commit 28053b3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
15 changes: 3 additions & 12 deletions remote/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,11 @@ RUN wget -qO /usr/share/keyrings/xpra.asc ${XPRA_REGISTRY}/xpra.asc && \

# Inject script to force focus on modal windows in xpra client
# and remove the compressed index.html files because they don't contain our fix
RUN sed -i '/load_default_settings();/a \
setInterval(() => {\
for (const [id, win] of Object.entries(client.id_to_window).toReversed()) {\
if (win.metadata.modal) {\
if (client.topwindow !== parseInt(id)) {\
console.log("Forcing focus on modal window", id);\
client.set_focus(win);\
}\
break;\
}\
}\
}, 100);' /usr/share/xpra/www/index.html \
COPY client-inject.js /tmp/client-inject.js
RUN sed -i '/load_default_settings();/r /tmp/client-inject.js' /usr/share/xpra/www/index.html \
&& rm /usr/share/xpra/www/index.html.gz \
&& rm /usr/share/xpra/www/index.html.br

COPY rc.xml /etc/xdg/openbox/rc.xml
COPY menu.xml /etc/xdg/openbox/menu.xml

Expand Down
20 changes: 20 additions & 0 deletions remote/client-inject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
* SPDX-License-Identifier: Apache-2.0
*/

const injectInterval = setInterval(() => {
if (!client) return;
client.OPEN_TIMEOUT = 100_000;

for (const [id, win] of Object.entries(client.id_to_window).toReversed()) {
if (win.metadata.modal) {
if (client.topwindow !== parseInt(id)) {
console.log("Forcing focus on modal window", id);
client.set_focus(win);
}
break;
}
}
}, 100);
console.log("Inject script running on interval", injectInterval);

0 comments on commit 28053b3

Please sign in to comment.