This commit is contained in:
Hiroaki Yamamoto 2024-08-25 11:32:23 +03:00 committed by GitHub
commit f0d50891e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 713 additions and 65 deletions

View file

@ -3,6 +3,7 @@ Config layout for ~/.config/labwc/
- environment
- menu.xml
- rc.xml
- rc.yaml
- shutdown
- themerc-override
- xinitrc

View file

@ -8,7 +8,8 @@ labwc - configuration files
Labwc uses openbox-3.6 specification for configuration and theming, but does not
support all options. The following files form the basis of the labwc
configuration: rc.xml, menu.xml, autostart, shutdown, environment and xinitrc.
configuration: rc.xml (or rc.yaml), menu.xml, autostart, shutdown, environment
and xinitrc.
No configuration files are needed to start and run labwc.
@ -158,6 +159,77 @@ Note that in this manual, Boolean values are listed as [yes|no] for simplicity,
but it's also possible to use [true|false] and\/or [on|off];
this is for compatibility with Openbox.
## YAML SUPPORT
Labwc also supports YAML language for configuration. When rc.yaml exists
instead of rc.xml, labwc internally converts it from YAML into XML and loads
configurations from it. For example, "foo: bar" in YAML is converted to
"<foo>bar</foo>" in XML. See /usr/share/docs/labwc/rc.yaml for an example
configuration in YAML.
If rc.yaml includes a key-value pair where the value is an array, it is
converted to a sequence of <key>array-element</key> in XML.
For example, a YAML expression:
```
touch:
- deviceName: xxxx
mapToOutput: eDP-1
- deviceName: yyyy
mapToOutput: HDMI-1
```
is converted to an XML expression:
```
<touch>
<deviceName>xxxx</deviceName>
<mapToOutput>eDP-1</mapToOutput>
</touch>
<touch>
<deviceName>yyyy</deviceName>
<mapToOutput>eDP-1</mapToOutput>
</touch>
```
To avoid unnecessary indentations, some nodes that wrap array elements in XML
can be ommitted. This includes:
- *<windowSwitcher><fields><field>*
- *<regions><region>*
- *<windowRules><windowRule>*
- *<libinput><device>*
- *<desktops><names><name>*
For example, window switcher can be configured like:
```
windowSwitcher:
fields:
- content: type
width: 15%
- content: title
width: 85%
```
In addition, some specific keys in singular form with a sequence value in YAML
are converted to plural form in XML. This includes:
- *keybinds* (converted to *keybind*)
- *mousebinds* (converted to *mousebind*)
- *actions* (converted to *action*)
- *fonts* (converted to *font*)
- *contexts* (converted to *context*)
For example, keybinds can be configured like:
```
keybinds:
- { key: W-s, action: { name: Execute, command: foot } }
- { key: W-a, action: { name: Execute, command: fuzzel } }
```
## CORE
```
@ -575,9 +647,9 @@ extending outward from the snapped edge.
Load the default keybinds listed below. This is an addition to the
openbox specification and provides a way to keep config files simpler
whilst allowing your specific keybinds.
Note that if no rc.xml is found, or if no <keyboard><keybind> entries
exist, the same default keybinds will be loaded even if the <default />
element is not provided.
Note that if no rc.xml or rc.yaml is found, or if no <keyboard><keybind>
entries exist, the same default keybinds will be loaded even if the
<default /> element is not provided.
```
A-Tab - next window
@ -668,9 +740,10 @@ extending outward from the snapped edge.
*<mouse><default />*
Load default mousebinds. This is an addition to the openbox
specification and provides a way to keep config files simpler whilst
allowing user specific binds. Note that if no rc.xml is found, or if no
<mouse><mousebind> entries exist, the same default mousebinds will be
loaded even if the <default /> element is not provided.
allowing user specific binds. Note that if no rc.xml or rc.yaml is
found, or if no <mouse><mousebind> entries exist, the same default
mousebinds will be loaded even if the <default /> element is not
provided.
## TOUCH

View file

@ -106,13 +106,23 @@ ID attributes are unique. Duplicates are ignored.
When writing pipe menu scripts, make sure to escape XML special characters such
as "&" ("&amp;"), "<" ("&lt;"), and ">" ("&gt;").
# LOCALISATION
Available localisation for the default "client-menu" is only shown if no
"client-menu" is present in menu.xml. Any menu definition in menu.xml is
interpreted as a user-override.
# YAML SUPPORT
Like rc.yaml, labwc supports menu.yaml instead of menu.xml. See labwc-config(5)
for its syntax. Note that following keys in singular form can be expressed as
plural form in menu.yaml:
- *menus* (converted to *menu*)
- *items* (converted to *item*)
See /usr/share/docs/labwc/menu.yaml for an example menu configuration in YAML.
# SEE ALSO
labwc(1), labwc-actions(5), labwc-config(5), labwc-theme(5)

