-
Notifications
You must be signed in to change notification settings - Fork 1
/
hk.1
98 lines (98 loc) · 1.99 KB
/
hk.1
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.Dd $Mdocdate: December 12 2021 $
.Dt HK 1
.Os
.Sh NAME
.Nm hk
.Nd Set temporary X11 hotkeys
.Sh SYNOPSIS
.Nm hk
.Op Fl v w
.Ar hotkey
.Ar command Op Ar argument ...
.Sh DESCRIPTION
.Nm
allows temporary X11 hotkeys to be set.
For example:
.Bd -literal -offset 4n
hk Ctrl+Shift+F6 notify-send Hello
.Ed
.Pp
will execute the command
.Dq notify-send Hello
when
.Dq Ctrl+Shift+F6
is pressed.
.Nm
exits as soon as the command has executed.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl v
Once the hotkey is released, prints at regular intervals to stdout which
non-ignored keys (see the
.Sx CAVEATS
section) remain held.
Only meaningful in conjunction with
.Fl w .
.It Fl w
causes
.Nm
to wait until
.Em all
non-ignored (see the
.Sx CAVEATS
section) keys (not just the hotkey) are released before executing
.Em command .
.It hotkey
Is the hotkey to active the execution of
.Em command .
Hotkeys take the form:
.Bd -literal -offset 4n
[Modifier1[+Modifier2[+...]]+]<Key>
.Ed
.Pp
The particular modifiers available depend on XKB's interpretation of your
physical keyboard, but typically include
.Em Ctrl
/
.Em Control ,
.Em Shift ,
and so on.
Modifiers are case insensitive.
.Em key
is case sensitive and again depends on
.Em XKB 's
interpretation of your physical keyboard.
If in doubt,
.Xr xev 1
can be used to find out the
.Em XKB
name of a physical key.
.It command Op Ar arguments ...
is the program to be executed, using the outer shell's normal lookup mechanism
to locate
.Em command .
.Nm
passes stdin, stdout, and stderr unchanged to
.Em command .
.El
.Sh SEE ALSO
.Xr xev 1
.Pp
.Lk https://tratt.net/laurie/src/hk/
.Sh AUTHORS
.An -nosplit
.Nm
was written by
.An Laurence Tratt Aq https://tratt.net/laurie/
.Sh CAVEATS
.Nm
ignores the Caps Lock, Mode Switch, Num Lock, and Scroll Lock modifiers when:
determining if
.Em hotkey
has been pressed; and determining whether any keys remain pressed for
.Fl w .
However, other keyboard modifiers (which you may or may not be aware of!) can
prevent
.Em hotkey
being triggered.