1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
selc - select-copy
selc [-i] [-k] [-u] [-v]
Windows X11-PRIMARY analogue: selecting text copies it. A drag,
double-click, shift+click, or shift+arrow selection is copied to
the clipboard. No tray, no window, one process, a mouse hook that
only snapshots points.
selc run (no-op if already running)
selc -i write HKCU Run (start at logon) and run
selc -u remove HKCU Run and stop
selc -k stop the running instance
selc -v run with a console; print copy method
Build
make
make install
make boot
boot is install plus selc -i. The binary is a Windows subsystem
image; launching it from Explorer or Run does not open a console.
as(1) and ld(1) must be the MinGW ones; config.mk prepends
MINGWBIN to PATH.
Default install path: %USERPROFILE%\.local\bin
Override: make PREFIX=... install
How
A WH_MOUSE_LL hook (and optionally WH_KEYBOARD_LL) records the
gesture on the hook thread and posts to a message-only window.
The window waits COPYWAIT ms so the target app can finish the
selection, then:
1. ignore non-client hits (caption, scrollbars, resize)
2. ignore password Edit controls
3. WM_COPY to the focused child (SendMessageTimeout)
4. if the clipboard sequence did not change, inject Ctrl+C
except into console classes listed in config.h
Logon autostart is HKCU\...\Run\selc, so it starts with the
interactive session. That is the right time; a clipboard helper
cannot run in session 0.
Remarks
Injected Ctrl+C is skipped for ConsoleWindowClass, Windows
Terminal, and mintty so a false gesture cannot interrupt a
job. Those hosts often already copy on select.
UIPI: an unelevated selc cannot copy from an elevated window.
Run it at the same integrity level as the programs you use.
Edit config.h (copied from config.def.h) for thresholds and
the no-Ctrl+C class list. Recompile.
|