File: keyd-application-mapper.scdoc

package info (click to toggle)
keyd 2.5.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,524 kB
  • sloc: ansic: 5,206; python: 1,121; makefile: 114; javascript: 105; perl: 95; sh: 80
file content (100 lines) | stat: -rw-r--r-- 2,839 bytes parent folder | download | duplicates (2)
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
99
100
keyd-application-mapper(1)

# NAME

keyd-application-mapper - remap keys when window focus changes

# SYNOPSIS

*keyd-application-mapper* [*-d*]

# DESCRIPTION

A script which reads _~/.config/keyd/app.conf_ and applies the supplied
bindings whenever a window with a matching class comes into focus.

You can think of each section as a set of application specific masks applied
over the global rules defined in _/etc/keyd/\*.conf_.

The config file has the following form:

```
	[<filter>]

	<expression 1>
	<expression 2>
	...
```

Where _<filter>_ has one of the following forms:

	\[<class exp>\]              # Match by window class
	\[<class exp>|<title exp>\]  # Match by class and title

and each _<expression>_ is a valid argument to _keyd bind_ (see *Bindings*).

_<class exp>_ and _<title exp>_ are strings which describe window class and title names
to be matched, and may optionally contain unix style wildcards (\*). For example,
_[gnome|\*find\*]_ will match any window with a class of _gnome_ and a title
containing the substring _find_.

E.G:

```
	[kitty]

	alt.] = C-tab
	alt.[ = C-S-tab
	alt.t = C-S-t

	[st-*]

	alt.1  = macro(Inside space st)

	[chromium]

	control.1 = macro(Inside space chrome!)
	alt.] = C-tab
	alt.[ = C-S-tab
	alt.t = C-t
```

Will remap _A-1_ to the the string 'Inside st' when a window with a class
that begins with 'st-' (e.g st-256color) is active. 

Window class and title names can be obtained by inspecting the log output while the
daemon is running (e.g _tail\ -f\ ~/.config/keyd/app.log_). A reload may be triggered
by sending the script a USR1 signal.

At the moment X, Sway and Gnome are supported.

# INSTALLATION

Installation is a simple matter of running the command _keyd-application-mapper -d_
somewhere in your display server initialization logic (e.g _~/.xinitrc_ or
_~/.xsession_). If you are running Gnome, 
running _keyd-application-mapper_ for the first time will install an extension
which manages the script lifecycle.

In order for this to work, keyd must be running and the user must have access
to */var/run/keyd.socket* (i.e be a member of the *keyd* group). 

# ENVIRONMENT VARIABLES

*KEYD_DEBUG*
	Debug log level. _0_,_1_ can be specified (default: 0).

# A note on security

*Any user which can interact with a program that directly controls input devices
should be assumed to have full access to the system.*

While keyd offers slightly better isolation compared to other remappers by dint
of mediating access through an IPC mechanism (rather than granting users
blanket access to /dev/input/\* and /dev/uinput), it still provides an
opportunity for abuse and should be treated with due deference.

Specifically, access to */var/run/keyd.socket* should only be granted to
trusted users and the group _keyd_ should be regarded with the same reverence
as _wheel_.