-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.typ
72 lines (60 loc) · 3.01 KB
/
README.typ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
= RayGreet
This document is generated by `README.typ` using #link("https://pandoc.org/")[pandoc].
== Installation
=== Pre-requist
+ Install #link("https://ziglang.org/download/")[zig] programming language (version: master branch)
+ Clone this repo using command `git clone --single-branch -b main --depth=1 'https://git.sr.ht/~meow_king/raygreet'`
+ Clone #link("https://github.com/raysan5/raylib")[raylib] as `./lib/raylib`, you can run the following command
```bash
cd ./raygreet
rm ./lib/raylib # remove the original symbol link in this repo
git clone --single-branch -b master --depth=1 'https://github.com/raysan5/raylib.git' ./lib/raylib
```
=== Manually Build
If you have #link("https://github.com/casey/just")[just] installed, then run command `just install`.
Or you need to run the following command:
```bash
sudo zig build -Doptimize=ReleaseSafe -Dplatform_drm
sudo cp ./zig-out/bin/raygreet /usr/bin/raygreet
sudo chmod a+s /usr/bin/raygreet
```
Check the file permission by `ls -l /usr/bin/raygreet`, if you see
```
-rwsr-sr-x 1 root root 1052768 Feb 14 10:36 /usr/bin/raygreet
```
and `s` is the fourth character and the file is owned by `root`, then we installed it successfully. \
`s` means this file is always executed as the file owner (in this case, `root`), so we are in `input` group and can
access `/dev/input/event*` files, which is required by Raylib. However, instead of
```
sudo chmod a+s /usr/bin/raygreet
```
You can also make `greeter` user in `input` group using the following command
```bash
sudo usermod greeter -a -G input
```
== Develop
=== Test in TTY
+ You need #link("https://git.sr.ht/~kennylevinsen/greetd/tree")[fakegreet], which can built with the following command
```bash
git clone --single-branch -b master --depth=1 'https://git.sr.ht/~kennylevinsen/greetd'
cd ./greetd
cargo build # use `--release` to build in release mode
cp ./target/debug/fakegreet ~/.local/bin/
```
+ Change to `TTY<number>` using key `Ctrl + Alt + F<number>`
+ then run `just run-drm` or
```bash
zig build -Dplatform_drm
sudo fakegreet "./zig-out/bin/raygreet"
```
== Current Issues
1. Only officially support US keyboards. Other keyboards may have wrong mappings for some keys.
It is due to that Raylib currently uses a US keymap to map #link("https://en.wikipedia.org/wiki/Scancode")[scancode]
to key code. See #link("https://github.com/raysan5/raylib/blob/7ec43022c177cbf00b27c9e9ab067bd6889957a4/src/platforms/rcore_drm.c#L145")[raylib source]. \
You can test it in TTY to see if it works correctly.
Here is the #link("https://github.com/raysan5/raylib/discussions/3773")[discussion].
Developer notes: \
1. evdev key code: /usr/share/X11/xkb/keycodes/evdev
2. scancode: /usr/include/linux/input-event-codes.h
= TODO
1. support choosing start session at runtime (and store the last choice)