Skip to content

Commit c871854

Browse files
committed
faq: merge content of tips-and-tricks.md
1 parent 8135637 commit c871854

File tree

3 files changed

+152
-144
lines changed

3 files changed

+152
-144
lines changed

src/faq.md

+152
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33
1. [Keybinds](#keybinds)
44
1. [Unset Keybinds](#unset-keybinds)
55
2. [Common Keybinds](#common-keybinds)
6+
3. [Keybind Forwarding](#keybind-forwarding)
67
2. [Theme](#theme)
78
1. [Server Side Decoration](#server-side-decoration)
89
3. [Mouse and Trackpads](#mouse-and-trackpads)
910
1. [Libinput](#libinput)
11+
4. [XML](#xml)
12+
1. [XML Nodenames](#xml-nodenames)
13+
5. [Scripting](#scripting)
14+
1. [Run or Raise](#run-or-raise)
15+
6. [Environment Variables](#environment-variables)
16+
7. [Nested XWayland](#nested-xwayland)
1017

1118
# 1. Keybinds {#keybinds}
1219

@@ -66,6 +73,23 @@ In true `sway` style:
6673
<keybind key="W-S-3"><action name="SendToDesktop" to="3" follow="false"/></keybind>
6774
```
6875

76+
## 1.3 Keybind Forwarding {#keybind-forwarding}
77+
78+
The [ToggleKeybinds] action allows better control of Virtual Machines, VNC
79+
clients, nested compositors or similar.
80+
81+
For example, to make alt-tab work in a nested compositor add the code below to
82+
`~/.config/labwc/rc.xml` and then press F12 to disable all keybinds in the
83+
parent compositor and thereby forward them to the nested instance.
84+
85+
```
86+
<keybind key="F12">
87+
<action name="ToggleKeybinds"/>
88+
</keybind>
89+
```
90+
91+
[ToggleKeybinds]: https://labwc.github.io/labwc-actions.5.html#entry_action_name=togglekeybinds
92+
6993
# 2. Theme {#theme}
7094

7195
## 2.1 Server Side Decoration {#server-side-decoration}
@@ -126,4 +150,132 @@ Not yet implemented.
126150
</mouse>
127151
```
128152

153+
# 4. XML {#xml}
154+
155+
## 4.1 XML Nodenames {#xml-nodenames}
156+
157+
### Q: My config file does not work. How can I debug it?
158+
159+
You a can a nested instance of labwc in a terminal to see the error messages
160+
relating to bad XML syntax of missing elements/attributes.
161+
162+
For more fine-grained analysis you can see the config/menu file nodenames when
163+
`labwc` starts, by setting the following environment variables:
164+
165+
```
166+
LABWC_DEBUG_CONFIG_NODENAMES=1
167+
LABWC_DEBUG_MENU_NODENAMES=1
168+
```
169+
170+
With `labwc` a nodename is a way to refer to each element and attribute in an
171+
XML tree. For example, the `<c>` element below would be assigned the nodename
172+
`c.b.a`:
173+
174+
```
175+
<a>
176+
<b>
177+
<c>foo</c>
178+
</b>
179+
</a>
180+
```
181+
182+
Please note that `labwc` also parses the rc.xml configuration file in an
183+
element/attribute agnostic way, which means that `<a><b>foo</b></a>` is
184+
equivalent to `<a b="foo"/>`. Be careful though, because this does not apply to
185+
some aspects of menu.xml (specifically the attributes id, label and execute).
186+
187+
In practical terms, this means that the following syntax could be used:
188+
189+
```
190+
<keybind key="W-l" name.action="Execute" command.action="swaylock -c 000000"/>
191+
```
192+
193+
...rather than then lengthier:
194+
195+
```
196+
<keybind key="W-l">
197+
<action name="Execute">
198+
<command>swaylock -c 000000"</command>
199+
</action>
200+
</keybind>
201+
```
202+
203+
See [labwc-config(5)-syntax] for more details.
204+
205+
[labwc-config(5)-syntax]: https://labwc.github.io/labwc-config.5.html#syntax
206+
207+
# 5. Scripting {#scripting}
208+
209+
## 5.2 Run or Raise {#run-or-raise}
210+
211+
The [wlr-foreign-toplevel-management] protocol provides clients with a list of
212+
opened applications and lets them request certain actions on them, like
213+
maximizing, focusing, etc. This can be used for scripting with clients such as
214+
[wlrctl] and [lswt]. For example, the script below launches an application
215+
if it is not already running, or focuses the application's most recently opened
216+
window if it is already running:
217+
218+
```
219+
#!/bin/sh
220+
221+
if test -z "$1"; then
222+
echo "Usage: runraise app_id [executable]"
223+
exit 1
224+
fi
225+
226+
app_id=$1
227+
executable=$2
228+
test -z "$executable" && executable=$app_id
229+
230+
if ! wlrctl window focus "$app_id"; then
231+
$executable &
232+
disown
233+
fi
234+
```
235+
236+
As of labwc version 0.7.2 it is also possible to create a run or raise keybind
237+
with the `ForEach` action:
238+
239+
```
240+
<keybind key="W-F1">
241+
<action name="ForEach">
242+
<query identifier="foot" />
243+
<then>
244+
<action name="Raise" />
245+
<action name="Focus" />
246+
</then>
247+
<none>
248+
<action name="Execute" command="foot" />
249+
</none>
250+
</action>
251+
</keybind>
252+
```
253+
254+
[wlrctl]: https://git.sr.ht/~brocellous/wlrctl
255+
[lswt]: https://sr.ht/~leon_plickat/lswt/
256+
[wlr-foreign-toplevel-management]: https://wayland.app/protocols/wlr-foreign-toplevel-management-unstable-v1
257+
258+
# 6. Environment Variables {#environment-variables}
259+
260+
There are a number of advanced settings that can be invoked for `wlroots` by
261+
setting some environment variables.
262+
263+
For example `labwc` can be run nested on Wayland with multiple outputs using
264+
the following: `WLR_WL_OUTPUTS=2 labwc`
265+
266+
See the wlroots repo [env_vars.md] file for details.
267+
268+
[env_vars.md]: https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/docs/env_vars.md
269+
270+
# 7. Nested XWayland {#nested-xwayland}
271+
272+
To run a nested instance of openbox on labwc:
273+
274+
```
275+
Xwayland -decorate -noreset :55
276+
DISPLAY=:55 dbus-run-session openbox-session
277+
278+
```
279+
280+
129281

src/more.md

-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
- [hidpi scaling](hidpi-scaling.html)
44
- [links](links.html)
55
- [obligatory screenshot](obligatory-screenshot.html)
6-
- [tips and tricks](tips-and-tricks.html)
76
- [troubleshooting](troubleshooting.html)
87

src/tips-and-tricks.md

-143
This file was deleted.

0 commit comments

Comments
 (0)