summaryrefslogtreecommitdiffstats
path: root/2022/info/wayland-after.md
blob: c4ee53cd6bafd37a245499c5cb5602f28a7bff87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!-- Automatically generated by emacsconf-publish-after-page -->


<a name="wayland-mainVideo-transcript"></a>
# Transcript

[[!template text="""Hello EmacsConf and hello fellow Emacs fans.""" start="00:00:00.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""My name is Michael Bauer, and I'm from Germany.""" start="00:00:08.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I'm gonna talk to you about &quot;Why and how Emacs""" start="00:00:10.920" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""should become a Wayland compositor.&quot;""" start="00:00:13.440" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And it already kinda is a Wayland compositor.""" start="00:00:17.200" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""This talk is composed by Wayland and Emacs.""" start="00:00:21.740" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""If I'm talking about a Wayland compositor""" start="00:00:25.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""or Emacs as Wayland compositor,""" start="00:00:26.840" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I mean it in the sense that""" start="00:00:29.360" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""EXWM is an X window manager. I hope you know EXWM.""" start="00:00:30.440" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""So, why?""" start="00:00:36.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Emacs can do Wayland now, that was a stopper""" start="00:00:41.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""before, and now it's solved with `pgtk` branch.""" start="00:00:44.120" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It makes the Emacs toolbox bigger,""" start="00:00:49.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""which is always a good thing.""" start="00:00:53.240" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And the cool thing about Wayland, which is not""" start="00:00:55.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""possible under X is, it can run standalone""" start="00:00:58.440" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""on the Linux kernel interface, or nested under X,""" start="00:01:02.280" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""or even nested under Wayland.""" start="00:01:06.840" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""The compositor features of Emacs doesn't mean""" start="00:01:09.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""it has to take over the whole output.""" start="00:01:13.840" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It can use them, even if it's just like""" start="00:01:16.960" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""a normal window or normal program.""" start="00:01:20.560" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And last reason is,""" start="00:01:23.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I want to keep living inside Emacs""" start="00:01:25.120" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and Wayland is the future, apparently.""" start="00:01:27.240" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""EXWM use case is the first use case.""" start="00:01:31.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""You take a Wayland surface and put it inside""" start="00:01:35.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""an Emacs window. You see it right below.""" start="00:01:38.400" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""The video of me is a Wayland surface,""" start="00:01:41.520" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and it's inside an Emacs window managed by Emacs.""" start="00:01:45.880" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Emacs does the input, and the clipboard handling,""" start="00:01:50.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and can insert itself here, and do great things.""" start="00:01:53.480" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And it's a possibility to Lispify the Linux desktop,""" start="00:01:59.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""as Emacs Lispifies the command line.""" start="00:02:03.200" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""The other use case is the XWidget use case.""" start="00:02:08.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I don't know if you know XWidgets.""" start="00:02:12.960" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's embedded X windows inside Emacs.""" start="00:02:17.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""There's a web browser available in Emacs.""" start="00:02:19.720" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""With Wayland, you could embed anything that can""" start="00:02:24.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""create a Wayland surface like video, web, or 3D.""" start="00:02:27.520" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Think OpenGL, something like""" start="00:02:32.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""EmacsGL would be possible.""" start="00:02:34.880" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And we wouldn't have just images like we have so far.""" start="00:02:38.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""So, how to implement this Wayland compositor?""" start="00:02:46.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I'm going to tell you how I did it,""" start="00:02:50.560" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""or I did this demo I'm showing you right now.""" start="00:02:52.560" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""First of all, how does Wayland work?""" start="00:02:57.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Wayland is a protocol in XML.""" start="00:03:00.680" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's a server and client, and they share a set of""" start="00:03:04.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""objects, and the objects have methods.""" start="00:03:11.120" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""They are specified in the protocol,""" start="00:03:13.960" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and Wayland also says how the server""" start="00:03:16.120" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and client talk to each other.""" start="00:03:24.080" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""First blocker for Emacs becoming a Wayland""" start="00:03:25.720" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""compositor is that Emacs and Wayland both have""" start="00:03:33.440" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""their own event loop, and you can't merge them too.""" start="00:03:37.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""But you don't have to merge them""" start="00:03:41.880" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""because you can just make Emacs speak Wayland.""" start="00:03:45.800" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""So, Emacs becomes a Wayland client,""" start="00:03:48.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and there's an extra server Emacs is talking to.""" start="00:03:50.040" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""So, we need a minimal Wayland server that does all""" start="00:03:53.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""the stuff Emacs can't do and do the rest in Emacs.""" start="00:03:59.160" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""---The minimal Wayland server, I did it in wlroots.""" start="00:04:03.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""That's the library behind Sway. I think it's""" start="00:04:07.800" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""the Wayland library to do stuff like this.""" start="00:04:13.040" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I implemented four different things to make it work.""" start="00:04:20.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's these three letter acronyms on the left.""" start="00:04:26.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's Emacs, Wayland, and then it's a server,""" start="00:04:30.680" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""a client, a protocol, and buffers.""" start="00:04:34.520" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""The server is written in C and it's mostly tinywl.""" start="00:04:38.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's the example of wlroots,""" start="00:04:44.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and it's around 1000 lines of code.""" start="00:04:46.280" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""ewc, the Wayland client in Emacs,""" start="00:04:52.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""is the thing I'm most proud of.""" start="00:04:54.960" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's 300 lines of code, and it is a""" start="00:04:58.560" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""fully featured Wayland client in Emacs.""" start="00:05:02.120" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""With this, Emacs can speak Wayland,""" start="00:05:08.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and then I implemented Emacs Wayland protocol.""" start="00:05:11.640" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It more or less allows Emacs to become a Wayland""" start="00:05:18.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""window manager, so it's not actually the compositor.""" start="00:05:21.280" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""The compositor stays in C, but Emacs is""" start="00:05:24.640" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""now a Wayland window manager!""" start="00:05:27.680" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And the last thing is Emacs Wayland buffers.""" start="00:05:31.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's the window manager part.""" start="00:05:34.520" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's around 500 lines of code,""" start="00:05:35.880" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and it does the buffer management inside""" start="00:05:38.440" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Emacs windows, or floating right like you see me""" start="00:05:41.680" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""now floating on the right.""" start="00:05:45.680" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It works, but it is still buggy,""" start="00:05:48.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and it is also missing input handling,""" start="00:05:51.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""so there's more code to come for this to work.""" start="00:05:54.320" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Some caveats about this approach.""" start="00:06:01.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""wlroots is around 60 kilo LoCs (Line of Code)""" start="00:06:05.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and in active development.""" start="00:06:09.640" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""They have like a slogan 60 kilo locs of code""" start="00:06:12.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""you had to write anyway to make a Wayland""" start="00:06:16.640" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""compositor. And no, you don't have to write it.""" start="00:06:19.760" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""But I still remember when it was like 50 kilo locs,""" start="00:06:22.520" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and now it's 60. And it's like a moving target.""" start="00:06:25.840" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I think it could be quite a lot of work""" start="00:06:29.680" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""to keep up with it.""" start="00:06:32.480" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Yeah, it could be quite a bit of work.""" start="00:06:34.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Some windows don't like to keep the aspect ratios.""" start="00:06:41.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""You tell them and you have to crop them.""" start="00:06:46.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And the interface I use in wlroots for doing this,""" start="00:06:49.560" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""`wlr_scene`, can't do cropping yet,""" start="00:06:53.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""so this doesn't work.""" start="00:06:57.280" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Another problem is with GTK.""" start="00:07:01.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Once Wayland is enabled and it stays on.""" start="00:07:03.240" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""This doesn't make sense.""" start="00:07:11.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Okay, if you kill the Wayland server,""" start="00:07:12.560" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""GTK kills Emacs, that's not a good thing.""" start="00:07:15.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And it's still a bit of work and fussing needed""" start="00:07:18.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""to get this to work reliably.""" start="00:07:21.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It's quite buggy right now.""" start="00:07:23.640" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And that brings me to my call to action.""" start="00:07:26.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I think making Emacs Wayland capable is""" start="00:07:30.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""a further step to make an Emacs OS.""" start="00:07:34.440" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""It gains output and input handling.""" start="00:07:39.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Output handling is already there,""" start="00:07:41.360" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""input handling is still missing,""" start="00:07:44.120" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""but Emacs can manage monitors, outputs,""" start="00:07:45.760" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""different frames if it's like nested,""" start="00:07:49.720" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And inputs, keyboards, simulation keys,""" start="00:07:53.040" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""stuff like that.""" start="00:07:57.080" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""We could use it in more ways for Emacs display, maybe.""" start="00:07:58.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Wayland just manages simple pixel buffers,""" start="00:08:02.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""so it's a protocol for managing pixel buffers.""" start="00:08:05.720" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And in a sense, we could go back to""" start="00:08:09.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""the old X ways and maybe even ditch GTK.""" start="00:08:12.560" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I don't know, but why need it?""" start="00:08:15.560" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""We can composite without it.""" start="00:08:18.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Let's make buffer menus, buffer world, buffer.""" start="00:08:20.600" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Emacs Wayland protocol, like I did it,""" start="00:08:27.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""allows a very concise design, and it allows""" start="00:08:29.040" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""to improve on the EXWM code base.""" start="00:08:34.040" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""And I wrote KISS style because EXWM has""" start="00:08:38.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""workspace management integrated.""" start="00:08:41.840" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I don't think that's needed, like Emacs does it.""" start="00:08:45.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Why do you have to do something extra?""" start="00:08:50.600" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""So why do it?""" start="00:08:53.640" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""To finish the call to action,""" start="00:08:56.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""if this is the thing you want to see in Emacs,""" start="00:09:00.040" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""maybe you want to get involved, have some ideas,""" start="00:09:03.280" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""so we could discuss it.""" start="00:09:06.600" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I'm looking forward to discuss with you""" start="00:09:10.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""and hear your questions and ideas.""" start="00:09:14.960" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""I want to say a big thank you to the""" start="00:09:21.000" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""organizers of EmacsConf and the other speakers""" start="00:09:24.200" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""for making this event possible.""" start="00:09:26.600" video="mainVideo-wayland" id="subtitle"]]
[[!template text="""Thank you, and see you.""" start="00:09:29.000" video="mainVideo-wayland" id="subtitle"]]

Questions or comments? Please e-mail [perma-curious@posteo.de](mailto:perma-curious@posteo.de?subject=Comment%20for%20EmacsConf%202022%20wayland%3A%20Emacs%20should%20become%20a%20Wayland%20compositor)


<!-- End of emacsconf-publish-after-page -->