forge
Explore
Log in

Don't you dare go Hollow

wiki: Add a Screencasting page

Browse files at this commit

62576796be91a5425abb6a1e8af35ebeca3fbcadIvan MolodetskikhParent: 31891e6
wiki/Screencasting.mdadded+114 -0
@@ -0,0 +1,114 @@
1+### Overview
2+
3+The primary screencasting interface that niri offers is through portals and pipewire.
4+It is supported by [OBS], Firefox, Chromium, Electron, Telegram, and other apps.
5+You can screencast both monitors and individual windows.
6+
7+In order to use it, you need a working D-Bus session, pipewire, `xdg-desktop-portal-gnome`, and [running niri as a session](./Getting-Started.md) (i.e. through `niri-session` or from a display manager).
8+On widely used distros this should all "just work".
9+
10+Alternatively, you can use tools that rely on the `wlr-screencopy` protocol, which niri also supports.
11+
12+There are several features in niri designed for screencasting.
13+Let's take a look!
14+
15+### Block out windows
16+
17+You can block out specific windows from screencasts, replacing them with solid black rectangles.
18+This can be useful for password managers or messenger windows, etc.
19+
20+![Screenshot showing a window visible normally, but blocked out on OBS.](./img/block-out-from-screencast.png)
21+
22+This is controlled through the `block-out-from` window rule, for example:
23+
24+```kdl
25+// Block out password managers from screencasts.
26+window-rule {
27+ match app-id=r#"^org\.keepassxc\.KeePassXC$"#
28+ match app-id=r#"^org\.gnome\.World\.Secrets$"#
29+
30+ block-out-from "screencast"
31+}
32+```
33+
34+You can similarly block out layer surfaces, using a layer rule:
35+
36+```kdl
37+// Block out mako notifications from screencasts.
38+layer-rule {
39+ match namespace="^notifications$"
40+
41+ block-out-from "screencast"
42+}
43+```
44+
45+Check [the corresponding wiki section](./Configuration:-Window-Rules.md#block-out-from) for more details and examples.
46+
47+### Dynamic screencast target
48+
49+<sup>Since: next release</sup>
50+
51+Niri provides a special screencast stream that you can change dynamically.
52+It shows up as "niri Dynamic Cast Target" in the screencast window dialog.
53+
54+![Screencast dialog showing niri Dynamic Cast Target.](https://github.com/user-attachments/assets/e236ce74-98ec-4f3a-a99b-29ac1ff324dd)
55+
56+When you select it, it will start as an empty, transparent video stream.
57+Then, you can use the following binds to change what it shows:
58+
59+- `set-dynamic-cast-window` to cast the focused window.
60+- `set-dynamic-cast-monitor` to cast the focused monitor.
61+- `clear-dynamic-cast-target` to go back to an empty stream.
62+
63+You can also use these actions from the command line, for example to interactively pick which window to cast:
64+
65+```sh
66+$ niri msg action set-dynamic-cast-window --id $(niri msg --json pick-window | jq .id)
67+```
68+
69+https://github.com/user-attachments/assets/c617a9d6-7d5e-4f1f-b8cc-9301182d9634
70+
71+If the cast target disappears (e.g. the target window closes), the stream goes back to empty.
72+
73+All dynamic casts share the same target, but new ones start out empty until the next time you change it (to avoid surprises and sharing something sensitive by mistake).
74+
75+### Indicate screencasted windows
76+
77+<sup>Since: 25.02</sup>
78+
79+The [`is-window-cast-target=true` window rule](./Configuration:-Window-Rules.md#is-window-cast-target) matches windows targetted by an ongoing window screencast.
80+You use it with a special border color to clearly indicate screencasted windows.
81+
82+This also works for windows targetted by dynamic screencasts.
83+However, it will not work for windows that just happen to be visible in a full-monitor screencast.
84+
85+```kdl
86+// Indicate screencasted windows with red colors.
87+window-rule {
88+ match is-window-cast-target=true
89+
90+ focus-ring {
91+ active-color "#f38ba8"
92+ inactive-color "#7d0d2d"
93+ }
94+
95+ border {
96+ inactive-color "#7d0d2d"
97+ }
98+
99+ shadow {
100+ color "#7d0d2d70"
101+ }
102+
103+ tab-indicator {
104+ active-color "#f38ba8"
105+ inactive-color "#7d0d2d"
106+ }
107+}
108+```
109+
110+Example:
111+
112+![Screencasted window indicated with a red border and shadow.](https://github.com/user-attachments/assets/375b381e-3a87-4e94-8676-44404971d893)
113+
114+[OBS]: https://obsproject.com/
wiki/_Sidebar.mdmodified+1 -0
@@ -4,6 +4,7 @@
4 * [Important Software](./Important-Software.md)4 * [Important Software](./Important-Software.md)
5 * [Floating Windows](./Floating-Windows.md)5 * [Floating Windows](./Floating-Windows.md)
6 * [Tabs](./Tabs.md)6 * [Tabs](./Tabs.md)
7+* [Screencasting](./Screencasting.md)
7 * [Layer‐Shell Components](./Layer%E2%80%90Shell-Components.md)8 * [Layer‐Shell Components](./Layer%E2%80%90Shell-Components.md)
8 * [IPC, `niri msg`](./IPC.md)9 * [IPC, `niri msg`](./IPC.md)
9 * [Application-Specific Issues](./Application-Issues.md)10 * [Application-Specific Issues](./Application-Issues.md)