├── .github
└── workflows
│ ├── check-and-lint.yaml
│ └── check-pr.yaml
├── .gitignore
├── 50-makima.rules
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
├── examples
├── config-keyboard.toml
├── config-mouse.toml
├── config-playstation.toml
├── config-ps2.toml
├── config-stadia.toml
├── config-switch.toml
└── config-xbox.toml
├── install.sh
├── makima.service
└── src
├── active_client.rs
├── config.rs
├── event_reader.rs
├── main.rs
├── udev_monitor.rs
└── virtual_devices.rs
/.github/workflows/check-and-lint.yaml:
--------------------------------------------------------------------------------
1 | on:
2 | push:
3 | branches:
4 | - main
5 |
6 | name: Check and Lint
7 |
8 | jobs:
9 | check:
10 | name: Check
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v4
14 | - name: Install Rust
15 | uses: dtolnay/rust-toolchain@stable
16 | - name: Install dependencies
17 | run: |
18 | sudo apt-get update
19 | sudo apt-get install -y libudev-dev
20 | - uses: Swatinem/rust-cache@v2
21 | - name: "cargo check"
22 | run: cargo check
23 |
24 | format:
25 | name: Format
26 | runs-on: ubuntu-latest
27 | steps:
28 | - uses: actions/checkout@v4
29 | - name: Install Rust
30 | uses: dtolnay/rust-toolchain@stable
31 | with:
32 | components: rustfmt
33 | - uses: Swatinem/rust-cache@v2
34 | - name: "cargo fmt"
35 | uses: mbrobbel/rustfmt-check@master
36 | with:
37 | token: ${{ secrets.GITHUB_TOKEN }}
38 |
39 | clippy:
40 | name: Clippy
41 | runs-on: ubuntu-latest
42 | steps:
43 | - uses: actions/checkout@v4
44 | - name: Install Rust
45 | uses: dtolnay/rust-toolchain@stable
46 | with:
47 | components: clippy
48 | - name: Install dependencies
49 | run: |
50 | sudo apt-get update
51 | sudo apt-get install -y libudev-dev
52 | - uses: Swatinem/rust-cache@v2
53 | - name: "cargo clippy"
54 | run: cargo clippy --all-features --workspace --tests --no-deps
55 |
--------------------------------------------------------------------------------
/.github/workflows/check-pr.yaml:
--------------------------------------------------------------------------------
1 | on: pull_request
2 |
3 | name: Check Pull Request
4 |
5 | jobs:
6 | format:
7 | name: Format
8 | runs-on: ubuntu-latest
9 | permissions:
10 | pull-requests: write
11 | steps:
12 | - uses: actions/checkout@v4
13 | - name: Install Rust
14 | uses: dtolnay/rust-toolchain@nightly
15 | with:
16 | components: rustfmt
17 | - name: "cargo fmt"
18 | uses: mbrobbel/rustfmt-check@master
19 | with:
20 | token: ${{ secrets.GITHUB_TOKEN }}
21 | mode: review
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated by Cargo
2 | # will have compiled files and executables
3 | debug/
4 | target/
5 |
6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
8 | #Cargo.lock
9 |
10 | # These are backup files generated by rustfmt
11 | **/*.rs.bk
12 |
13 | # MSVC Windows builds of rustc generate these, which store debugging information
14 | *.pdb
15 |
16 | # RustRover
17 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19 | # and can be added to the global gitignore or merged into this file. For a more nuclear
20 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
21 | #.idea/
22 |
--------------------------------------------------------------------------------
/50-makima.rules:
--------------------------------------------------------------------------------
1 | SUBSYSTEM=="misc", KERNEL=="uinput", MODE="0660", GROUP="input", TAG+="uaccess"
2 |
--------------------------------------------------------------------------------
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | version = 3
4 |
5 | [[package]]
6 | name = "addr2line"
7 | version = "0.21.0"
8 | source = "registry+https://github.com/rust-lang/crates.io-index"
9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
10 | dependencies = [
11 | "gimli",
12 | ]
13 |
14 | [[package]]
15 | name = "adler"
16 | version = "1.0.2"
17 | source = "registry+https://github.com/rust-lang/crates.io-index"
18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
19 |
20 | [[package]]
21 | name = "async-io"
22 | version = "1.13.0"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
25 | dependencies = [
26 | "async-lock 2.8.0",
27 | "autocfg",
28 | "cfg-if",
29 | "concurrent-queue",
30 | "futures-lite 1.13.0",
31 | "log",
32 | "parking",
33 | "polling 2.8.0",
34 | "rustix 0.37.27",
35 | "slab",
36 | "socket2 0.4.10",
37 | "waker-fn",
38 | ]
39 |
40 | [[package]]
41 | name = "async-io"
42 | version = "2.2.2"
43 | source = "registry+https://github.com/rust-lang/crates.io-index"
44 | checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7"
45 | dependencies = [
46 | "async-lock 3.2.0",
47 | "cfg-if",
48 | "concurrent-queue",
49 | "futures-io",
50 | "futures-lite 2.1.0",
51 | "parking",
52 | "polling 3.3.1",
53 | "rustix 0.38.28",
54 | "slab",
55 | "tracing",
56 | "windows-sys 0.52.0",
57 | ]
58 |
59 | [[package]]
60 | name = "async-lock"
61 | version = "2.8.0"
62 | source = "registry+https://github.com/rust-lang/crates.io-index"
63 | checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
64 | dependencies = [
65 | "event-listener 2.5.3",
66 | ]
67 |
68 | [[package]]
69 | name = "async-lock"
70 | version = "3.2.0"
71 | source = "registry+https://github.com/rust-lang/crates.io-index"
72 | checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c"
73 | dependencies = [
74 | "event-listener 4.0.1",
75 | "event-listener-strategy",
76 | "pin-project-lite",
77 | ]
78 |
79 | [[package]]
80 | name = "async-pidfd"
81 | version = "0.1.4"
82 | source = "registry+https://github.com/rust-lang/crates.io-index"
83 | checksum = "12177058299bb8e3507695941b6d0d7dc0e4e6515b8bc1bf4609d9e32ef51799"
84 | dependencies = [
85 | "async-io 1.13.0",
86 | "libc",
87 | ]
88 |
89 | [[package]]
90 | name = "autocfg"
91 | version = "1.1.0"
92 | source = "registry+https://github.com/rust-lang/crates.io-index"
93 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
94 |
95 | [[package]]
96 | name = "backtrace"
97 | version = "0.3.69"
98 | source = "registry+https://github.com/rust-lang/crates.io-index"
99 | checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
100 | dependencies = [
101 | "addr2line",
102 | "cc",
103 | "cfg-if",
104 | "libc",
105 | "miniz_oxide",
106 | "object",
107 | "rustc-demangle",
108 | ]
109 |
110 | [[package]]
111 | name = "bitflags"
112 | version = "1.3.2"
113 | source = "registry+https://github.com/rust-lang/crates.io-index"
114 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
115 |
116 | [[package]]
117 | name = "bitflags"
118 | version = "2.4.1"
119 | source = "registry+https://github.com/rust-lang/crates.io-index"
120 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
121 |
122 | [[package]]
123 | name = "bitvec"
124 | version = "1.0.1"
125 | source = "registry+https://github.com/rust-lang/crates.io-index"
126 | checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
127 | dependencies = [
128 | "funty",
129 | "radium",
130 | "tap",
131 | "wyz",
132 | ]
133 |
134 | [[package]]
135 | name = "bytes"
136 | version = "1.5.0"
137 | source = "registry+https://github.com/rust-lang/crates.io-index"
138 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
139 |
140 | [[package]]
141 | name = "cc"
142 | version = "1.0.83"
143 | source = "registry+https://github.com/rust-lang/crates.io-index"
144 | checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
145 | dependencies = [
146 | "libc",
147 | ]
148 |
149 | [[package]]
150 | name = "cfg-if"
151 | version = "1.0.0"
152 | source = "registry+https://github.com/rust-lang/crates.io-index"
153 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
154 |
155 | [[package]]
156 | name = "concurrent-queue"
157 | version = "2.4.0"
158 | source = "registry+https://github.com/rust-lang/crates.io-index"
159 | checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363"
160 | dependencies = [
161 | "crossbeam-utils",
162 | ]
163 |
164 | [[package]]
165 | name = "crossbeam-utils"
166 | version = "0.8.18"
167 | source = "registry+https://github.com/rust-lang/crates.io-index"
168 | checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c"
169 | dependencies = [
170 | "cfg-if",
171 | ]
172 |
173 | [[package]]
174 | name = "equivalent"
175 | version = "1.0.1"
176 | source = "registry+https://github.com/rust-lang/crates.io-index"
177 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
178 |
179 | [[package]]
180 | name = "errno"
181 | version = "0.3.8"
182 | source = "registry+https://github.com/rust-lang/crates.io-index"
183 | checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
184 | dependencies = [
185 | "libc",
186 | "windows-sys 0.52.0",
187 | ]
188 |
189 | [[package]]
190 | name = "evdev"
191 | version = "0.12.1"
192 | source = "registry+https://github.com/rust-lang/crates.io-index"
193 | checksum = "2bed59fcc8cfd6b190814a509018388462d3b203cf6dd10db5c00087e72a83f3"
194 | dependencies = [
195 | "bitvec",
196 | "cfg-if",
197 | "futures-core",
198 | "libc",
199 | "nix",
200 | "paste",
201 | "serde",
202 | "thiserror",
203 | "tokio",
204 | ]
205 |
206 | [[package]]
207 | name = "event-listener"
208 | version = "2.5.3"
209 | source = "registry+https://github.com/rust-lang/crates.io-index"
210 | checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
211 |
212 | [[package]]
213 | name = "event-listener"
214 | version = "4.0.1"
215 | source = "registry+https://github.com/rust-lang/crates.io-index"
216 | checksum = "84f2cdcf274580f2d63697192d744727b3198894b1bf02923643bf59e2c26712"
217 | dependencies = [
218 | "concurrent-queue",
219 | "parking",
220 | "pin-project-lite",
221 | ]
222 |
223 | [[package]]
224 | name = "event-listener-strategy"
225 | version = "0.4.0"
226 | source = "registry+https://github.com/rust-lang/crates.io-index"
227 | checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3"
228 | dependencies = [
229 | "event-listener 4.0.1",
230 | "pin-project-lite",
231 | ]
232 |
233 | [[package]]
234 | name = "fastrand"
235 | version = "1.9.0"
236 | source = "registry+https://github.com/rust-lang/crates.io-index"
237 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
238 | dependencies = [
239 | "instant",
240 | ]
241 |
242 | [[package]]
243 | name = "fastrand"
244 | version = "2.0.1"
245 | source = "registry+https://github.com/rust-lang/crates.io-index"
246 | checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
247 |
248 | [[package]]
249 | name = "fork"
250 | version = "0.1.23"
251 | source = "registry+https://github.com/rust-lang/crates.io-index"
252 | checksum = "60e74d3423998a57e9d906e49252fb79eb4a04d5cdfe188fb1b7ff9fc076a8ed"
253 | dependencies = [
254 | "libc",
255 | ]
256 |
257 | [[package]]
258 | name = "funty"
259 | version = "2.0.0"
260 | source = "registry+https://github.com/rust-lang/crates.io-index"
261 | checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
262 |
263 | [[package]]
264 | name = "futures-core"
265 | version = "0.3.30"
266 | source = "registry+https://github.com/rust-lang/crates.io-index"
267 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
268 |
269 | [[package]]
270 | name = "futures-io"
271 | version = "0.3.30"
272 | source = "registry+https://github.com/rust-lang/crates.io-index"
273 | checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
274 |
275 | [[package]]
276 | name = "futures-lite"
277 | version = "1.13.0"
278 | source = "registry+https://github.com/rust-lang/crates.io-index"
279 | checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
280 | dependencies = [
281 | "fastrand 1.9.0",
282 | "futures-core",
283 | "futures-io",
284 | "memchr",
285 | "parking",
286 | "pin-project-lite",
287 | "waker-fn",
288 | ]
289 |
290 | [[package]]
291 | name = "futures-lite"
292 | version = "2.1.0"
293 | source = "registry+https://github.com/rust-lang/crates.io-index"
294 | checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143"
295 | dependencies = [
296 | "fastrand 2.0.1",
297 | "futures-core",
298 | "futures-io",
299 | "parking",
300 | "pin-project-lite",
301 | ]
302 |
303 | [[package]]
304 | name = "gethostname"
305 | version = "0.4.3"
306 | source = "registry+https://github.com/rust-lang/crates.io-index"
307 | checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818"
308 | dependencies = [
309 | "libc",
310 | "windows-targets 0.48.5",
311 | ]
312 |
313 | [[package]]
314 | name = "gimli"
315 | version = "0.28.1"
316 | source = "registry+https://github.com/rust-lang/crates.io-index"
317 | checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
318 |
319 | [[package]]
320 | name = "hashbrown"
321 | version = "0.14.3"
322 | source = "registry+https://github.com/rust-lang/crates.io-index"
323 | checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
324 |
325 | [[package]]
326 | name = "hermit-abi"
327 | version = "0.3.3"
328 | source = "registry+https://github.com/rust-lang/crates.io-index"
329 | checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
330 |
331 | [[package]]
332 | name = "indexmap"
333 | version = "2.1.0"
334 | source = "registry+https://github.com/rust-lang/crates.io-index"
335 | checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
336 | dependencies = [
337 | "equivalent",
338 | "hashbrown",
339 | ]
340 |
341 | [[package]]
342 | name = "instant"
343 | version = "0.1.12"
344 | source = "registry+https://github.com/rust-lang/crates.io-index"
345 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
346 | dependencies = [
347 | "cfg-if",
348 | ]
349 |
350 | [[package]]
351 | name = "io-lifetimes"
352 | version = "1.0.11"
353 | source = "registry+https://github.com/rust-lang/crates.io-index"
354 | checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
355 | dependencies = [
356 | "hermit-abi",
357 | "libc",
358 | "windows-sys 0.48.0",
359 | ]
360 |
361 | [[package]]
362 | name = "itoa"
363 | version = "1.0.10"
364 | source = "registry+https://github.com/rust-lang/crates.io-index"
365 | checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
366 |
367 | [[package]]
368 | name = "libc"
369 | version = "0.2.151"
370 | source = "registry+https://github.com/rust-lang/crates.io-index"
371 | checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
372 |
373 | [[package]]
374 | name = "libudev-sys"
375 | version = "0.1.4"
376 | source = "registry+https://github.com/rust-lang/crates.io-index"
377 | checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324"
378 | dependencies = [
379 | "libc",
380 | "pkg-config",
381 | ]
382 |
383 | [[package]]
384 | name = "linux-raw-sys"
385 | version = "0.3.8"
386 | source = "registry+https://github.com/rust-lang/crates.io-index"
387 | checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
388 |
389 | [[package]]
390 | name = "linux-raw-sys"
391 | version = "0.4.12"
392 | source = "registry+https://github.com/rust-lang/crates.io-index"
393 | checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
394 |
395 | [[package]]
396 | name = "lock_api"
397 | version = "0.4.11"
398 | source = "registry+https://github.com/rust-lang/crates.io-index"
399 | checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
400 | dependencies = [
401 | "autocfg",
402 | "scopeguard",
403 | ]
404 |
405 | [[package]]
406 | name = "log"
407 | version = "0.4.20"
408 | source = "registry+https://github.com/rust-lang/crates.io-index"
409 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
410 |
411 | [[package]]
412 | name = "makima"
413 | version = "0.10.1"
414 | dependencies = [
415 | "evdev",
416 | "fork",
417 | "serde",
418 | "serde_json",
419 | "swayipc-async",
420 | "tokio",
421 | "tokio-stream",
422 | "tokio-udev",
423 | "toml",
424 | "x11rb",
425 | ]
426 |
427 | [[package]]
428 | name = "memchr"
429 | version = "2.6.4"
430 | source = "registry+https://github.com/rust-lang/crates.io-index"
431 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
432 |
433 | [[package]]
434 | name = "memoffset"
435 | version = "0.6.5"
436 | source = "registry+https://github.com/rust-lang/crates.io-index"
437 | checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
438 | dependencies = [
439 | "autocfg",
440 | ]
441 |
442 | [[package]]
443 | name = "miniz_oxide"
444 | version = "0.7.1"
445 | source = "registry+https://github.com/rust-lang/crates.io-index"
446 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
447 | dependencies = [
448 | "adler",
449 | ]
450 |
451 | [[package]]
452 | name = "mio"
453 | version = "0.8.10"
454 | source = "registry+https://github.com/rust-lang/crates.io-index"
455 | checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
456 | dependencies = [
457 | "libc",
458 | "wasi",
459 | "windows-sys 0.48.0",
460 | ]
461 |
462 | [[package]]
463 | name = "nix"
464 | version = "0.23.2"
465 | source = "registry+https://github.com/rust-lang/crates.io-index"
466 | checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c"
467 | dependencies = [
468 | "bitflags 1.3.2",
469 | "cc",
470 | "cfg-if",
471 | "libc",
472 | "memoffset",
473 | ]
474 |
475 | [[package]]
476 | name = "num_cpus"
477 | version = "1.16.0"
478 | source = "registry+https://github.com/rust-lang/crates.io-index"
479 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
480 | dependencies = [
481 | "hermit-abi",
482 | "libc",
483 | ]
484 |
485 | [[package]]
486 | name = "object"
487 | version = "0.32.1"
488 | source = "registry+https://github.com/rust-lang/crates.io-index"
489 | checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
490 | dependencies = [
491 | "memchr",
492 | ]
493 |
494 | [[package]]
495 | name = "parking"
496 | version = "2.2.0"
497 | source = "registry+https://github.com/rust-lang/crates.io-index"
498 | checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
499 |
500 | [[package]]
501 | name = "parking_lot"
502 | version = "0.12.1"
503 | source = "registry+https://github.com/rust-lang/crates.io-index"
504 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
505 | dependencies = [
506 | "lock_api",
507 | "parking_lot_core",
508 | ]
509 |
510 | [[package]]
511 | name = "parking_lot_core"
512 | version = "0.9.9"
513 | source = "registry+https://github.com/rust-lang/crates.io-index"
514 | checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
515 | dependencies = [
516 | "cfg-if",
517 | "libc",
518 | "redox_syscall",
519 | "smallvec",
520 | "windows-targets 0.48.5",
521 | ]
522 |
523 | [[package]]
524 | name = "paste"
525 | version = "1.0.14"
526 | source = "registry+https://github.com/rust-lang/crates.io-index"
527 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
528 |
529 | [[package]]
530 | name = "pin-project-lite"
531 | version = "0.2.13"
532 | source = "registry+https://github.com/rust-lang/crates.io-index"
533 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
534 |
535 | [[package]]
536 | name = "pkg-config"
537 | version = "0.3.27"
538 | source = "registry+https://github.com/rust-lang/crates.io-index"
539 | checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
540 |
541 | [[package]]
542 | name = "polling"
543 | version = "2.8.0"
544 | source = "registry+https://github.com/rust-lang/crates.io-index"
545 | checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
546 | dependencies = [
547 | "autocfg",
548 | "bitflags 1.3.2",
549 | "cfg-if",
550 | "concurrent-queue",
551 | "libc",
552 | "log",
553 | "pin-project-lite",
554 | "windows-sys 0.48.0",
555 | ]
556 |
557 | [[package]]
558 | name = "polling"
559 | version = "3.3.1"
560 | source = "registry+https://github.com/rust-lang/crates.io-index"
561 | checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e"
562 | dependencies = [
563 | "cfg-if",
564 | "concurrent-queue",
565 | "pin-project-lite",
566 | "rustix 0.38.28",
567 | "tracing",
568 | "windows-sys 0.52.0",
569 | ]
570 |
571 | [[package]]
572 | name = "proc-macro2"
573 | version = "1.0.82"
574 | source = "registry+https://github.com/rust-lang/crates.io-index"
575 | checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
576 | dependencies = [
577 | "unicode-ident",
578 | ]
579 |
580 | [[package]]
581 | name = "quote"
582 | version = "1.0.36"
583 | source = "registry+https://github.com/rust-lang/crates.io-index"
584 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
585 | dependencies = [
586 | "proc-macro2",
587 | ]
588 |
589 | [[package]]
590 | name = "radium"
591 | version = "0.7.0"
592 | source = "registry+https://github.com/rust-lang/crates.io-index"
593 | checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
594 |
595 | [[package]]
596 | name = "redox_syscall"
597 | version = "0.4.1"
598 | source = "registry+https://github.com/rust-lang/crates.io-index"
599 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
600 | dependencies = [
601 | "bitflags 1.3.2",
602 | ]
603 |
604 | [[package]]
605 | name = "rustc-demangle"
606 | version = "0.1.23"
607 | source = "registry+https://github.com/rust-lang/crates.io-index"
608 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
609 |
610 | [[package]]
611 | name = "rustix"
612 | version = "0.37.27"
613 | source = "registry+https://github.com/rust-lang/crates.io-index"
614 | checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2"
615 | dependencies = [
616 | "bitflags 1.3.2",
617 | "errno",
618 | "io-lifetimes",
619 | "libc",
620 | "linux-raw-sys 0.3.8",
621 | "windows-sys 0.48.0",
622 | ]
623 |
624 | [[package]]
625 | name = "rustix"
626 | version = "0.38.28"
627 | source = "registry+https://github.com/rust-lang/crates.io-index"
628 | checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
629 | dependencies = [
630 | "bitflags 2.4.1",
631 | "errno",
632 | "libc",
633 | "linux-raw-sys 0.4.12",
634 | "windows-sys 0.52.0",
635 | ]
636 |
637 | [[package]]
638 | name = "ryu"
639 | version = "1.0.16"
640 | source = "registry+https://github.com/rust-lang/crates.io-index"
641 | checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
642 |
643 | [[package]]
644 | name = "scopeguard"
645 | version = "1.2.0"
646 | source = "registry+https://github.com/rust-lang/crates.io-index"
647 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
648 |
649 | [[package]]
650 | name = "serde"
651 | version = "1.0.201"
652 | source = "registry+https://github.com/rust-lang/crates.io-index"
653 | checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c"
654 | dependencies = [
655 | "serde_derive",
656 | ]
657 |
658 | [[package]]
659 | name = "serde_derive"
660 | version = "1.0.201"
661 | source = "registry+https://github.com/rust-lang/crates.io-index"
662 | checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865"
663 | dependencies = [
664 | "proc-macro2",
665 | "quote",
666 | "syn",
667 | ]
668 |
669 | [[package]]
670 | name = "serde_json"
671 | version = "1.0.117"
672 | source = "registry+https://github.com/rust-lang/crates.io-index"
673 | checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
674 | dependencies = [
675 | "itoa",
676 | "ryu",
677 | "serde",
678 | ]
679 |
680 | [[package]]
681 | name = "serde_spanned"
682 | version = "0.6.4"
683 | source = "registry+https://github.com/rust-lang/crates.io-index"
684 | checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80"
685 | dependencies = [
686 | "serde",
687 | ]
688 |
689 | [[package]]
690 | name = "signal-hook-registry"
691 | version = "1.4.1"
692 | source = "registry+https://github.com/rust-lang/crates.io-index"
693 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
694 | dependencies = [
695 | "libc",
696 | ]
697 |
698 | [[package]]
699 | name = "slab"
700 | version = "0.4.9"
701 | source = "registry+https://github.com/rust-lang/crates.io-index"
702 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
703 | dependencies = [
704 | "autocfg",
705 | ]
706 |
707 | [[package]]
708 | name = "smallvec"
709 | version = "1.11.2"
710 | source = "registry+https://github.com/rust-lang/crates.io-index"
711 | checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
712 |
713 | [[package]]
714 | name = "socket2"
715 | version = "0.4.10"
716 | source = "registry+https://github.com/rust-lang/crates.io-index"
717 | checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
718 | dependencies = [
719 | "libc",
720 | "winapi",
721 | ]
722 |
723 | [[package]]
724 | name = "socket2"
725 | version = "0.5.5"
726 | source = "registry+https://github.com/rust-lang/crates.io-index"
727 | checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
728 | dependencies = [
729 | "libc",
730 | "windows-sys 0.48.0",
731 | ]
732 |
733 | [[package]]
734 | name = "swayipc-async"
735 | version = "2.0.2"
736 | source = "registry+https://github.com/rust-lang/crates.io-index"
737 | checksum = "88402637af375c2b9db4b92bdd6dc6cd80d51f441216aae457e58bacb93cdbfb"
738 | dependencies = [
739 | "async-io 2.2.2",
740 | "async-pidfd",
741 | "futures-lite 2.1.0",
742 | "serde",
743 | "serde_json",
744 | "swayipc-types",
745 | ]
746 |
747 | [[package]]
748 | name = "swayipc-types"
749 | version = "1.3.1"
750 | source = "registry+https://github.com/rust-lang/crates.io-index"
751 | checksum = "b1b62656428f36fd561f13aff70386b891fc6f67db24ecccf72a49655d6c9fbb"
752 | dependencies = [
753 | "serde",
754 | "serde_json",
755 | "thiserror",
756 | ]
757 |
758 | [[package]]
759 | name = "syn"
760 | version = "2.0.61"
761 | source = "registry+https://github.com/rust-lang/crates.io-index"
762 | checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9"
763 | dependencies = [
764 | "proc-macro2",
765 | "quote",
766 | "unicode-ident",
767 | ]
768 |
769 | [[package]]
770 | name = "tap"
771 | version = "1.0.1"
772 | source = "registry+https://github.com/rust-lang/crates.io-index"
773 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
774 |
775 | [[package]]
776 | name = "thiserror"
777 | version = "1.0.51"
778 | source = "registry+https://github.com/rust-lang/crates.io-index"
779 | checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
780 | dependencies = [
781 | "thiserror-impl",
782 | ]
783 |
784 | [[package]]
785 | name = "thiserror-impl"
786 | version = "1.0.51"
787 | source = "registry+https://github.com/rust-lang/crates.io-index"
788 | checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
789 | dependencies = [
790 | "proc-macro2",
791 | "quote",
792 | "syn",
793 | ]
794 |
795 | [[package]]
796 | name = "tokio"
797 | version = "1.35.0"
798 | source = "registry+https://github.com/rust-lang/crates.io-index"
799 | checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c"
800 | dependencies = [
801 | "backtrace",
802 | "bytes",
803 | "libc",
804 | "mio",
805 | "num_cpus",
806 | "parking_lot",
807 | "pin-project-lite",
808 | "signal-hook-registry",
809 | "socket2 0.5.5",
810 | "tokio-macros",
811 | "windows-sys 0.48.0",
812 | ]
813 |
814 | [[package]]
815 | name = "tokio-macros"
816 | version = "2.2.0"
817 | source = "registry+https://github.com/rust-lang/crates.io-index"
818 | checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
819 | dependencies = [
820 | "proc-macro2",
821 | "quote",
822 | "syn",
823 | ]
824 |
825 | [[package]]
826 | name = "tokio-stream"
827 | version = "0.1.14"
828 | source = "registry+https://github.com/rust-lang/crates.io-index"
829 | checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
830 | dependencies = [
831 | "futures-core",
832 | "pin-project-lite",
833 | "tokio",
834 | ]
835 |
836 | [[package]]
837 | name = "tokio-udev"
838 | version = "0.9.1"
839 | source = "registry+https://github.com/rust-lang/crates.io-index"
840 | checksum = "f25418da261774ef3dcae985951bc138cf5fd49b3f4bd7450124ca75af8ed142"
841 | dependencies = [
842 | "futures-core",
843 | "tokio",
844 | "udev",
845 | ]
846 |
847 | [[package]]
848 | name = "toml"
849 | version = "0.7.8"
850 | source = "registry+https://github.com/rust-lang/crates.io-index"
851 | checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257"
852 | dependencies = [
853 | "serde",
854 | "serde_spanned",
855 | "toml_datetime",
856 | "toml_edit",
857 | ]
858 |
859 | [[package]]
860 | name = "toml_datetime"
861 | version = "0.6.5"
862 | source = "registry+https://github.com/rust-lang/crates.io-index"
863 | checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
864 | dependencies = [
865 | "serde",
866 | ]
867 |
868 | [[package]]
869 | name = "toml_edit"
870 | version = "0.19.15"
871 | source = "registry+https://github.com/rust-lang/crates.io-index"
872 | checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
873 | dependencies = [
874 | "indexmap",
875 | "serde",
876 | "serde_spanned",
877 | "toml_datetime",
878 | "winnow",
879 | ]
880 |
881 | [[package]]
882 | name = "tracing"
883 | version = "0.1.40"
884 | source = "registry+https://github.com/rust-lang/crates.io-index"
885 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
886 | dependencies = [
887 | "pin-project-lite",
888 | "tracing-core",
889 | ]
890 |
891 | [[package]]
892 | name = "tracing-core"
893 | version = "0.1.32"
894 | source = "registry+https://github.com/rust-lang/crates.io-index"
895 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
896 |
897 | [[package]]
898 | name = "udev"
899 | version = "0.7.0"
900 | source = "registry+https://github.com/rust-lang/crates.io-index"
901 | checksum = "4ebdbbd670373442a12fe9ef7aeb53aec4147a5a27a00bbc3ab639f08f48191a"
902 | dependencies = [
903 | "libc",
904 | "libudev-sys",
905 | "pkg-config",
906 | ]
907 |
908 | [[package]]
909 | name = "unicode-ident"
910 | version = "1.0.12"
911 | source = "registry+https://github.com/rust-lang/crates.io-index"
912 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
913 |
914 | [[package]]
915 | name = "waker-fn"
916 | version = "1.1.1"
917 | source = "registry+https://github.com/rust-lang/crates.io-index"
918 | checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690"
919 |
920 | [[package]]
921 | name = "wasi"
922 | version = "0.11.0+wasi-snapshot-preview1"
923 | source = "registry+https://github.com/rust-lang/crates.io-index"
924 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
925 |
926 | [[package]]
927 | name = "winapi"
928 | version = "0.3.9"
929 | source = "registry+https://github.com/rust-lang/crates.io-index"
930 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
931 | dependencies = [
932 | "winapi-i686-pc-windows-gnu",
933 | "winapi-x86_64-pc-windows-gnu",
934 | ]
935 |
936 | [[package]]
937 | name = "winapi-i686-pc-windows-gnu"
938 | version = "0.4.0"
939 | source = "registry+https://github.com/rust-lang/crates.io-index"
940 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
941 |
942 | [[package]]
943 | name = "winapi-x86_64-pc-windows-gnu"
944 | version = "0.4.0"
945 | source = "registry+https://github.com/rust-lang/crates.io-index"
946 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
947 |
948 | [[package]]
949 | name = "windows-sys"
950 | version = "0.48.0"
951 | source = "registry+https://github.com/rust-lang/crates.io-index"
952 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
953 | dependencies = [
954 | "windows-targets 0.48.5",
955 | ]
956 |
957 | [[package]]
958 | name = "windows-sys"
959 | version = "0.52.0"
960 | source = "registry+https://github.com/rust-lang/crates.io-index"
961 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
962 | dependencies = [
963 | "windows-targets 0.52.0",
964 | ]
965 |
966 | [[package]]
967 | name = "windows-targets"
968 | version = "0.48.5"
969 | source = "registry+https://github.com/rust-lang/crates.io-index"
970 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
971 | dependencies = [
972 | "windows_aarch64_gnullvm 0.48.5",
973 | "windows_aarch64_msvc 0.48.5",
974 | "windows_i686_gnu 0.48.5",
975 | "windows_i686_msvc 0.48.5",
976 | "windows_x86_64_gnu 0.48.5",
977 | "windows_x86_64_gnullvm 0.48.5",
978 | "windows_x86_64_msvc 0.48.5",
979 | ]
980 |
981 | [[package]]
982 | name = "windows-targets"
983 | version = "0.52.0"
984 | source = "registry+https://github.com/rust-lang/crates.io-index"
985 | checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
986 | dependencies = [
987 | "windows_aarch64_gnullvm 0.52.0",
988 | "windows_aarch64_msvc 0.52.0",
989 | "windows_i686_gnu 0.52.0",
990 | "windows_i686_msvc 0.52.0",
991 | "windows_x86_64_gnu 0.52.0",
992 | "windows_x86_64_gnullvm 0.52.0",
993 | "windows_x86_64_msvc 0.52.0",
994 | ]
995 |
996 | [[package]]
997 | name = "windows_aarch64_gnullvm"
998 | version = "0.48.5"
999 | source = "registry+https://github.com/rust-lang/crates.io-index"
1000 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
1001 |
1002 | [[package]]
1003 | name = "windows_aarch64_gnullvm"
1004 | version = "0.52.0"
1005 | source = "registry+https://github.com/rust-lang/crates.io-index"
1006 | checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
1007 |
1008 | [[package]]
1009 | name = "windows_aarch64_msvc"
1010 | version = "0.48.5"
1011 | source = "registry+https://github.com/rust-lang/crates.io-index"
1012 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
1013 |
1014 | [[package]]
1015 | name = "windows_aarch64_msvc"
1016 | version = "0.52.0"
1017 | source = "registry+https://github.com/rust-lang/crates.io-index"
1018 | checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
1019 |
1020 | [[package]]
1021 | name = "windows_i686_gnu"
1022 | version = "0.48.5"
1023 | source = "registry+https://github.com/rust-lang/crates.io-index"
1024 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
1025 |
1026 | [[package]]
1027 | name = "windows_i686_gnu"
1028 | version = "0.52.0"
1029 | source = "registry+https://github.com/rust-lang/crates.io-index"
1030 | checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
1031 |
1032 | [[package]]
1033 | name = "windows_i686_msvc"
1034 | version = "0.48.5"
1035 | source = "registry+https://github.com/rust-lang/crates.io-index"
1036 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
1037 |
1038 | [[package]]
1039 | name = "windows_i686_msvc"
1040 | version = "0.52.0"
1041 | source = "registry+https://github.com/rust-lang/crates.io-index"
1042 | checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
1043 |
1044 | [[package]]
1045 | name = "windows_x86_64_gnu"
1046 | version = "0.48.5"
1047 | source = "registry+https://github.com/rust-lang/crates.io-index"
1048 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
1049 |
1050 | [[package]]
1051 | name = "windows_x86_64_gnu"
1052 | version = "0.52.0"
1053 | source = "registry+https://github.com/rust-lang/crates.io-index"
1054 | checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
1055 |
1056 | [[package]]
1057 | name = "windows_x86_64_gnullvm"
1058 | version = "0.48.5"
1059 | source = "registry+https://github.com/rust-lang/crates.io-index"
1060 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
1061 |
1062 | [[package]]
1063 | name = "windows_x86_64_gnullvm"
1064 | version = "0.52.0"
1065 | source = "registry+https://github.com/rust-lang/crates.io-index"
1066 | checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
1067 |
1068 | [[package]]
1069 | name = "windows_x86_64_msvc"
1070 | version = "0.48.5"
1071 | source = "registry+https://github.com/rust-lang/crates.io-index"
1072 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
1073 |
1074 | [[package]]
1075 | name = "windows_x86_64_msvc"
1076 | version = "0.52.0"
1077 | source = "registry+https://github.com/rust-lang/crates.io-index"
1078 | checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
1079 |
1080 | [[package]]
1081 | name = "winnow"
1082 | version = "0.5.28"
1083 | source = "registry+https://github.com/rust-lang/crates.io-index"
1084 | checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2"
1085 | dependencies = [
1086 | "memchr",
1087 | ]
1088 |
1089 | [[package]]
1090 | name = "wyz"
1091 | version = "0.5.1"
1092 | source = "registry+https://github.com/rust-lang/crates.io-index"
1093 | checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
1094 | dependencies = [
1095 | "tap",
1096 | ]
1097 |
1098 | [[package]]
1099 | name = "x11rb"
1100 | version = "0.13.0"
1101 | source = "registry+https://github.com/rust-lang/crates.io-index"
1102 | checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a"
1103 | dependencies = [
1104 | "gethostname",
1105 | "rustix 0.38.28",
1106 | "x11rb-protocol",
1107 | ]
1108 |
1109 | [[package]]
1110 | name = "x11rb-protocol"
1111 | version = "0.13.0"
1112 | source = "registry+https://github.com/rust-lang/crates.io-index"
1113 | checksum = "e63e71c4b8bd9ffec2c963173a4dc4cbde9ee96961d4fcb4429db9929b606c34"
1114 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "makima"
3 | version = "0.10.1"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | evdev = { version = "0.12.1", features = ["tokio", "serde"] }
8 | tokio = { version = "1.28.1", features = ["full"] }
9 | serde = { version = "1.0.163", features = ["derive"] }
10 | serde_json = "1.0.117"
11 | tokio-stream = "0.1.14"
12 | tokio-udev = "0.9.1"
13 | swayipc-async = "2.0.2"
14 | x11rb = "0.13.0"
15 | toml = "0.7.3"
16 | fork = "0.1.23"
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # makima
2 |
3 | Makima is a daemon for Linux to remap keyboards, mice, controllers and tablets.\
4 | It works on both Wayland and X11 as it relies on the `evdev` kernel interface.
5 |
6 | ## Features
7 | - Translates keys, buttons or combinations to other keys, sequences or shell commands.
8 | - Devices are remapped individually using simple TOML config files.
9 | - Automatically switch layouts based on the active window (only on Hyprland, Sway, Niri and X11 currently).
10 | - Works with keyboards, mice, controllers, tablets and any other device that uses `KEY`/`BTN` input events present inside `/usr/include/linux/input-event-codes.h`.
11 | - Also supports some common `ABS` and `REL` events, like analog stick movements and mouse scroll wheels.
12 | - Supports hot plugging to connect and disconnect devices on the fly.
13 | - Works with wired and Bluetooth devices.
14 | - If you connect a [supported game controller](https://github.com/cyber-sushi/makima/tree/main#tested-controllers), you can scroll or move your cursor using analog sticks, with adjustable sensitivity and deadzone.
15 |
16 | # Index
17 | - [Installation](https://github.com/cyber-sushi/makima/tree/main#installation)
18 | - [Building from source](https://github.com/cyber-sushi/makima/tree/main#building-from-source)
19 | - [Running makima](https://github.com/cyber-sushi/makima/tree/main#running-makima)
20 | - [Configuration](https://github.com/cyber-sushi/makima/tree/main#configuration)
21 | - [Example config files](https://github.com/cyber-sushi/makima/tree/main/examples)
22 | - [Config file naming](https://github.com/cyber-sushi/makima/tree/main#config-file-naming)
23 | - [Application-specific bindings](https://github.com/cyber-sushi/makima/tree/main#application-specific-bindings)
24 | - [Layout hotswapping](https://github.com/cyber-sushi/makima/tree/main#layout-hotswapping)
25 | - [Change bindings](https://github.com/cyber-sushi/makima/tree/main#bindings-and-settings)
26 | - [Remap](https://github.com/cyber-sushi/makima/tree/main#remap)
27 | - [Commands](https://github.com/cyber-sushi/makima/tree/main#commands)
28 | - [Movements](https://github.com/cyber-sushi/makima/tree/main#movements)
29 | - [Settings](https://github.com/cyber-sushi/makima/tree/main#settings)
30 | - [Tested controllers](https://github.com/cyber-sushi/makima/tree/main#tested-controllers)
31 | - [Troubleshooting and FAQ](https://github.com/cyber-sushi/makima/tree/main#troubleshooting-and-faq)
32 |
33 | ## Installation
34 | Makima can be installed automatically or manually.\
35 | **To install and run Makima automatically as a systemd service:**
36 | - Download the executable from the [Releases page](https://github.com/cyber-sushi/makima/releases).
37 | - Retrieve `install.sh`, `makima.service` and _optionally_ `50-makima.rules` from this repo and put them in the same folder as the executable.
38 | - Make sure that `install.sh` is executable (`chmod +x ./install.sh` or right click > properties > execute as a program).
39 | - Run `sudo ./install.sh username` where `username` is the name of the user you're installing it for.
40 | - Skip the rest of the "Installation" and "Running Makima" paragraphs and go directly to "Configuration".
41 |
42 | **To install and run Makima manually, refer to the following paragraphs.**
43 |
44 | #### Building from source
45 | 1. Install `rustup` using your distro's package manager or refer to the [official docs](https://www.rust-lang.org/tools/install) if your distro doesn't ship `rustup`.
46 | 2. Run `rustup default stable` which will automatically install Cargo (Rust's package manager) and the Rust toolchain.
47 | 3. Git clone and build with:
48 | ```
49 | git clone https://github.com/cyber-sushi/makima
50 | cd makima
51 | cargo build --release
52 | ```
53 | Once Cargo is done compiling, you should find Makima's executable inside `~/makima/target/release/`.
54 |
55 | ## Running Makima
56 | Make sure that the executable has permissions to run as a program with `chmod +x makima` or with Right Click > Properties > "allow executing as program" or something like that, depending on your file manager.
57 |
58 | There are two recommended ways to execute Makima:
59 | - **Run Makima as a systemd service.**\
60 | Move the executable into `/usr/bin/`.\
61 | Grab `makima.service` from this repo and edit the `User=` line with your username.\
62 | Move the file into `/etc/systemd/system`, then run `systemctl daemon-reload`.\
63 | After this, you can start and stop Makima with `systemctl start/stop makima` or you can enable/disable it on startup with `systemctl enable/disable makima`. If you change the config files and you want the changes to take place, restart Makima with `systemctl restart makima`.
64 |
65 | > [!NOTE]
66 | > When running as a systemd service, Makima inherits your systemd user environment, not your shell environment (you can see it with `systemctl --user show-environment`). If you need to pass env variables to it, do so by adding them to the unit file with `Environment=VARIABLE=value`.
67 |
68 | - **Run Makima as root with `sudo -E makima`.**\
69 | Navigate into the directory of the executable and use `sudo -E ./makima`.\
70 | Alternatively, add Makima to a directory that's in `PATH`, possibly `/usr/bin` or `~/.local/bin` and simply use `sudo -E makima` from anywhere.
71 |
72 | > [!NOTE]
73 | > The `-E` argument is necessary because it allows Makima to inherit your user environment instead of the root environment when running with `sudo`. You can also add the `-b` argument (`sudo -Eb makima`) to detach if from the terminal and make it run in the background.
74 |
75 | ## Configuration
76 | You can find a bunch of [example config files](https://github.com/cyber-sushi/makima/tree/main/examples) on this repo, either pick one of them or create your own from scratch.\
77 | Makima's config directory defaults to `$HOME/.config/makima` but can be changed through the `MAKIMA_CONFIG` environment variable (if you run Makima as a system service, add it directly to the systemd unit).\
78 | Each time you make changes to the config file, Makima must be restarted with `systemctl restart makima`.
79 |
80 | ### Config file naming
81 | To associate a config file to an input device, the file name should be identical to that of the device, plus `.toml` at the end. If your device's name includes a `/`, just omit it.
82 |
83 | All config files will be parsed automatically when `makima` is launched.\
84 | Files that don't end with `.toml` and files that start with `.` (dotfiles) won't be parsed, so you can add a dot at the beginning of the filename to mask them from Makima.
85 |
86 | > [!TIP]
87 | > Example: you run `evtest` and see that your Dualshock 4 controller is named `Sony Interactive Entertainment Wireless Controller`. All you have to do is rename your config file to `Sony Interactive Entertainment Wireless Controller.toml`.
88 |
89 | ### Application-specific bindings
90 | To apply a config file only to a specific application, just put `::` at the end of their filename, before `.toml`.
91 |
92 | > [!TIP]
93 | > Example: you want your DS4 controller to have a specific set of keybindings for Firefox, name that file `Sony Interactive Entertainment Wireless Controller::firefox.toml`.\
94 | > To retrieve the window class of a specific application, refer to your compositor's documentation, e.g. on Hyprland type `hyprctl clients` in your terminal while that application is open.
95 |
96 |
97 | > [!IMPORTANT]
98 | > App-specific bindings are currently only supported on Hyprland, Sway, Niri, Plasma Wayland and all X11 sessions.\
99 | > Some applications, like Flatpaks for example, will have names like `org.mozilla.firefox`.\
100 | > On Wayland, make sure that the `XDG_CURRENT_DESKTOP` environment variable is set, othewise Makima won't be able to use application-specific bindings.
101 | >
102 | > On Plasma Wayland, Makima uses `kdotool` ([Github repo](https://github.com/jinliu/kdotool) or [AUR package](https://aur.archlinux.org/packages/kdotool-git)) to retrieve the active window instead of doing so internally, which means that you also need that installed. Sorry about this, but I didn't want to hardcode JavaScript snippets inside of Makima just to communicate with KWin.
103 |
104 | > [!WARNING]
105 | > It's been reported that active window retrieval through `kdotool` on Plasma might introduce performance issues, if you experience problems, remove `kdotool`'s executable from `PATH` until I figure out how a solution.
106 |
107 | ### Layout hotswapping
108 | To declare multiple layouts, similarly to app-specific bindings, put `::` at the end of a config file, where `int` is an integer value between 0 and 3, representing the layout number. If not specified, Makima will assume 0.\
109 | When pressing the key configured in the settings through the `LAYOUT_SWITCHER` parameter, Makima will automatically cycle through the available layouts. If a layout isn't set, e.g. you're on 0 and you switch to the next layout, but number 1 isn't found, Makima will automatically skip to layout 2 and so on.\
110 | You can also combine layouts and per application bindings by simply putting them both in the config file name.
111 |
112 | > [!TIP]
113 | > Example: declare layout 2 in Nautilus by setting `Wireless Controller::2::org.gnome.Nautilus.toml` or `Wireless Controller::org.gnome.Nautilus::2.toml`.
114 |
115 | > [!NOTE]
116 | > Keep in mind that while bindings and commands are read from each config file independently, settings are only read from the main config file, the one with no layout and associated application specified. If such file isn't present, Makima will use the default values.
117 |
118 | ## Bindings and settings
119 | The config file is divided into multiple sections:
120 | - `[remap]`, where you can rebind keys, buttons, combinations and some axis events to other keys, buttons and combinations.
121 | - `[commands]`, where you can rebind keys, buttons, combinations and some axis events to shell commands.
122 | - `[movements]`, where you can rebind keys, buttons, combinations and some axis events to cursor movements and scrolling.
123 | - `[settings]`, where you can configure a few settings.
124 |
125 | ### **[remap]**
126 | ```
127 | # Remap a key to another key
128 | KEY1 = ["KEY2"]
129 |
130 | # Remap a key to a key sequence
131 | KEY1 = ["KEY2", "KEY3", "KEY4"]
132 |
133 | # Remap a key sequence to a single key
134 | MODIFIER1-MODIFIER2-MODIFIER3-KEY1 = ["KEY1"]
135 |
136 | # Remap a key sequence to another key sequence
137 | MODIFIER1-MODIFIER2-MODIFIER3-KEY1 = ["KEY1", "KEY2", "KEY3"]
138 | ```
139 |
140 | ### **[commands]**
141 | ```
142 | # Use a key to invoke a shell command
143 | KEY1 = ["command1"]
144 |
145 | # Use a key to invoke a list of shell commands
146 | KEY1 = ["command1", "command2", "command3"]
147 |
148 | # Use a key sequence to invoke a shell command
149 | MODIFIER1-MODIFIER2-MODIFIER3-KEY1 = ["command1"]
150 |
151 | # Use a key sequence to invoke a list of shell commands
152 | MODIFIER1-MODIFIER2-MODIFIER3-KEY1 = ["command1", "command2", "command3"]
153 | ```
154 |
155 | ### **[movements]**
156 | ```
157 | # Use a key to move the cursor in a direction
158 | KEY1 = "CURSOR_UP/DOWN/LEFT/RIGHT"
159 |
160 | # Use a key sequence to move the cursor in a direction
161 | MODIFIER1-MODIFIER2-MODIFIER3-KEY1 = "CURSOR_UP/DOWN/LEFT/RIGHT"
162 |
163 | # Use a key to scroll in a direction
164 | KEY1 = "SCROLL_UP/DOWN/LEFT/RIGHT"
165 |
166 | # Use a key sequence to scroll in a direction
167 | MODIFIER1-MODIFIER2-MODIFIER3-KEY1 = "SCROLL_UP/DOWN/LEFT/RIGHT"
168 | ```
169 |
170 | #### Movement events
171 | There are 8 available movements available:\
172 | - `CURSOR_UP`, `CURSOR_DOWN`, `CURSOR_LEFT`, `CURSOR_RIGHT`
173 | - `SCROLL_UP`, `SCROLL_DOWN`, `SCROLL_LEFT`, `SCROLL_RIGHT`
174 |
175 | > [!NOTE]
176 | > To make movements work, you also have to set a speed value using `CURSOR_SPEED` or `SCROLL_SPEED` in the `[settings]` section.
177 |
178 | > [!NOTE]
179 | > It's preferable not to use CTRL and ALT as modifiers for scrolling because they'll get interpreted by the application as zoom in/out and forward/back instead of an actual scroll movement.
180 |
181 | #### Key names:
182 | You can find the `KEY` names inside `/usr/include/linux/input-event-codes.h`, or launch `evtest` to see the events emitted by your devices.\
183 | Remember that keys like Ctrl and Alt have names like `KEY_LEFTCTRL`, `KEY_LEFTALT` etc. Just using `KEY_CTRL` and `KEY_ALT` will throw a parsing error because the key code does not exist.
184 |
185 | #### Axis events:
186 | Axis events such as scroll wheels and analog stick movements are hardcoded, currently you can use the following:
187 | - `SCROLL_WHEEL_UP`, `SCROLL_WHEEL_DOWN` - for a mouse's scroll wheel
188 | - `BTN_DPAD_UP`, `BTN_DPAD_DOWN`, `BTN_DPAD_LEFT`, `BTN_DPAD_RIGHT` - for a game controller's D-Pad
189 | - `BTN_TL2`, `BTN_TR2` - for a game controller's triggers, respectively left and right
190 | - `LSTICK_UP`, `LSTICK_DOWN`, `LSTICK_LEFT`, `LSTICK_RIGHT`, `RSTICK_UP`, `RSTICK_DOWN`, `RSTICK_LEFT`, `RSTICK_RIGHT` - for a game controller's analog sticks
191 | - `ABS_WHEEL_CW`, `ABS_WHEEL_CCW` - for a tablet's wheel, respectively clockwise and counterclockwise
192 |
193 | Refer to the [sample config files](https://github.com/cyber-sushi/makima/tree/main/examples) for more information.
194 |
195 | #### Modifiers and custom modifiers:
196 | You can use as many modifiers as you want when declaring a binding, but the last key _has_ to be a non-modifier key.
197 |
198 | Non-modifier keys (e.g. `KEY_A`) can be set in place of a modifier, automatically changing the behavior of that key: when used in combination with other keys, it will only act as a modifier, but when used alone, it will retain its default functionality, although the input event will be dispatched on key-up instead of key-down.
199 |
200 | If you want a non-modifier key to act as a modifier without remapping it for that device (e.g. you need it as a modifier when used in combination with another device), you can add it to the `CUSTOM_MODIFIERS` setting. Refer to the `[settings]` section for more info.
201 |
202 | #### Modifiers across multiple devices:
203 | Keep in mind that if you want to use modifiers across multiple devices (e.g. `KEY_LEFTCTRL` on your keyboard and `BTN_RIGHT` on your mouse), both devices will have to be read by Makima and thus both will need a config file, even if empty. Having a config file is just a way to tell Makima "Hey, read this device!".
204 |
205 | #### Chained bindings:
206 | When declaring a binding, you can put a dash (`-`) in front of it (e.g. `-KEY_A = ["KEY_B"]`) to tell Makima that it's not a standalone binding and it should instead be chained at the end of another sequence.\
207 | Example:
208 | ```
209 | # Simulate Alt-Tab: press the buttons in the first binding, then tap the right trigger to advance in the Alt-Tab menu.
210 | BTN_SELECT-BTN_TL2 = ["KEY_LEFTALT"]
211 | -BTN_TR2 = ["KEY_TAB"]
212 | ```
213 |
214 | If the key with the dash is pressed alone, its behavior will depend on the `CHAIN_ONLY` setting: if set to `"true"` (default) it will ignore the keypress and only fire if pressed together with a combination, if set to `"false"`, it will fire the designated event regardless.\
215 | You can declare both a `-BTN_TR2` and a `BTN_TR2` binding: in this case, the first will fire when chained and the second will fire when used alone (assuming `CHAIN_ONLY` is set to`"true"`).
216 |
217 | ### **[settings]**
218 | #### `GRAB_DEVICE`
219 | Sets if Makima should have exclusivity over the device.\
220 | If `"true"`, no other program will read the original input of the device. If `"false"`, both the original input and the remapped input will be read by applications.
221 | #### `LSTICK` and `RSTICK`
222 | Set the function of the left and right analog sticks, respectively.\
223 | `"bind"` will make them available for rebinding in `[remap]` and `[commands]`, `"cursor"` will use them to move your mouse cursor, `"scroll"` will use them to scroll, `"disabled"` will disable them.
224 | #### `LSTICK_SENSITIVITY` and `RSTICK_SENSITIVITY`
225 | Set the sensitivity of your left and right analog sticks when using them to scroll or move your cursor.\
226 | Lower value is higher sensitivity, minimum `"1"`, suggested `"6"`. If this is set to `"0"` or if it's not set, cursor movement and scroll will be disabled.
227 | #### `LSTICK_DEADZONE` and `RSTICK_DEADZONE`
228 | Set how much your analog sticks should be tilted before their inputs are detected.\
229 | Particularly useful for older devices that suffer from drifting. Use a value between `"0"` and `"128"`.
230 | #### `INVERT_CURSOR_AXIS` and `INVERT_SCROLL_AXIS`
231 | Invert up/down and left/right on the analog sticks when used for cursor movement or 2D scroll.\
232 | Both default to `"false"`.
233 | #### `LSTICK_ACTIVATION_MODIFIERS` and `RSTICK_ACTIVATION_MODIFIERS`
234 | When using analog sticks in `cursor` or `scroll` mode, normally, they're always active. However, if you specify a list of keys or modifiers in `LSTICK_ACTIVATION_MODIFIERS` or `RSTICK_ACTIVATION_MODIFIERS`, they'll only be active when the modifiers are pressed.\
235 | Example:
236 | ```
237 | # Only move the cursor when Select and Start are pressed
238 | LSTICK = "cursor"
239 | LSTICK_ACTIVATION_MODIFIERS = "BTN_SELECT-BTN_START"
240 | ```
241 | #### `CURSOR_SPEED` and `SCROLL_SPEED`
242 | When using keys/buttons to move your cursor or scroll through a page, you can use this parameter to change speed.\
243 | Speed is measured in pixels per 5 milliseconds.\
244 | Must be an integer value, can be negative (it will move in the opposite direction). Defaults to `0`.
245 | #### `CURSOR_ACCEL` and `SCROLL_ACCEL`
246 | When using keys/buttons to move your cursor or scroll through a page, you can use this parameter to determine how much it takes to reach the speed set in `CURSOR_SPEED` and `SCROLL_SPEED`.\
247 | For example, setting a value of `"0.2"` means that every 5 milliseconds, the speed will increase by 2% of the maximum speed.\
248 | Must be a float value between `"0.0"` and `"1.0"`. Defaults to `1.0`.
249 | #### `16_BIT_AXIS`
250 | This is needed if you're using Xbox controllers and Switch Joy-Cons to properly calibrate the analog stick's sensitivity.\
251 | Set to `"true"` if you're using those controllers.
252 | #### `CUSTOM_MODIFIERS`
253 | The keys listed in this parameter will change their behavior to act as modifiers.\
254 | While pressed, they will act as modifiers without emitting their respective `KEY` event, possibly changing the behavior of other keys if specified in `[remap]`. On release, they will emit their default `KEY` event only if no other keystroke happened while they were pressed.\
255 | This is useful if you want to have a key that behaves like a modifier but can still emit its own event if pressed alone.\
256 | You can list multiple keys to treat as modifiers with the following syntax:\
257 | `CUSTOM_MODIFIERS = "KEY_A-KEY_BACKSLASH-KEY_GRAVE"`
258 |
259 | #### `STADIA`
260 | If you're using a Stadia controller, set this to `"true"`, otherwise you won't be able to use your right analog stick.\
261 | Defaults to `"false"`.
262 |
263 | #### `CHAIN_ONLY`
264 | When using a [chained binding](https://github.com/cyber-sushi/makima/tree/main#chained-bindings), you can choose the behavior of the key when pressed alone.\
265 | Set to `"true"` (default) to make it fire the event only if other modifiers are active. Set to `"false"` to make it fire its designated event regardless.
266 |
267 | #### `LAYOUT_SWITCHER`
268 | Set a key to cycle through the available remap layouts in the config files.\
269 | Defaults to `BTN_0`, which is the key at the center of a tablet's wheel.
270 |
271 | #### `NOTIFY_LAYOUT_SWITCH`
272 | If set to `"true"`, send a notification for 0.5 seconds to notify that the layout has been changed, and what it has been changed to.\
273 | Defaults to `"false"`.
274 |
275 | ## Tested controllers
276 | - DualShock 2
277 | - DualShock 3
278 | - DualShock 4
279 | - DualSense
280 | - Xbox 360
281 | - Xbox One
282 | - Xbox Elite 2
283 | - Stadia
284 | - Switch Joy-Cons
285 |
286 | To add other controllers, please open an issue.
287 |
288 | ## Troubleshooting and FAQ
289 | **Q**: My device actually shows as three different devices in evtest, do I need to create three different config files, one for each device?\
290 | **A**: Each device will have a certain set of features, e.g. a DS4 controller is recognized as a touchpad, a motion sensor and a controller. A mouse is usually recognized as a mouse and a keyboard (for the additional keys). Just create a config file for the devices/features that you need to remap, and ignore the others.
291 |
292 | **Q**: My controller works when using Bluetooth but not when using wired connection or vice-versa, why?\
293 | **A**: Some devices have a different evdev name when connected through Bluetooth, for example a `Sony Interactive Entertainment Wireless Controller` is just seen as `Wireless Controller` when connected via Bluetooth. You'll need to create a copy of the config file with that name.
294 |
295 | **Q**: Will application-specific bindings be implemented for other desktops like Gnome Wayland?\
296 | **A**: Gnome on Wayland requires an extension to retrieve the active window through D-Bus, which is why I haven't implemented window tracking for it. If anyone finds a better solution, I'm all for it. Regarding other compositors, feel free to open an issue and I'll look into it.
297 |
298 | **Q**: Makima says that it's unable to create a virtual device, what do I do?\
299 | **A**: Pick `50-makima.rules` from this repo and copy it into `/etc/udev/rules.d/`, then load the `uinput` module with `sudo modprobe uinput`. To load it automatically on boot, create `/etc/modules-load.d/uinput.conf` and write `uinput` inside.
300 |
301 | **Q**: SELinux prevents Makima's system service from running, what do I do?\
302 | **A**: Put `makima.service` inside `/usr/lib/systemd/system` instead of `/etc/systemd/system`, then run the following commands:
303 | - `sudo semanage fcontext -a -t bin_t "/usr/lib/systemd/system/makima.service"`
304 | - `sudo restorecon -v /usr/lib/systemd/system/makima.service`
305 | - `sudo semanage fcontext -a -t bin_t "/usr/bin/makima"`
306 | - `sudo restorecon -v /usr/bin/makima`
307 |
--------------------------------------------------------------------------------
/examples/config-keyboard.toml:
--------------------------------------------------------------------------------
1 | #SAMPLE CONFIG FILE FOR A GENERIC KEYBOARD
2 | #Put this in ~/.config/makima and rename it to the exact name of the device as shown by the 'evtest' command, including spaces and capitalization. Omit "/" if present.
3 | #You can find the available keycodes in /usr/include/linux/input-event-codes.h
4 | #If you're not sure which keycode corresponds to which key, you can run 'evtest', select your device and press the corresponding key/button.
5 |
6 | [remap]
7 | #Examples of Key => Key(s)
8 | KEY_CAPSLOCK = ["KEY_LEFTCTRL"]
9 | KEY_LEFTCTRL = ["KEY_CAPSLOCK"]
10 | #Examples of Modifier(s) + Key => Key(s)
11 | KEY_LEFTCTRL-KEY_LEFTSHIFT-KEY_Q = ["KEY_ESC"]
12 | KEY_LEFTSHIFT-KEY_UP = ["KEY_LEFTSHIFT", "KEY_PAGEUP"]
13 | KEY_LEFTSHIFT-KEY_DOWN = ["KEY_LEFTSHIFT", "KEY_PAGEDOWN"]
14 | KEY_LEFTSHIFT-KEY_LEFTMETA-KEY_LEFTALT-KEY_RIGHT = ["KEY_LEFTCTRL", "KEY_C"]
15 |
16 | [commands]
17 | #Examples of Modifier + Key => run a shell command
18 | KEY_LEFTCTRL-KEY_N = ["nautilus"]
19 | KEY_LEFTMETA-KEY_P = ["firefox", "discord"]
20 | KEY_LEFTALT-KEY_SPACE = ["foot sh -c 'pacman -Q | wc -l && sleep 1 && neofetch' && sleep 5"]
21 | KEY_LEFTCTRL-KEY_LEFTALT-KEY_LEFTSHIFT-KEY_O = ["notify-send 'OwO'"]
22 | #You can also use non-modifier keys as Modifiers, and their behavior will be changed automatically to act as Modifiers (refer to the CUSTOM_MODIFIERS setting for more info).
23 | KEY_MINUS-KEY_K = ["pkill firefox"]
24 | #Keep in mind that if you want to use Modifiers across multiple devices (e.g. KEY_LEFTCTRL on your keyboard and BTN_RIGHT on your mouse), both devices will have to be read by Makima and thus both will need a config file, even if empty. Having a config file is just a way to tell Makima "Hey, read this device!".
25 |
26 | [movements]
27 | KEY_LEFTSHIFT-KEY_W = "CURSOR_UP"
28 |
29 | [settings]
30 | CUSTOM_MODIFIERS = "KEY_GRAVE-KEY_BACKSLASH" #The keys listed here will be treated as modifiers and will only emit their own event when released. If another key is pressed before the custom modifier is released, it will not emit any event. If you declare a binding that uses a non-modifier key as a modifier in the [remap] or [commands] sections, it's automatically added to this setting.
31 | CURSOR_SPEED = "10" #Speed of the cursor when moved through keys specified in [movements].
32 | CURSOR_ACCEL = "0.5" #Acceleration of the cursor when moved through keys. Values from 0.0 to 1.0.
--------------------------------------------------------------------------------
/examples/config-mouse.toml:
--------------------------------------------------------------------------------
1 | #SAMPLE CONFIG FILE FOR A GENERIC MOUSE
2 | #Put this in ~/.config/makima and rename it to the exact name of the device as shown by the 'evtest' command, including spaces and capitalization. Omit "/" if present.
3 | #You can find the available keycodes in /usr/include/linux/input-event-codes.h
4 | #If you're not sure which keycode corresponds to which key, you can run 'evtest', select your device and press the corresponding key/button.
5 | #Relative and absolute axis events are hard coded, for example use SCROLL_WHEEL_UP and SCROLL_WHEEL_DOWN to rebind wheel movements.
6 |
7 | [remap]
8 | #Example of Key => Key(s)
9 | BTN_RIGHT = ["KEY_LEFTCTRL", "KEY_C"]
10 | #Example of Axis event => Key(s)
11 | SCROLL_WHEEL_UP = ["KEY_LEFTCTRL", "KEY_F"]
12 | SCROLL_WHEEL_DOWN = ["KEY_LEFTCTRL", "KEY_Q"]
13 | #Examples of Modifier(s) + Key => Key(s)
14 | KEY_LEFTCTRL-BTN_RIGHT = ["KEY_SYSRQ"]
15 | KEY_LEFTCTRL-KEY_LEFTSHIFT-BTN_LEFT = ["KEY_LEFTSHIFT", "KEY_DELETE"]
16 | #Examples of Modifier(s) + Axis event => Key(s)
17 | KEY_LEFTCTRL-KEY_LEFTSHIFT-SCROLL_WHEEL_UP = ["KEY_HOME"]
18 | KEY_LEFTCTRL-KEY_LEFTSHIFT-KEY_LEFTALT-SCROLL_WHEEL_DOWN = ["KEY_LEFTALT", "KEY_F4"]
19 | #Keep in mind that if you want to use Modifiers across multiple devices (e.g. KEY_LEFTCTRL on your keyboard and BTN_RIGHT on your mouse), both devices will have to be read by Makima and thus both will need a config file, even if empty. Having a config file is just a way to tell Makima "Hey, read this device!".
20 |
21 | [commands]
22 | #Examples of Modifier + Key => run a shell command
23 | KEY_LEFTCTRL-KEY_LEFTSHIFT-SCROLL_WHEEL_DOWN = ["foot sh -c 'pacman -Q | wc -l && sleep 1 && neofetch' && sleep 5"]
24 | BTN_MIDDLE = ["notify-send 'OwO'"]
25 | #You can also use non-modifier keys as Modifiers, and their behavior will be changed automatically to act as Modifiers (refer to the CUSTOM_MODIFIERS setting for more info).
26 | BTN_EXTRA-SCROLL_WHEEL_UP = ["pkill firefox"]
27 |
28 | [settings]
29 | CUSTOM_MODIFIERS = "BTN_EXTRA-KEY_FORWARD" #The keys listed here will be treated as modifiers and will only emit their own event when released. If another key is pressed before the custom modifier is released, it will not emit any event. If you declare a binding that uses a non-modifier key as a modifier in the [remap] or [commands] sections, it's automatically added to this setting.
--------------------------------------------------------------------------------
/examples/config-playstation.toml:
--------------------------------------------------------------------------------
1 | #SAMPLE CONFIG FILE FOR PLAYSTATION CONTROLLERS
2 | #Put this in ~/.config/makima and rename it to the exact name of the device as shown by the 'evtest' command, including spaces and capitalization. Omit "/" if present.
3 | #You can find all the available keycodes in /usr/include/linux/input-event-codes.h
4 | #If you're not sure which keycode corresponds to which key, you can run 'evtest', select your device and press the corresponding key/button.
5 | #Relative and absolute axis events are hard coded, for example use RSTICK_UP, RSTICK_DOWN etc to rebind your analog stick.
6 | #This config file is tested for DualShock 3, DualShock 4 and DualSense controllers. When using a different controller, if no specific config file for your device is available, change the keycodes on the left according to those of your controller (evtest is your friend again). If your controller has a button to enable/disable analog sticks, make sure they're enabled.
7 |
8 | [remap]
9 | #Examples of Button => Key(s)
10 | BTN_NORTH = ["KEY_LEFTMETA", "KEY_J"] #triangle
11 | BTN_EAST = ["KEY_ENTER"] #circle
12 | BTN_SOUTH = ["KEY_LEFTSHIFT"] #X
13 | BTN_WEST = ["KEY_LEFTMETA"] #square
14 | BTN_TR = ["KEY_LEFTMETA", "KEY_L"] #R1
15 | BTN_TL = ["KEY_LEFTMETA", "KEY_K"] #L1
16 | BTN_START = ["KEY_LEFTMETA", "KEY_D"] #start
17 | BTN_SELECT = ["KEY_ESC"] #select
18 | BTN_THUMBR = ["KEY_LEFTMETA", "KEY_Q"] #R3
19 | BTN_THUMBL = ["BTN_MIDDLE"] #L3
20 | BTN_MODE = ["KEY_SPACE"] #PS button
21 | #Examples of Axis events => Key(s)
22 | BTN_TL2 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_K"] #L2
23 | BTN_TR2 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_L"] #R2
24 | BTN_DPAD_UP = ["KEY_UP"] #directional pad up
25 | BTN_DPAD_RIGHT = ["KEY_RIGHT"] #directional pad right
26 | BTN_DPAD_DOWN = ["KEY_DOWN"] #directional pad down
27 | BTN_DPAD_LEFT = ["KEY_LEFT"] #directional pad left
28 | RSTICK_UP = ["KEY_UP"] #right analog stick up
29 | RSTICK_DOWN = ["KEY_DOWN"] #right analog stick down
30 |
31 | [commands]
32 | RSTICK_LEFT = ["foot sh -c 'pacman -Q | wc -l && sleep 1 && neofetch' && sleep 5"] #right analog stick left
33 | RSTICK_RIGHT = ["firefox", "discord"] #right analog stick right
34 |
35 | [settings]
36 | LSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
37 | RSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
38 | LSTICK = "cursor" #cursor, scroll, bind or disabled
39 | RSTICK = "bind" #cursor, scroll, bind or disabled
40 | LSTICK_DEADZONE = "5" #integer between 0 and 128, bigger number is wider deadzone, default 5
41 | RSTICK_DEADZONE = "64" #integer between 0 and 128, bigger number is wider deadzone, default 5
42 | GRAB_DEVICE = "false" #gain exclusivity on the device
43 |
--------------------------------------------------------------------------------
/examples/config-ps2.toml:
--------------------------------------------------------------------------------
1 | #SAMPLE CONFIG FILE FOR PLAYSTATION 2 CONTROLLERS
2 | #Put this in ~/.config/makima and rename it to the exact name of the device as shown by the 'evtest' command, including spaces and capitalization. Omit "/" if present.
3 | #You can find all the available keycodes in /usr/include/linux/input-event-codes.h
4 | #If you're not sure which keycode corresponds to which key, you can run 'evtest', select your device and press the corresponding key/button.
5 | #Relative and absolute axis events are hard coded, for example use RSTICK_UP, RSTICK_DOWN etc to rebind your analog stick.
6 | #This config file is tested for DualShock 2 controllers. The "analog" LED on your controller has to be turned on or this daemon won't work properly. When using a different controller, if no specific config file for your device is available, change the keycodes on the left according to those of your controller (evtest is your friend again).
7 |
8 | [remap]
9 | #Examples of Button => Key(s)
10 | BTN_TRIGGER = ["KEY_LEFTMETA", "KEY_J"] #triangle
11 | BTN_THUMB = ["KEY_ENTER"] #circle
12 | BTN_THUMB2 = ["KEY_LEFTSHIFT"] #X
13 | BTN_TOP = ["KEY_LEFTMETA"] #square
14 | BTN_BASE2 = ["KEY_LEFTMETA", "KEY_L"] #R1
15 | BTN_PINKIE = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_L"] #R2
16 | BTN_BASE = ["KEY_LEFTMETA", "KEY_K"] #L1
17 | BTN_TOP2 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_K"] #L2
18 | BTN_BASE4 = ["KEY_LEFTMETA", "KEY_D"] #start
19 | BTN_BASE3 = ["KEY_ESC"] #select
20 | BTN_BASE6 = ["KEY_LEFTMETA", "KEY_Q"] #R3
21 | BTN_BASE5 = ["BTN_MIDDLE"] #L3
22 | #Examples of Axis events => Key(s)
23 | BTN_DPAD_UP = ["KEY_UP"] #directional pad up
24 | BTN_DPAD_RIGHT = ["KEY_RIGHT"] #directional pad right
25 | BTN_DPAD_DOWN = ["KEY_DOWN"] #directional pad down
26 | BTN_DPAD_LEFT = ["KEY_LEFT"] #directional pad left
27 | RSTICK_UP = ["KEY_UP"] #right analog stick up
28 | RSTICK_DOWN = ["KEY_DOWN"] #right analog stick down
29 |
30 | [commands]
31 | RSTICK_LEFT = ["foot sh -c 'pacman -Q | wc -l && sleep 1 && neofetch' && sleep 5"] #right analog stick left
32 | RSTICK_RIGHT = ["firefox", "discord"] #right analog stick right
33 |
34 | [settings]
35 | LSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
36 | RSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
37 | LSTICK = "cursor" #cursor, scroll, bind or disabled
38 | RSTICK = "bind" #cursor, scroll, bind or disabled
39 | LSTICK_DEADZONE = "5" #integer between 0 and 128, bigger number is wider deadzone, default 5
40 | RSTICK_DEADZONE = "64" #integer between 0 and 128, bigger number is wider deadzone, default 5
41 | GRAB_DEVICE = "false" #gain exclusivity on the device
--------------------------------------------------------------------------------
/examples/config-stadia.toml:
--------------------------------------------------------------------------------
1 | #SAMPLE CONFIG FILE FOR GOOGLE STADIA CONTROLLERS
2 | #Put this in ~/.config/makima and rename it to the exact name of the device as shown by the 'evtest' command, including spaces and capitalization. Omit "/" if present.
3 | #You can find all the available keycodes in /usr/include/linux/input-event-codes.h
4 | #If you're not sure which keycode corresponds to which key, you can run 'evtest', select your device and press the corresponding key/button.
5 | #Relative and absolute axis events are hard coded, for example use RSTICK_UP, RSTICK_DOWN etc to rebind your analog stick.
6 | #This config file is tested for Stadia controllers. When using a different controller, if no specific config file for your device is available, change the keycodes on the left according to those of your controller (evtest is your friend again). If your controller has a button to enable/disable analog sticks, make sure they're enabled.
7 |
8 | [remap]
9 | #Examples of Button => Key(s)
10 | BTN_WEST = ["KEY_LEFTMETA", "KEY_J"] #Y
11 | BTN_EAST = ["KEY_ENTER"] #X
12 | BTN_SOUTH = ["KEY_LEFTSHIFT"] #A
13 | BTN_NORTH = ["KEY_LEFTMETA"] #B
14 | BTN_TR = ["KEY_LEFTMETA", "KEY_L"] #R1
15 | BTN_TRIGGER_HAPPY3 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_L"] #R2
16 | BTN_TL = ["KEY_LEFTMETA", "KEY_K"] #L1
17 | BTN_TRIGGER_HAPPY4 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_K"] #L2
18 | BTN_START = ["KEY_LEFTMETA", "KEY_D"] #menu/start
19 | BTN_SELECT = ["KEY_ESC"] #options/select
20 | BTN_TRIGGER_HAPPY1 = ["BTN_RIGHT"] #screenshot
21 | BTN_TRIGGER_HAPPY2 = ["BTN_LEFT"] #share/bubbles?
22 | BTN_THUMBR = ["KEY_LEFTMETA", "KEY_Q"] #R3
23 | BTN_THUMBL = ["BTN_MIDDLE"] #L3
24 | BTN_MODE = ["KEY_SPACE"] #Stadia button
25 | #Examples of Axis events => Key(s)
26 | BTN_DPAD_UP = ["KEY_UP"] #directional pad up
27 | BTN_DPAD_RIGHT = ["KEY_RIGHT"] #directional pad right
28 | BTN_DPAD_DOWN = ["KEY_DOWN"] #directional pad down
29 | BTN_DPAD_LEFT = ["KEY_LEFT"] #directional pad left
30 | RSTICK_UP = ["KEY_UP"] #right analog stick up
31 | RSTICK_DOWN = ["KEY_DOWN"] #right analog stick down
32 |
33 | [commands]
34 | RSTICK_LEFT = ["foot sh -c 'pacman -Q | wc -l && sleep 1 && neofetch' && sleep 5"] #right analog stick left
35 | RSTICK_RIGHT = ["firefox", "discord"] #right analog stick right
36 |
37 | [settings]
38 | LSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
39 | RSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
40 | LSTICK = "cursor" #cursor, scroll, bind or disabled
41 | RSTICK = "bind" #cursor, scroll, bind or disabled
42 | LSTICK_DEADZONE = "5" #integer between 0 and 128, bigger number is wider deadzone, default 5
43 | RSTICK_DEADZONE = "64" #integer between 0 and 128, bigger number is wider deadzone, default 5
44 | STADIA = "true"
45 | GRAB_DEVICE = "false" #gain exclusivity on the device
46 |
--------------------------------------------------------------------------------
/examples/config-switch.toml:
--------------------------------------------------------------------------------
1 | #SAMPLE CONFIG FILE FOR SWITCH JOYCONS
2 | #Put this in ~/.config/makima and rename it to the exact name of the device as shown by the 'evtest' command, including spaces and capitalization. Omit "/" if present.
3 | #You can find all the available keycodes in /usr/include/linux/input-event-codes.h
4 | #If you're not sure which keycode corresponds to which key, you can run 'evtest', select your device and press the corresponding key/button.
5 | #Relative and absolute axis events are hard coded, for example use RSTICK_UP, RSTICK_DOWN etc to rebind your analog stick.
6 | #This config file is tested for Switch Joycons (Left and Right). When using a different controller, if no specific config file for your device is available, change the keycodes on the left according to those of your controller (evtest is your friend again). If your controller has a button to enable/disable analog sticks, make sure they're enabled.
7 |
8 | [remap]
9 | #Examples of Button => Key(s)
10 | BTN_NORTH = ["KEY_LEFTMETA", "KEY_J"] #X
11 | BTN_EAST = ["KEY_ENTER"] #A
12 | BTN_SOUTH = ["KEY_LEFTSHIFT"] #B
13 | BTN_WEST = ["KEY_LEFTMETA"] #Y
14 | BTN_TR = ["KEY_LEFTMETA", "KEY_L"] #R (and SL on left joycon)
15 | BTN_TL = ["KEY_LEFTMETA", "KEY_K"] #L (and SL on right joycon)
16 | BTN_START = ["KEY_LEFTMETA", "KEY_D"] #plus
17 | BTN_SELECT = ["KEY_ESC"] #minus
18 | BTN_THUMBR = ["KEY_LEFTMETA", "KEY_Q"] #right stick press
19 | BTN_THUMBL = ["BTN_MIDDLE"] #left stick press
20 | BTN_MODE = ["KEY_SPACE"] #home
21 | BTN_Z = ["BTN_LEFT"] #capture
22 | #Examples of Axis events => Key(s)
23 | BTN_TL2 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_K"] #ZL (and SR on right joycon)
24 | BTN_TR2 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_L"] #ZR (and SR on left joycon)
25 | BTN_DPAD_UP = ["KEY_UP"] #directional pad up
26 | BTN_DPAD_RIGHT = ["KEY_RIGHT"] #directional pad right
27 | BTN_DPAD_DOWN = ["KEY_DOWN"] #directional pad down
28 | BTN_DPAD_LEFT = ["KEY_LEFT"] #directional pad left
29 | RSTICK_UP = ["KEY_UP"] #right analog stick up
30 | RSTICK_DOWN = ["KEY_DOWN"] #right analog stick down
31 |
32 | [commands]
33 | RSTICK_LEFT = ["foot sh -c 'pacman -Q | wc -l && sleep 1 && neofetch' && sleep 5"] #right analog stick left
34 | RSTICK_RIGHT = ["firefox", "discord"] #right analog stick right
35 |
36 | [settings]
37 | LSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
38 | RSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
39 | LSTICK = "cursor" #cursor, scroll, bind or disabled
40 | RSTICK = "bind" #cursor, scroll, bind or disabled
41 | LSTICK_DEADZONE = "5" #integer between 0 and 128, bigger number is wider deadzone, default 5
42 | RSTICK_DEADZONE = "64" #integer between 0 and 128, bigger number is wider deadzone, default 5
43 | 16_BIT_AXIS = "true" #necessary for Xbox controllers and Switch joycons, use false for other controllers
44 | GRAB_DEVICE = "false" #gain exclusivity on the device
45 |
--------------------------------------------------------------------------------
/examples/config-xbox.toml:
--------------------------------------------------------------------------------
1 | #SAMPLE CONFIG FILE FOR XBOX CONTROLLERS
2 | #Put this in ~/.config/makima and rename it to the exact name of the device as shown by the 'evtest' command, including spaces and capitalization. Omit "/" if present.
3 | #You can find all the available keycodes in /usr/include/linux/input-event-codes.h
4 | #If you're not sure which keycode corresponds to which key, you can run 'evtest', select your device and press the corresponding key/button.
5 | #Relative and absolute axis events are hard coded, for example use RSTICK_UP, RSTICK_DOWN etc to rebind your analog stick.
6 | #This config file is tested for Xbox 360, Xbox One and Xbox Elite 2 controllers. When using a different controller, if no specific config file for your device is available, change the keycodes on the left according to those of your controller (evtest is your friend again). If your controller has a button to enable/disable analog sticks, make sure they're enabled.
7 |
8 | [remap]
9 | #Examples of Button => Key(s)
10 | BTN_NORTH = ["KEY_LEFTMETA", "KEY_J"] #X
11 | BTN_EAST = ["KEY_ENTER"] #Y
12 | BTN_SOUTH = ["KEY_LEFTSHIFT"] #A
13 | BTN_WEST = ["KEY_LEFTMETA"] #B
14 | BTN_TR = ["KEY_LEFTMETA", "KEY_L"] #RB
15 | BTN_TL = ["KEY_LEFTMETA", "KEY_K"] #LB
16 | BTN_START = ["KEY_LEFTMETA", "KEY_D"] #start
17 | BTN_SELECT = ["KEY_ESC"] #back
18 | BTN_THUMBR = ["KEY_LEFTMETA", "KEY_Q"] #RS
19 | BTN_THUMBL = ["BTN_MIDDLE"] #LS
20 | BTN_MODE = ["KEY_SPACE"] #Xbox button
21 | #Examples of Axis events => Key(s)
22 | BTN_TR2 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_L"] #RT
23 | BTN_TL2 = ["KEY_LEFTMETA", "KEY_LEFTSHIFT", "KEY_K"] #LT
24 | BTN_DPAD_UP = ["KEY_UP"] #directional pad up
25 | BTN_DPAD_RIGHT = ["KEY_RIGHT"] #directional pad right
26 | BTN_DPAD_DOWN = ["KEY_DOWN"] #directional pad down
27 | BTN_DPAD_LEFT = ["KEY_LEFT"] #directional pad left
28 | RSTICK_UP = ["KEY_UP"] #right analog stick up
29 | RSTICK_DOWN = ["KEY_DOWN"] #right analog stick down
30 |
31 | [commands]
32 | RSTICK_LEFT = ["foot sh -c 'pacman -Q | wc -l && sleep 1 && neofetch' && sleep 5"] #right analog stick left
33 | RSTICK_RIGHT = ["firefox", "discord"] #right analog stick right
34 |
35 | [settings]
36 | LSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
37 | RSTICK_SENSITIVITY = "6" #sensitivity when scrolling or moving cursor, lower value is higher sensitivity, minimum 1
38 | LSTICK = "cursor" #cursor, scroll, bind or disabled
39 | RSTICK = "bind" #cursor, scroll, bind or disabled
40 | LSTICK_DEADZONE = "5" #integer between 0 and 128, bigger number is wider deadzone, default 5
41 | RSTICK_DEADZONE = "64" #integer between 0 and 128, bigger number is wider deadzone, default 5
42 | 16_BIT_AXIS = "true" #necessary for Xbox controllers and Switch joycons, use false for other controllers
43 | GRAB_DEVICE = "false" #gain exclusivity on the device
44 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | # Define variables
5 | binary_name="makima"
6 | service_name="makima.service"
7 | rules_name="50-makima.rules"
8 |
9 |
10 | # Check for root
11 | if [ "$EUID" -ne 0 ]; then
12 | echo "Please run this script with sudo."
13 | exit
14 | fi
15 |
16 |
17 | # Function to display help
18 | display_help() {
19 | echo
20 | echo "Install $binary_name system wide. Usage: $0 [|-u|-h]"
21 | echo "Options:"
22 | echo " -u Undo the changes made by the script"
23 | echo " -h, --help Display this help message"
24 | echo
25 | }
26 |
27 |
28 | # Function to undo changes
29 | undo_changes() {
30 | systemctl stop $service_name
31 | systemctl disable $service_name
32 | rm /usr/local/bin/$binary_name
33 | rm /etc/udev/rules.d/$rules_name
34 | rm /etc/systemd/system/$service_name
35 | rm /etc/modules-load.d/uinput.conf
36 | systemctl daemon-reload
37 | echo "Uninstalled successfully."
38 | }
39 |
40 |
41 | # Check for arguments
42 | if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
43 | display_help
44 | exit
45 | elif [ "$1" = "-u" ]; then
46 | undo_changes
47 | exit
48 | elif [ -n "$1" ]; then
49 | user_name="$1"
50 | else
51 | echo "Please provide a username to install $binary_name. Usage: $0 [|-u|-h]"
52 | exit 1
53 | fi
54 |
55 |
56 | # Copy the binary, udev rules and create the configuration folder
57 | chmod +x "$binary_name"
58 | cp "$binary_name" /usr/local/bin/
59 | cp "$rules_name" /etc/udev/rules.d/
60 | echo "uinput" > /etc/modules-load.d/uinput.conf
61 | mkdir /home/"$user_name"/.config/makima
62 |
63 |
64 | # Create the systemd unit file
65 | tee "/etc/systemd/system/$service_name" > /dev/null <) -> Client {
9 | match &environment.server {
10 | Server::Connected(server) => {
11 | let server_str = server.as_str();
12 | match server_str {
13 | "Hyprland" => {
14 | let query = Command::new("hyprctl")
15 | .args(["activewindow", "-j"])
16 | .output()
17 | .unwrap();
18 | if let Ok(reply) = serde_json::from_str::(
19 | std::str::from_utf8(query.stdout.as_slice()).unwrap(),
20 | ) {
21 | let active_window =
22 | Client::Class(reply["class"].to_string().replace("\"", ""));
23 | if let Some(_) = config
24 | .iter()
25 | .find(|&x| x.associations.client == active_window)
26 | {
27 | active_window
28 | } else {
29 | Client::Default
30 | }
31 | } else {
32 | Client::Default
33 | }
34 | }
35 | "sway" => {
36 | let mut connection = Connection::new().await.unwrap();
37 | let active_window = match connection
38 | .get_tree()
39 | .await
40 | .unwrap()
41 | .find_focused(|window| window.focused)
42 | {
43 | Some(window) => match window.app_id {
44 | Some(id) => Client::Class(id),
45 | None => window
46 | .window_properties
47 | .and_then(|window_properties| window_properties.class)
48 | .map_or(Client::Default, Client::Class),
49 | },
50 | None => Client::Default,
51 | };
52 | if let Some(_) = config
53 | .iter()
54 | .find(|&x| x.associations.client == active_window)
55 | {
56 | active_window
57 | } else {
58 | Client::Default
59 | }
60 | }
61 | "niri" => {
62 | let query = Command::new("niri")
63 | .args(["msg", "-j", "focused-window"])
64 | .output()
65 | .unwrap();
66 | if let Ok(reply) = serde_json::from_str::(
67 | std::str::from_utf8(query.stdout.as_slice()).unwrap(),
68 | ) {
69 | let active_window =
70 | Client::Class(reply["app_id"].to_string().replace("\"", ""));
71 | if let Some(_) = config
72 | .iter()
73 | .find(|&x| x.associations.client == active_window)
74 | {
75 | active_window
76 | } else {
77 | Client::Default
78 | }
79 | } else {
80 | Client::Default
81 | }
82 | }
83 | "KDE" => {
84 | let (user, running_as_root) =
85 | if let Ok(sudo_user) = environment.sudo_user.clone() {
86 | (Option::Some(sudo_user), true)
87 | } else if let Ok(user) = environment.user.clone() {
88 | (Option::Some(user), false)
89 | } else {
90 | (Option::None, false)
91 | };
92 | let active_window = {
93 | if let Some(user) = user {
94 | if running_as_root {
95 | let output = Command::new("runuser")
96 | .arg(user)
97 | .arg("-c")
98 | .arg("kdotool getactivewindow getwindowclassname")
99 | .output()
100 | .unwrap();
101 | Client::Class(
102 | std::str::from_utf8(output.stdout.as_slice())
103 | .unwrap()
104 | .trim()
105 | .to_string(),
106 | )
107 | } else {
108 | let output = Command::new("sh")
109 | .arg("-c")
110 | .arg(format!("systemd-run --user --scope -M {}@ kdotool getactivewindow getwindowclassname", user))
111 | .stderr(Stdio::null())
112 | .output()
113 | .unwrap();
114 | Client::Class(
115 | std::str::from_utf8(output.stdout.as_slice())
116 | .unwrap()
117 | .trim()
118 | .to_string(),
119 | )
120 | }
121 | } else {
122 | Client::Default
123 | }
124 | };
125 | if let Some(_) = config
126 | .iter()
127 | .find(|&x| x.associations.client == active_window)
128 | {
129 | active_window
130 | } else {
131 | Client::Default
132 | }
133 | }
134 | "x11" => {
135 | let connection = x11rb::connect(None).unwrap().0;
136 | let focused_window =
137 | get_input_focus(&connection).unwrap().reply().unwrap().focus;
138 | let (wm_class, string): (Atom, Atom) =
139 | (AtomEnum::WM_CLASS.into(), AtomEnum::STRING.into());
140 | let class = get_property(
141 | &connection,
142 | false,
143 | focused_window,
144 | wm_class,
145 | string,
146 | 0,
147 | u32::MAX,
148 | )
149 | .unwrap()
150 | .reply()
151 | .unwrap()
152 | .value;
153 | if let Some(middle) = class.iter().position(|&byte| byte == 0) {
154 | let class = class.split_at(middle).1;
155 | let mut class = &class[1..];
156 | if class.last() == Some(&0) {
157 | class = &class[..class.len() - 1];
158 | }
159 | let active_window =
160 | Client::Class(std::str::from_utf8(class).unwrap().to_string());
161 | if let Some(_) = config
162 | .iter()
163 | .find(|&x| x.associations.client == active_window)
164 | {
165 | active_window
166 | } else {
167 | Client::Default
168 | }
169 | } else {
170 | Client::Default
171 | }
172 | }
173 | _ => Client::Default,
174 | }
175 | }
176 | Server::Unsupported => Client::Default,
177 | Server::Failed => Client::Default,
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/src/config.rs:
--------------------------------------------------------------------------------
1 | use crate::udev_monitor::Client;
2 | use evdev::Key;
3 | use serde;
4 | use std::{collections::HashMap, str::FromStr};
5 |
6 | #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
7 | pub enum Event {
8 | Axis(Axis),
9 | Key(Key),
10 | Hold,
11 | }
12 |
13 | #[allow(non_camel_case_types)]
14 | #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
15 | pub enum Axis {
16 | BTN_DPAD_UP,
17 | BTN_DPAD_DOWN,
18 | BTN_DPAD_LEFT,
19 | BTN_DPAD_RIGHT,
20 | LSTICK_UP,
21 | LSTICK_DOWN,
22 | LSTICK_LEFT,
23 | LSTICK_RIGHT,
24 | RSTICK_UP,
25 | RSTICK_DOWN,
26 | RSTICK_LEFT,
27 | RSTICK_RIGHT,
28 | SCROLL_WHEEL_UP,
29 | SCROLL_WHEEL_DOWN,
30 | BTN_TL2,
31 | BTN_TR2,
32 | ABS_WHEEL_CW,
33 | ABS_WHEEL_CCW,
34 | }
35 |
36 | impl FromStr for Axis {
37 | type Err = String;
38 | fn from_str(s: &str) -> Result {
39 | match s {
40 | "BTN_DPAD_UP" => Ok(Axis::BTN_DPAD_UP),
41 | "BTN_DPAD_DOWN" => Ok(Axis::BTN_DPAD_DOWN),
42 | "BTN_DPAD_LEFT" => Ok(Axis::BTN_DPAD_LEFT),
43 | "BTN_DPAD_RIGHT" => Ok(Axis::BTN_DPAD_RIGHT),
44 | "LSTICK_UP" => Ok(Axis::LSTICK_UP),
45 | "LSTICK_DOWN" => Ok(Axis::LSTICK_DOWN),
46 | "LSTICK_LEFT" => Ok(Axis::LSTICK_LEFT),
47 | "LSTICK_RIGHT" => Ok(Axis::LSTICK_RIGHT),
48 | "RSTICK_UP" => Ok(Axis::RSTICK_UP),
49 | "RSTICK_DOWN" => Ok(Axis::RSTICK_DOWN),
50 | "RSTICK_LEFT" => Ok(Axis::RSTICK_LEFT),
51 | "RSTICK_RIGHT" => Ok(Axis::RSTICK_RIGHT),
52 | "SCROLL_WHEEL_UP" => Ok(Axis::SCROLL_WHEEL_UP),
53 | "SCROLL_WHEEL_DOWN" => Ok(Axis::SCROLL_WHEEL_DOWN),
54 | "BTN_TL2" => Ok(Axis::BTN_TL2),
55 | "BTN_TR2" => Ok(Axis::BTN_TR2),
56 | "ABS_WHEEL_CW" => Ok(Axis::ABS_WHEEL_CW),
57 | "ABS_WHEEL_CCW" => Ok(Axis::ABS_WHEEL_CCW),
58 | _ => Err(s.to_string()),
59 | }
60 | }
61 | }
62 |
63 | #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
64 | pub enum Relative {
65 | Cursor(Cursor),
66 | Scroll(Scroll),
67 | }
68 |
69 | #[allow(non_camel_case_types)]
70 | #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
71 | pub enum Cursor {
72 | CURSOR_UP,
73 | CURSOR_DOWN,
74 | CURSOR_LEFT,
75 | CURSOR_RIGHT,
76 | }
77 |
78 | #[allow(non_camel_case_types)]
79 | #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
80 | pub enum Scroll {
81 | SCROLL_UP,
82 | SCROLL_DOWN,
83 | SCROLL_LEFT,
84 | SCROLL_RIGHT,
85 | }
86 |
87 | impl FromStr for Relative {
88 | type Err = String;
89 | fn from_str(s: &str) -> Result {
90 | match s {
91 | "CURSOR_UP" => Ok(Relative::Cursor(Cursor::CURSOR_UP)),
92 | "CURSOR_DOWN" => Ok(Relative::Cursor(Cursor::CURSOR_DOWN)),
93 | "CURSOR_LEFT" => Ok(Relative::Cursor(Cursor::CURSOR_LEFT)),
94 | "CURSOR_RIGHT" => Ok(Relative::Cursor(Cursor::CURSOR_RIGHT)),
95 | "SCROLL_UP" => Ok(Relative::Scroll(Scroll::SCROLL_UP)),
96 | "SCROLL_DOWN" => Ok(Relative::Scroll(Scroll::SCROLL_DOWN)),
97 | "SCROLL_LEFT" => Ok(Relative::Scroll(Scroll::SCROLL_LEFT)),
98 | "SCROLL_RIGHT" => Ok(Relative::Scroll(Scroll::SCROLL_RIGHT)),
99 | _ => Err(s.to_string()),
100 | }
101 | }
102 | }
103 |
104 | #[derive(Debug, PartialEq, Eq, Default, Clone)]
105 | pub struct Associations {
106 | pub client: Client,
107 | pub layout: u16,
108 | }
109 |
110 | #[derive(Default, Debug, Clone)]
111 | pub struct Bindings {
112 | pub remap: HashMap, Vec>>,
113 | pub commands: HashMap, Vec>>,
114 | pub movements: HashMap, Relative>>,
115 | }
116 |
117 | #[derive(Default, Debug, Clone)]
118 | pub struct MappedModifiers {
119 | pub default: Vec,
120 | pub custom: Vec,
121 | pub all: Vec,
122 | }
123 |
124 | #[derive(serde::Deserialize, Debug, Clone)]
125 | pub struct RawConfig {
126 | #[serde(default)]
127 | pub remap: HashMap>,
128 | #[serde(default)]
129 | pub commands: HashMap>,
130 | #[serde(default)]
131 | pub movements: HashMap,
132 | #[serde(default)]
133 | pub settings: HashMap,
134 | }
135 |
136 | impl RawConfig {
137 | fn new_from_file(file: &str) -> Self {
138 | println!(
139 | "Parsing config file:\n{:?}\n",
140 | file.rsplit_once("/").unwrap().1
141 | );
142 | let file_content: String = std::fs::read_to_string(file).unwrap();
143 | let raw_config: RawConfig =
144 | toml::from_str(&file_content).expect("Couldn't parse config file.");
145 | let remap = raw_config.remap;
146 | let commands = raw_config.commands;
147 | let movements = raw_config.movements;
148 | let settings = raw_config.settings;
149 | Self {
150 | remap,
151 | commands,
152 | movements,
153 | settings,
154 | }
155 | }
156 | }
157 |
158 | #[derive(Debug, Clone)]
159 | pub struct Config {
160 | pub name: String,
161 | pub associations: Associations,
162 | pub bindings: Bindings,
163 | pub settings: HashMap,
164 | pub mapped_modifiers: MappedModifiers,
165 | }
166 |
167 | impl Config {
168 | pub fn new_from_file(file: &str, file_name: String) -> Self {
169 | let raw_config = RawConfig::new_from_file(file);
170 | let (bindings, settings, mapped_modifiers) = parse_raw_config(raw_config);
171 | let associations = Default::default();
172 |
173 | Self {
174 | name: file_name,
175 | associations,
176 | bindings,
177 | settings,
178 | mapped_modifiers,
179 | }
180 | }
181 |
182 | pub fn new_empty(file_name: String) -> Self {
183 | Self {
184 | name: file_name,
185 | associations: Default::default(),
186 | bindings: Default::default(),
187 | settings: Default::default(),
188 | mapped_modifiers: Default::default(),
189 | }
190 | }
191 | }
192 |
193 | fn parse_raw_config(raw_config: RawConfig) -> (Bindings, HashMap, MappedModifiers) {
194 | let remap: HashMap> = raw_config.remap;
195 | let commands: HashMap> = raw_config.commands;
196 | let movements: HashMap = raw_config.movements;
197 | let settings: HashMap = raw_config.settings;
198 | let mut bindings: Bindings = Default::default();
199 | let default_modifiers = vec![
200 | Event::Key(Key::KEY_LEFTSHIFT),
201 | Event::Key(Key::KEY_LEFTCTRL),
202 | Event::Key(Key::KEY_LEFTALT),
203 | Event::Key(Key::KEY_RIGHTSHIFT),
204 | Event::Key(Key::KEY_RIGHTCTRL),
205 | Event::Key(Key::KEY_RIGHTALT),
206 | Event::Key(Key::KEY_LEFTMETA),
207 | ];
208 | let mut mapped_modifiers = MappedModifiers {
209 | default: default_modifiers,
210 | custom: Vec::new(),
211 | all: Vec::new(),
212 | };
213 | let custom_modifiers: Vec = parse_modifiers(&settings, "CUSTOM_MODIFIERS");
214 | let lstick_activation_modifiers: Vec =
215 | parse_modifiers(&settings, "LSTICK_ACTIVATION_MODIFIERS");
216 | let rstick_activation_modifiers: Vec =
217 | parse_modifiers(&settings, "RSTICK_ACTIVATION_MODIFIERS");
218 |
219 | mapped_modifiers.custom.extend(custom_modifiers);
220 | mapped_modifiers.custom.extend(lstick_activation_modifiers);
221 | mapped_modifiers.custom.extend(rstick_activation_modifiers);
222 |
223 | for (input, output) in remap.clone() {
224 | if let Some((mods, event)) = input.rsplit_once("-") {
225 | let str_modifiers = mods.split("-").collect::>();
226 | let mut modifiers: Vec = Vec::new();
227 | for event in str_modifiers.clone() {
228 | if let Ok(axis) = Axis::from_str(event) {
229 | modifiers.push(Event::Axis(axis));
230 | } else if let Ok(key) = Key::from_str(event) {
231 | modifiers.push(Event::Key(key));
232 | }
233 | }
234 | modifiers.sort();
235 | modifiers.dedup();
236 | for modifier in &modifiers {
237 | if !mapped_modifiers.default.contains(&modifier) {
238 | mapped_modifiers.custom.push(modifier.clone());
239 | }
240 | }
241 | if str_modifiers[0] == "" {
242 | modifiers.push(Event::Hold);
243 | }
244 | if let Ok(event) = Axis::from_str(event) {
245 | if !bindings.remap.contains_key(&Event::Axis(event)) {
246 | bindings
247 | .remap
248 | .insert(Event::Axis(event), HashMap::from([(modifiers, output)]));
249 | } else {
250 | bindings
251 | .remap
252 | .get_mut(&Event::Axis(event))
253 | .unwrap()
254 | .insert(modifiers, output);
255 | }
256 | } else if let Ok(event) = Key::from_str(event) {
257 | if !bindings.remap.contains_key(&Event::Key(event)) {
258 | bindings
259 | .remap
260 | .insert(Event::Key(event), HashMap::from([(modifiers, output)]));
261 | } else {
262 | bindings
263 | .remap
264 | .get_mut(&Event::Key(event))
265 | .unwrap()
266 | .insert(modifiers, output);
267 | }
268 | }
269 | } else {
270 | let modifiers: Vec = Vec::new();
271 | if let Ok(event) = Axis::from_str(input.as_str()) {
272 | if !bindings.remap.contains_key(&Event::Axis(event)) {
273 | bindings
274 | .remap
275 | .insert(Event::Axis(event), HashMap::from([(modifiers, output)]));
276 | } else {
277 | bindings
278 | .remap
279 | .get_mut(&Event::Axis(event))
280 | .unwrap()
281 | .insert(modifiers, output);
282 | }
283 | } else if let Ok(event) = Key::from_str(input.as_str()) {
284 | if !bindings.remap.contains_key(&Event::Key(event)) {
285 | bindings
286 | .remap
287 | .insert(Event::Key(event), HashMap::from([(modifiers, output)]));
288 | } else {
289 | bindings
290 | .remap
291 | .get_mut(&Event::Key(event))
292 | .unwrap()
293 | .insert(modifiers, output);
294 | }
295 | }
296 | }
297 | }
298 |
299 | for (input, output) in commands.clone() {
300 | if let Some((mods, event)) = input.rsplit_once("-") {
301 | let str_modifiers = mods.split("-").collect::>();
302 | let mut modifiers: Vec = Vec::new();
303 | for event in str_modifiers {
304 | if let Ok(axis) = Axis::from_str(event) {
305 | modifiers.push(Event::Axis(axis));
306 | } else if let Ok(key) = Key::from_str(event) {
307 | modifiers.push(Event::Key(key));
308 | }
309 | }
310 | modifiers.sort();
311 | modifiers.dedup();
312 | for modifier in &modifiers {
313 | if !mapped_modifiers.default.contains(&modifier) {
314 | mapped_modifiers.custom.push(modifier.clone());
315 | }
316 | }
317 | if let Ok(event) = Axis::from_str(event) {
318 | if !bindings.commands.contains_key(&Event::Axis(event)) {
319 | bindings
320 | .commands
321 | .insert(Event::Axis(event), HashMap::from([(modifiers, output)]));
322 | } else {
323 | bindings
324 | .commands
325 | .get_mut(&Event::Axis(event))
326 | .unwrap()
327 | .insert(modifiers, output);
328 | }
329 | } else if let Ok(event) = Key::from_str(event) {
330 | if !bindings.commands.contains_key(&Event::Key(event)) {
331 | bindings
332 | .commands
333 | .insert(Event::Key(event), HashMap::from([(modifiers, output)]));
334 | } else {
335 | bindings
336 | .commands
337 | .get_mut(&Event::Key(event))
338 | .unwrap()
339 | .insert(modifiers, output);
340 | }
341 | }
342 | } else {
343 | let modifiers: Vec = Vec::new();
344 | if let Ok(event) = Axis::from_str(input.as_str()) {
345 | if !bindings.commands.contains_key(&Event::Axis(event)) {
346 | bindings
347 | .commands
348 | .insert(Event::Axis(event), HashMap::from([(modifiers, output)]));
349 | } else {
350 | bindings
351 | .commands
352 | .get_mut(&Event::Axis(event))
353 | .unwrap()
354 | .insert(modifiers, output);
355 | }
356 | } else if let Ok(event) = Key::from_str(input.as_str()) {
357 | if !bindings.commands.contains_key(&Event::Key(event)) {
358 | bindings
359 | .commands
360 | .insert(Event::Key(event), HashMap::from([(modifiers, output)]));
361 | } else {
362 | bindings
363 | .commands
364 | .get_mut(&Event::Key(event))
365 | .unwrap()
366 | .insert(modifiers, output);
367 | }
368 | }
369 | }
370 | }
371 |
372 | for (input, output) in movements.clone() {
373 | if let Some((mods, event)) = input.rsplit_once("-") {
374 | let str_modifiers = mods.split("-").collect::>();
375 | let mut modifiers: Vec = Vec::new();
376 | for event in str_modifiers.clone() {
377 | if let Ok(axis) = Axis::from_str(event) {
378 | modifiers.push(Event::Axis(axis));
379 | } else if let Ok(key) = Key::from_str(event) {
380 | modifiers.push(Event::Key(key));
381 | }
382 | }
383 | modifiers.sort();
384 | modifiers.dedup();
385 | for modifier in &modifiers {
386 | if !mapped_modifiers.default.contains(&modifier) {
387 | mapped_modifiers.custom.push(modifier.clone());
388 | }
389 | }
390 | if str_modifiers[0] == "" {
391 | modifiers.push(Event::Hold);
392 | }
393 | if let Ok(event) = Axis::from_str(event) {
394 | if !bindings.movements.contains_key(&Event::Axis(event)) {
395 | bindings.movements.insert(
396 | Event::Axis(event),
397 | HashMap::from([(
398 | modifiers,
399 | Relative::from_str(output.as_str())
400 | .expect("Invalid movement in [movements]."),
401 | )]),
402 | );
403 | } else {
404 | bindings
405 | .movements
406 | .get_mut(&Event::Axis(event))
407 | .unwrap()
408 | .insert(
409 | modifiers,
410 | Relative::from_str(output.as_str())
411 | .expect("Invalid movement in [movements]."),
412 | );
413 | }
414 | } else if let Ok(event) = Key::from_str(event) {
415 | if !bindings.movements.contains_key(&Event::Key(event)) {
416 | bindings.movements.insert(
417 | Event::Key(event),
418 | HashMap::from([(
419 | modifiers,
420 | Relative::from_str(output.as_str())
421 | .expect("Invalid movement in [movements]."),
422 | )]),
423 | );
424 | } else {
425 | bindings
426 | .movements
427 | .get_mut(&Event::Key(event))
428 | .unwrap()
429 | .insert(
430 | modifiers,
431 | Relative::from_str(output.as_str())
432 | .expect("Invalid movement in [movements]."),
433 | );
434 | }
435 | }
436 | } else {
437 | let modifiers: Vec = Vec::new();
438 | if let Ok(event) = Axis::from_str(input.as_str()) {
439 | if !bindings.movements.contains_key(&Event::Axis(event)) {
440 | bindings.movements.insert(
441 | Event::Axis(event),
442 | HashMap::from([(
443 | modifiers,
444 | Relative::from_str(output.as_str())
445 | .expect("Invalid movement in [movements]."),
446 | )]),
447 | );
448 | } else {
449 | bindings
450 | .movements
451 | .get_mut(&Event::Axis(event))
452 | .unwrap()
453 | .insert(
454 | modifiers,
455 | Relative::from_str(output.as_str())
456 | .expect("Invalid movement in [movements]."),
457 | );
458 | }
459 | } else if let Ok(event) = Key::from_str(input.as_str()) {
460 | if !bindings.movements.contains_key(&Event::Key(event)) {
461 | bindings.movements.insert(
462 | Event::Key(event),
463 | HashMap::from([(
464 | modifiers,
465 | Relative::from_str(output.as_str())
466 | .expect("Invalid movement in [movements]."),
467 | )]),
468 | );
469 | } else {
470 | bindings
471 | .movements
472 | .get_mut(&Event::Key(event))
473 | .unwrap()
474 | .insert(
475 | modifiers,
476 | Relative::from_str(output.as_str())
477 | .expect("Invalid movement in [movements]."),
478 | );
479 | }
480 | }
481 | }
482 | }
483 |
484 | mapped_modifiers.custom.sort();
485 | mapped_modifiers.custom.dedup();
486 | mapped_modifiers
487 | .all
488 | .extend(mapped_modifiers.default.clone());
489 | mapped_modifiers.all.extend(mapped_modifiers.custom.clone());
490 | mapped_modifiers.all.sort();
491 | mapped_modifiers.all.dedup();
492 |
493 | (bindings, settings, mapped_modifiers)
494 | }
495 |
496 | pub fn parse_modifiers(settings: &HashMap, parameter: &str) -> Vec {
497 | match settings.get(¶meter.to_string()) {
498 | Some(modifiers) => {
499 | let mut custom_modifiers = Vec::new();
500 | let split_modifiers = modifiers.split("-").collect::>();
501 | for modifier in split_modifiers {
502 | if let Ok(key) = Key::from_str(modifier) {
503 | custom_modifiers.push(Event::Key(key));
504 | } else if let Ok(axis) = Axis::from_str(modifier) {
505 | custom_modifiers.push(Event::Axis(axis));
506 | } else {
507 | println!("Invalid value used as modifier in {}, ignoring.", parameter);
508 | }
509 | }
510 | custom_modifiers
511 | }
512 | None => Vec::new(),
513 | }
514 | }
515 |
--------------------------------------------------------------------------------
/src/main.rs:
--------------------------------------------------------------------------------
1 | mod active_client;
2 | mod config;
3 | mod event_reader;
4 | mod udev_monitor;
5 | mod virtual_devices;
6 |
7 | use crate::udev_monitor::*;
8 | use config::Config;
9 | use std::env;
10 | use tokio;
11 | use tokio::task::JoinHandle;
12 |
13 | #[tokio::main]
14 | async fn main() {
15 | let config_path = match env::var("MAKIMA_CONFIG") {
16 | Ok(path) => {
17 | println!("\nMAKIMA_CONFIG set to {:?}.\n", path);
18 | match std::fs::read_dir(path) {
19 | Ok(dir) => dir,
20 | _ => {
21 | println!("Directory not found, exiting Makima.");
22 | std::process::exit(0);
23 | }
24 | }
25 | }
26 | Err(_) => {
27 | let user_home = match env::var("HOME") {
28 | Ok(user_home) if user_home == "/root".to_string() => match env::var("SUDO_USER") {
29 | Ok(sudo_user) => format!("/home/{}", sudo_user),
30 | _ => user_home,
31 | },
32 | Ok(user_home) => user_home,
33 | _ => "/root".to_string(),
34 | };
35 | let default_config_path = format!("{}/.config/makima", user_home);
36 | println!(
37 | "\nMAKIMA_CONFIG environment variable is not set, defaulting to {:?}.\n",
38 | default_config_path
39 | );
40 | match std::fs::read_dir(default_config_path) {
41 | Ok(dir) => dir,
42 | _ => {
43 | println!("Directory not found, exiting Makima.");
44 | std::process::exit(0);
45 | }
46 | }
47 | }
48 | };
49 | let mut config_files: Vec = Vec::new();
50 | for file in config_path {
51 | let filename: String = file.as_ref().unwrap().file_name().into_string().unwrap();
52 | if filename.ends_with(".toml") && !filename.starts_with(".") {
53 | let name: String = filename.split(".toml").collect::>()[0].to_string();
54 | let config_file: Config =
55 | Config::new_from_file(file.unwrap().path().to_str().unwrap(), name);
56 | config_files.push(config_file);
57 | }
58 | }
59 | let tasks: Vec> = Vec::new();
60 | start_monitoring_udev(config_files, tasks).await;
61 | }
62 |
--------------------------------------------------------------------------------
/src/udev_monitor.rs:
--------------------------------------------------------------------------------
1 | use crate::config::{Associations, Event};
2 | use crate::event_reader::EventReader;
3 | use crate::virtual_devices::VirtualDevices;
4 | use crate::Config;
5 | use evdev::{Device, EventStream};
6 | use std::{env, path::Path, process::Command, sync::Arc};
7 | use tokio::sync::Mutex;
8 | use tokio::task::JoinHandle;
9 | use tokio_stream::StreamExt;
10 |
11 | #[derive(Debug, Default, Eq, PartialEq, Hash, Clone)]
12 | pub enum Client {
13 | #[default]
14 | Default,
15 | Class(String),
16 | }
17 |
18 | #[derive(Clone)]
19 | pub enum Server {
20 | Connected(String),
21 | Unsupported,
22 | Failed,
23 | }
24 |
25 | #[derive(Clone)]
26 | pub struct Environment {
27 | pub user: Result,
28 | pub sudo_user: Result,
29 | pub server: Server,
30 | }
31 |
32 | pub async fn start_monitoring_udev(config_files: Vec, mut tasks: Vec>) {
33 | let environment = set_environment();
34 | launch_tasks(&config_files, &mut tasks, environment.clone());
35 | let mut monitor = tokio_udev::AsyncMonitorSocket::new(
36 | tokio_udev::MonitorBuilder::new()
37 | .unwrap()
38 | .match_subsystem(std::ffi::OsStr::new("input"))
39 | .unwrap()
40 | .listen()
41 | .unwrap(),
42 | )
43 | .unwrap();
44 | while let Some(Ok(event)) = monitor.next().await {
45 | if is_mapped(&event.device(), &config_files) {
46 | println!("---------------------\n\nReinitializing...\n");
47 | for task in &tasks {
48 | task.abort();
49 | }
50 | tasks.clear();
51 | launch_tasks(&config_files, &mut tasks, environment.clone())
52 | }
53 | }
54 | }
55 |
56 | pub fn launch_tasks(
57 | config_files: &Vec,
58 | tasks: &mut Vec>,
59 | environment: Environment,
60 | ) {
61 | let modifiers: Arc>> = Arc::new(Mutex::new(Default::default()));
62 | let modifier_was_activated: Arc> = Arc::new(Mutex::new(true));
63 | let user_has_access = match Command::new("groups").output() {
64 | Ok(groups)
65 | if std::str::from_utf8(&groups.stdout.as_slice())
66 | .unwrap()
67 | .contains("input") =>
68 | {
69 | println!("Evdev permissions available.\nScanning for event devices with a matching config file...\n");
70 | true
71 | }
72 | Ok(groups)
73 | if std::str::from_utf8(&groups.stdout.as_slice())
74 | .unwrap()
75 | .contains("root") =>
76 | {
77 | println!("Root permissions available.\nScanning for event devices with a matching config file...\n");
78 | true
79 | }
80 | Ok(_) => {
81 | println!("Warning: user has no access to event devices, Makima might not be able to detect all connected devices.\n\
82 | Note: Run Makima with 'sudo -E makima' or as a system service. Refer to the docs for more info. Continuing...\n");
83 | false
84 | }
85 | Err(_) => {
86 | println!(
87 | "Warning: unable to determine if user has access to event devices. Continuing...\n"
88 | );
89 | false
90 | }
91 | };
92 | let devices: evdev::EnumerateDevices = evdev::enumerate();
93 | let mut devices_found = 0;
94 | for device in devices {
95 | let mut config_list: Vec = Vec::new();
96 | for mut config in config_files.clone() {
97 | let split_config_name = config.name.split("::").collect::>();
98 | let associated_device_name = split_config_name[0];
99 | if associated_device_name == device.1.name().unwrap().replace("/", "") {
100 | let (window_class, layout) = match split_config_name.len() {
101 | 1 => (Client::Default, 0),
102 | 2 => {
103 | if let Ok(layout) = split_config_name[1].parse::() {
104 | (Client::Default, layout)
105 | } else {
106 | (Client::Class(split_config_name[1].to_string()), 0)
107 | }
108 | }
109 | 3 => {
110 | if let Ok(layout) = split_config_name[1].parse::() {
111 | (Client::Class(split_config_name[2].to_string()), layout)
112 | } else if let Ok(layout) = split_config_name[2].parse::() {
113 | (Client::Class(split_config_name[1].to_string()), layout)
114 | } else {
115 | println!("Warning: unable to parse layout number in {}, treating it as default.", config.name);
116 | (Client::Default, 0)
117 | }
118 | }
119 | _ => {
120 | println!("Warning: too many arguments in config file name {}, treating it as default.", config.name);
121 | (Client::Default, 0)
122 | }
123 | };
124 | config.associations.client = window_class;
125 | config.associations.layout = layout;
126 | config_list.push(config.clone());
127 | };
128 | }
129 | if config_list.len() > 0
130 | && !config_list
131 | .iter()
132 | .any(|x| x.associations == Associations::default())
133 | {
134 | config_list.push(Config::new_empty(device.1.name().unwrap().replace("/", "")));
135 | }
136 | let event_device = device.0.as_path().to_str().unwrap().to_string();
137 | if config_list.len() != 0 {
138 | let stream = Arc::new(Mutex::new(get_event_stream(
139 | Path::new(&event_device),
140 | config_list.clone(),
141 | )));
142 | let virt_dev = Arc::new(Mutex::new(VirtualDevices::new(device.1)));
143 | let reader = EventReader::new(
144 | config_list.clone(),
145 | virt_dev,
146 | stream,
147 | modifiers.clone(),
148 | modifier_was_activated.clone(),
149 | environment.clone(),
150 | );
151 | tasks.push(tokio::spawn(start_reader(reader)));
152 | devices_found += 1
153 | }
154 | }
155 | if devices_found == 0 && !user_has_access {
156 | println!("No matching devices found.\nNote: make sure that your user has access to event devices.\n");
157 | } else if devices_found == 0 && user_has_access {
158 | println!("No matching devices found.\nNote: double-check that your device and its associated config file have the same name, as reported by 'evtest'.\n");
159 | }
160 | }
161 |
162 | pub async fn start_reader(reader: EventReader) {
163 | reader.start().await;
164 | }
165 |
166 | fn set_environment() -> Environment {
167 | match env::var("DBUS_SESSION_BUS_ADDRESS") {
168 | Ok(_) => copy_variables(),
169 | Err(_) => {
170 | let uid = Command::new("sh").arg("-c").arg("id -u").output().unwrap();
171 | let uid_number = std::str::from_utf8(uid.stdout.as_slice()).unwrap().trim();
172 | if uid_number != "0" {
173 | let bus_address = format!("unix:path=/run/user/{}/bus", uid_number);
174 | env::set_var("DBUS_SESSION_BUS_ADDRESS", bus_address);
175 | copy_variables()
176 | } else {
177 | println!("Warning: unable to inherit user environment.\n\
178 | Launch Makima with 'sudo -E makima' or make sure that your systemd unit is running with the 'User=' parameter.\n");
179 | }
180 | }
181 | };
182 | if let (Err(env::VarError::NotPresent), Ok(_)) =
183 | (env::var("XDG_SESSION_TYPE"), env::var("WAYLAND_DISPLAY"))
184 | {
185 | env::set_var("XDG_SESSION_TYPE", "wayland")
186 | }
187 |
188 | let supported_compositors = vec!["Hyprland", "sway", "KDE", "niri"]
189 | .into_iter()
190 | .map(|str| String::from(str))
191 | .collect::>();
192 | let (x11, wayland) = (String::from("x11"), String::from("wayland"));
193 | let server: Server = match (
194 | env::var("XDG_SESSION_TYPE"),
195 | env::var("XDG_CURRENT_DESKTOP"),
196 | ) {
197 | (Ok(session), Ok(desktop))
198 | if session == wayland && supported_compositors.contains(&desktop) =>
199 | {
200 | let server = 'a: {
201 | if desktop == String::from("KDE") {
202 | if let Err(_) = Command::new("kdotool").output() {
203 | println!(
204 | "Running on KDE but kdotool doesn't seem to be installed.\n\
205 | Won't be able to change bindings according to the active window.\n"
206 | );
207 | break 'a Server::Unsupported;
208 | }
209 | }
210 | println!("Running on {}, per application bindings enabled.", desktop);
211 | Server::Connected(desktop)
212 | };
213 | server
214 | }
215 | (Ok(session), Ok(desktop)) if session == wayland => {
216 | println!("Warning: unsupported compositor: {}, won't be able to change bindings according to the active window.\n\
217 | Currently supported desktops: Hyprland, Sway, Niri, Plasma/KWin, X11.\n", desktop);
218 | Server::Unsupported
219 | }
220 | (Ok(session), _) if session == x11 => {
221 | println!("Running on X11, per application bindings enabled.");
222 | Server::Connected(session)
223 | }
224 | (Ok(session), Err(_)) if session == wayland => {
225 | println!("Warning: unable to retrieve the current desktop based on XDG_CURRENT_DESKTOP env var.\n\
226 | Won't be able to change bindings according to the active window.\n");
227 | Server::Unsupported
228 | }
229 | (Err(_), _) => {
230 | println!("Warning: unable to retrieve the session type based on XDG_SESSION_TYPE or WAYLAND_DISPLAY env vars.\n\
231 | Is your Wayland compositor or X server running?\n\
232 | Exiting Makima.");
233 | std::process::exit(0);
234 | }
235 | _ => Server::Failed,
236 | };
237 |
238 | Environment {
239 | user: env::var("USER"),
240 | sudo_user: env::var("SUDO_USER"),
241 | server,
242 | }
243 | }
244 |
245 | fn copy_variables() {
246 | let command = Command::new("sh")
247 | .arg("-c")
248 | .arg("systemctl --user show-environment")
249 | .output()
250 | .unwrap();
251 | let vars = std::str::from_utf8(command.stdout.as_slice())
252 | .unwrap()
253 | .split("\n")
254 | .collect::>();
255 | for var in vars {
256 | if let Some((variable, value)) = var.split_once("=") {
257 | if let Err(env::VarError::NotPresent) = env::var(variable) {
258 | env::set_var(variable, value);
259 | } else if variable == "PATH" {
260 | env::set_var("PATH", format!("{}:{}", value, env::var("PATH").unwrap()));
261 | }
262 | }
263 | }
264 | }
265 |
266 | pub fn get_event_stream(path: &Path, config: Vec) -> EventStream {
267 | let mut device: Device = Device::open(path).expect("Couldn't open device path.");
268 | match config
269 | .iter()
270 | .find(|&x| x.associations == Associations::default())
271 | .unwrap()
272 | .settings
273 | .get("GRAB_DEVICE")
274 | {
275 | Some(value) => {
276 | if value == &true.to_string() {
277 | device
278 | .grab()
279 | .expect("Unable to grab device. Is another instance of Makima running?")
280 | }
281 | }
282 | None => device
283 | .grab()
284 | .expect("Unable to grab device. Is another instance of Makima running?"),
285 | }
286 | let stream: EventStream = device.into_event_stream().unwrap();
287 | return stream;
288 | }
289 |
290 | pub fn is_mapped(udev_device: &tokio_udev::Device, config_files: &Vec) -> bool {
291 | match udev_device.devnode() {
292 | Some(devnode) => {
293 | let evdev_devices: evdev::EnumerateDevices = evdev::enumerate();
294 | for evdev_device in evdev_devices {
295 | for config in config_files {
296 | if config
297 | .name
298 | .contains(&evdev_device.1.name().unwrap().to_string().replace("/", ""))
299 | && devnode.to_path_buf() == evdev_device.0
300 | {
301 | return true;
302 | }
303 | }
304 | }
305 | }
306 | _ => return false,
307 | }
308 | return false;
309 | }
310 |
--------------------------------------------------------------------------------
/src/virtual_devices.rs:
--------------------------------------------------------------------------------
1 | use evdev::{
2 | uinput::{VirtualDevice, VirtualDeviceBuilder},
3 | Key,
4 | };
5 |
6 | pub struct VirtualDevices {
7 | pub keys: VirtualDevice,
8 | pub axis: VirtualDevice,
9 | pub abs: VirtualDevice,
10 | }
11 |
12 | impl VirtualDevices {
13 | pub fn new(device: evdev::Device) -> Self {
14 | let mut key_capabilities = evdev::AttributeSet::new();
15 | for i in 1..334 {
16 | key_capabilities.insert(Key(i));
17 | }
18 | let mut axis_capabilities = evdev::AttributeSet::new();
19 | for i in 0..13 {
20 | axis_capabilities.insert(evdev::RelativeAxisType(i));
21 | }
22 | let mut tablet_abs_capabilities: Vec = Vec::new();
23 | if let Ok(absinfo) = device.get_abs_state() {
24 | for (axis_type, info) in absinfo.iter().enumerate() {
25 | if [0, 1, 2, 5, 6, 8, 24, 25, 26, 27, 40].contains(&axis_type) {
26 | let new_absinfo = evdev::AbsInfo::new(
27 | info.value,
28 | info.minimum,
29 | info.maximum,
30 | info.fuzz,
31 | info.flat,
32 | info.resolution,
33 | );
34 | tablet_abs_capabilities.push(evdev::UinputAbsSetup::new(
35 | evdev::AbsoluteAxisType(axis_type.try_into().unwrap()),
36 | new_absinfo,
37 | ))
38 | }
39 | }
40 | }
41 | let mut tablet_capabilities = evdev::AttributeSet::new();
42 | for i in 272..277 {
43 | tablet_capabilities.insert(evdev::Key(i));
44 | }
45 | for i in 320..325 {
46 | tablet_capabilities.insert(evdev::Key(i));
47 | }
48 | for i in 326..328 {
49 | tablet_capabilities.insert(evdev::Key(i));
50 | }
51 | for i in 330..333 {
52 | tablet_capabilities.insert(evdev::Key(i));
53 | }
54 | let mut tab_rel = evdev::AttributeSet::new();
55 | tab_rel.insert(evdev::RelativeAxisType(8));
56 | let mut tab_msc = evdev::AttributeSet::new();
57 | tab_msc.insert(evdev::MiscType(0));
58 | let pointer_prop = device.properties();
59 | let keys_builder = VirtualDeviceBuilder::new()
60 | .expect("Unable to create virtual device through uinput. Take a look at the Troubleshooting section for more info.")
61 | .name("Makima Virtual Keyboard/Mouse")
62 | .with_keys(&key_capabilities).unwrap();
63 | let axis_builder = VirtualDeviceBuilder::new()
64 | .expect("Unable to create virtual device through uinput. Take a look at the Troubleshooting section for more info.")
65 | .name("Makima Virtual Pointer")
66 | .with_relative_axes(&axis_capabilities).unwrap();
67 | let mut abs_builder = VirtualDeviceBuilder::new()
68 | .expect("Unable to create virtual device through uinput. Take a look at the Troubleshooting section for more info.")
69 | .name("Makima Virtual Pen/Tablet")
70 | .with_properties(&pointer_prop).unwrap()
71 | .with_msc(&tab_msc).unwrap()
72 | .with_relative_axes(&tab_rel).unwrap()
73 | .with_keys(&tablet_capabilities).unwrap()
74 | .input_id(device.input_id());
75 | for abs_setup in tablet_abs_capabilities {
76 | abs_builder = abs_builder.with_absolute_axis(&abs_setup).unwrap();
77 | }
78 | let virtual_device_keys = keys_builder.build().unwrap();
79 | let virtual_device_axis = axis_builder.build().unwrap();
80 | let virtual_device_abs = abs_builder.build().unwrap();
81 | Self {
82 | keys: virtual_device_keys,
83 | axis: virtual_device_axis,
84 | abs: virtual_device_abs,
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------