33
docs/menu.yaml Normal file
View file

@ -0,0 +1,33 @@
menu:
- id: client-menu
item:
label: Minimize
action: { name: Iconify }
item:
label: Maximize
action: { name: ToggleMaximize }
menu:
id: workspaces
label: Workspace
item:
label: Move Left
action: { name: SendToDesktop, to: left }
item:
label: Move Right
action: { name: SendToDesktop, to: right }
separator:
item:
label: Always on Visible Workspace
action: { name: ToggleOmnipresent }
item:
label: Close
action: { name: Close }
- id: root-menu
items:
- label: Terminal
action: { name: Execute, command: alacritty }
- label: Reconfigure
action: { name: Reconfigure }
- label: Exit
action: { name: Exit }

View file

@ -33,7 +33,8 @@ install_data(
'shutdown',
'themerc',
'rc.xml',
'rc.xml.all'
'rc.xml.all',
'rc.yaml',
],
install_dir: get_option('datadir') / 'doc' / meson.project_name()
)

89
docs/rc.yaml Normal file
View file

@ -0,0 +1,89 @@
# An example configuration file in YAML. To see all the configurations and
# their descriptions, see docs/rc.xml.all or labwc-config(5).
core:
xwaylandPersistence: yes
placement:
policy: cascade
theme:
dropShadows: yes
fonts:
- place: ActiveWindow
weight: bold
- place: InactiveWindow
weight: normal
desktops:
number: 2
windowSwitcher:
fields:
- content: type
width: 15%
- content: title
width: 85%
resize:
drawContents: no
focus:
followMouse: yes
followMouseRequiresMovement: yes
raiseOnFocus: no
snapping:
range: 20
overlay:
delay:
inner: 100
outer: 0
regions:
- { name: top-left, x: 0%, y: 0%, width: 50%, height: 50% }
- { name: top-right, x: 50%, y: 0%, width: 50%, height: 50% }
- { name: bottom-left, x: 0%, y: 50%, width: 50%, height: 50% }
- { name: bottom-right, x: 50%, y: 50%, width: 50%, height: 50% }
keyboard:
repeatRate: 25
repeatDelay: 600
keybinds:
- { key: W-bracketRight, action: { name: ZoomIn } }
- { key: W-bracketLeft, action: { name: ZoomOut } }
- { key: W-d, action: { name: Debug } }
- { key: W-1, action: { name: GoToDesktop, to: Workspace 1 } }
- { key: W-2, action: { name: GoToDesktop, to: Workspace 2 } }
- { key: W-m, action: { name: ToggleKeybinds } }
- { key: W-q, action: { name: Close } }
- { key: A-F4, action: { name: Close } }
- { key: A-Tab, action: { name: NextWindow } }
- { key: W-e, action: { name: Exit } }
- { key: W-v, action: { name: Execute, command: sh -c 'cliphist list | fuzzel --dmenu | cliphist decode | wl-copy' } }
- { key: W-Tab, action: { name: ToggleMaximize } }
- { key: W-s, action: { name: Execute, command: foot } }
- { key: W-a, action: { name: Execute, command: fuzzel } }
- { key: XF86_AudioLowerVolume, action: { name: Execute, command: pactl set-sink-volume @DEFAULT_SINK@ -2dB } }
- { key: XF86_AudioRaiseVolume, action: { name: Execute, command: pactl set-sink-volume @DEFAULT_SINK@ +2dB } }
- { key: XF86_AudioMute, action: { name: Execute, command: pactl set-sink-mute @DEFAULT_SINK@ toggle } }
- { key: XF86_AudioMicMute, action: { name: Execute, command: pactl set-source-mute @DEFAULT_SOURCE@ toggle } }
- { key: Print, action: { name: Execute, command: grim } }
mouse:
doubleClickTime: 200
default:
contexts:
- name: Frame
mousebinds:
- { button: W-Left, action: Press, actions: [ { name: Raise }, { name: Move } ] }
- { button: W-Right, action: Drag, action: { name: Raise } }
- { button: A-Left, action: Press }
- { button: A-Left, action: Drag }
- { button: A-Right, action: Press }
- { button: A-Right, action: Drag }
touch:
deviceName: ELAN2514:00 04F3:2AF1
mapToOutput: eDP-1
tablet:
mapToOutput: eDP-1
libinput:
- category: non-touch
pointerSpeed: -0.4
- category: touchpad
naturalScroll: yes
tapAndDrag: no
windowRules:
- identifier: ristretto
serverDecoration: no
- identifier: code-url-handler
action: { name: SetDecorations, decorations: border, forceSSD: yes }