Fix : try FS 2
All checks were successful
release / build (push) Successful in 22s
release / verify-windows (push) Successful in 1m15s

This commit is contained in:
jeanotx32
2026-08-11 23:47:53 +02:00
parent f1a2066d56
commit 936c598013
6 changed files with 148 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
import { resolveXauthority, x11Env } from './x11.ts';
const run = promisify(execFile);
@@ -77,6 +78,7 @@ function displayFault(err: unknown): string | null {
return 'xdotool est absent — installe-le : apt install xdotool';
}
const stderr = String((err as { stderr?: string }).stderr ?? '').trim();
const auth = resolveXauthority();
// « Invalid MIT-MAGIC-COOKIE-1 key » est le symptôme d'un XAUTHORITY qui pointe
// sur le mauvais fichier — le cas le plus courant sous GDM.
if (
@@ -85,9 +87,13 @@ function displayFault(err: unknown): string | null {
)
) {
return (
`xdotool ne peut pas ouvrir l'affichage DISPLAY=${process.env.DISPLAY ?? ':0'} : ${stderr}. ` +
"Vérifie XAUTHORITY dans l'unité systemd — sous GDM le fichier n'est pas " +
'~/.Xauthority mais /run/user/<uid>/gdm/Xauthority.'
`xdotool ne peut pas ouvrir l'affichage : ${stderr}. Cookie d'autorisation ` +
(auth
? `utilisé : ${auth} — il existe mais ne vaut pas pour cette session. ` +
'Ouvre puis referme une session graphique, ou redémarre le service.'
: "introuvable : aucun des emplacements connus n'existe " +
'(XAUTHORITY, /run/user/<uid>/gdm/Xauthority, ~/.Xauthority). ' +
"Une session graphique est-elle ouverte sur cette machine ?")
);
}
return null;
@@ -160,7 +166,7 @@ async function findWindow(env: NodeJS.ProcessEnv, match: string): Promise<Visibl
}
function describeNoMatch(match: string, windows: VisibleWindow[]): string {
const display = process.env.DISPLAY ?? ':0';
const display = x11Env().DISPLAY;
if (windows.length === 0) {
return (
@@ -180,7 +186,7 @@ function describeNoMatch(match: string, windows: VisibleWindow[]): string {
}
async function sendLinux(key: string, match: string): Promise<HotkeyResult> {
const env = { ...process.env, DISPLAY: process.env.DISPLAY ?? ':0' };
const env = x11Env();
const target = await findWindow(env, match);
await run('xdotool', ['windowactivate', '--sync', target.id], { env, timeout: 5000 });