MEASURED 2026-11-15 on Xvfb with plain XTest keys: a session loads Dtwm*keyBindings: DtKeyBindings, and that block of sys.dtwmrc had no Mod4 line; the 25 Command/Ctrl+Left/Right/Eject/screenshot lines stood only in DefaultKeyBindings (and in the Sun-keyboard variant), so XGrabKey of Mod4+h from a second client succeeded (nothing grabbed) and the keys did nothing. The 25 lines are copied into message 11 of all 11 sys.dtwmrc.tmsg. SEEN after (C locale): Ctrl+Right goes to workspace Two; Command+Ctrl+Left makes the focused File Manager the left half, Command+Ctrl+BackSpace gives it back, Command+H minimizes it to an icon. Not run: the other ten locales (only C is built on this host); they got their own lines of DefaultKeyBindings, placed after the F9-F11 lines of their message 11 like the lines that stand there. With the front panel focused, Command+Ctrl+Left made it half the screen: f.mcde_snap and f.mcde_fullscreen now ignore panel windows (seen: unchanged). tools/mcde-xkey.sh presses keys by plain keycodes (XTest): xdotool 3.20160805 sends Alt_L first and the F-key with Alt held on this keymap, which made every plain F-key binding look dead (the F9 of t0216). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
70 lines
1.9 KiB
Bash
Executable File
70 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
#
|
|
# mcde-xkey.sh -- press keys on $DISPLAY by their plain keycodes (XTest)
|
|
#
|
|
# usage: tools/mcde-xkey.sh KEYSYM [KEYSYM ...]
|
|
# tools/mcde-xkey.sh F8
|
|
# tools/mcde-xkey.sh Super_L Control_L Left (Command+Control+Left)
|
|
#
|
|
# The keysyms are pressed in the order given and released in the reverse
|
|
# order; each is looked up with XKeysymToKeycode, nothing is added.
|
|
#
|
|
# Why not `xdotool key F8': xdotool 3.20160805 on Xvfb (the keymap of
|
|
# tools/mcde-shot.sh) sends Alt_L first and the F-key with Alt held, so a
|
|
# binding of a plain F-key never fires -- dtwm saw "code 74 state 0x8"
|
|
# for F8 (2026-11-15; the "F9 does nothing" of t0058/t0216 was this). Mouse
|
|
# actions of xdotool are fine.
|
|
#
|
|
# The helper is compiled once into build/mcde-shots/xkey (cc, libX11 and
|
|
# libXtst with their headers; Debian: libxtst-dev).
|
|
|
|
set -u
|
|
|
|
TOP=$(cd "$(dirname "$0")/.." && pwd)
|
|
BIN=$TOP/build/mcde-shots/xkey
|
|
|
|
if [ ! -x "$BIN" ] || [ "$0" -nt "$BIN" ]; then
|
|
mkdir -p "$TOP/build/mcde-shots" || exit 1
|
|
cc -o "$BIN" -x c - -lX11 -lXtst <<'EOF' || { echo "mcde-xkey: cannot build the helper (cc, libxtst-dev)" >&2; exit 1; }
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <X11/Xlib.h>
|
|
#include <X11/keysym.h>
|
|
#include <X11/extensions/XTest.h>
|
|
|
|
int
|
|
main(int argc, char **argv)
|
|
{
|
|
Display *d = XOpenDisplay(NULL);
|
|
int i;
|
|
|
|
if (d == NULL) {
|
|
fprintf(stderr, "mcde-xkey: no display\n");
|
|
return 1;
|
|
}
|
|
for (i = 1; i < argc; i++) {
|
|
KeyCode kc = XKeysymToKeycode(d, XStringToKeysym(argv[i]));
|
|
|
|
if (kc == 0) {
|
|
fprintf(stderr, "mcde-xkey: no keycode for %s\n", argv[i]);
|
|
return 2;
|
|
}
|
|
XTestFakeKeyEvent(d, kc, True, 0);
|
|
XFlush(d);
|
|
usleep(30000);
|
|
}
|
|
for (i = argc - 1; i >= 1; i--) {
|
|
XTestFakeKeyEvent(d, XKeysymToKeycode(d, XStringToKeysym(argv[i])),
|
|
False, 0);
|
|
XFlush(d);
|
|
usleep(30000);
|
|
}
|
|
XSync(d, False);
|
|
return 0;
|
|
}
|
|
EOF
|
|
fi
|
|
|
|
exec "$BIN" "$@"
|