Labwc

From ArchWiki

Labwc stands for Lab Wayland Compositor[1]. According to the official website:

Labwc is a wlroots-based window-stacking compositor for wayland, inspired by openbox.
It is light-weight and independent with a focus on simply stacking windows well and rendering some window decorations. It relies on clients for panels, screenshots, wallpapers and so on to create a full desktop environment.
Labwc tries to stay in keeping with wlroots and sway in terms of general approach and coding style.
Labwc only understands wayland-protocols & wlr-protocols, and it cannot be controlled with dbus, sway/i3-IPC or other technology. The reason for this is that we believe that custom IPCs and protocols create a fragmentation that hinders general Wayland adoption.

Installation

Labwc can be installed with the packages labwcAUR or labwc-gitAUR.

The default terminal emulator is foot. Before starting labwc it is advisable to either install it or set a new terminal in the configuration.

Starting

Like all wlroots-based compositors, for access to your seat, labwc requires Polkit to be installed when using systemd-logind(8), or seatd service to be enabled with your user added to the seat user group.

To start labwc, type labwc in the Linux console or use wayland-compatible Display manager.

By default, you can press Super (usually a key with a Window icon) with s to launch alacritty. See 6. Usage for the default keybindings.

Configuration

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: Multiple sections duplicate upstream documentation. (Discuss in Talk:Labwc)

Following files can be used for configuration:

  • ~/.config/labwc/rc.xml - for general configuration
  • ~/.config/labwc/menu.xml - for menu layout
  • ~/.config/labwc/autostart - script executed when launching labwc
  • ~/.config/labwc/shutdown - script executed when exiting labwc
  • ~/.config/labwc/environment - for environment variables in the session
  • ~/.config/labwc/themerc-override - for additional theme settings

Example files are provided in /usr/share/doc/labwc/. Especially, /usr/share/doc/labwc/rc.xml.all contains all the default configurations.

See labwc-config(5) for further details.

Autostart

~/.config/labwc/autostart contains a shell script executed when launching labwc. For example:

~/.config/labwc/autostart
kanshi >/dev/null 2>&1 &
waybar >/dev/null 2>&1 &
swaybg -i ~/Pictures/background.png >/dev/null 2>&1 &
lxqt-policykit-agent >/dev/null 2>&1 &
mako >/dev/null 2>&1 &
gammastep -O 3500 -b 0.8 >/dev/null 2>&1 &

Keymap

The keyboard layout can be configured by setting environemnt variables in ~/.config/labwc/environment. For example:

~/.config/labwc/environment
XKB_DEFAULT_LAYOUT=us
XKB_DEFAULT_LAYOUT=us,de
XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle
XKB_DEFAULT_OPTIONS=grp:shift_caps_toggle

See xkeyboard-config(7) for details.

Statusbar

Use external tools like waybar and sfwbarAUR can be used to show status bars. For example:

~/.config/labwc/autostart
waybar >/dev/null 2>&1 &

Outputs

Use external tools like wlr-randr and kanshi can be used to manage outputs. For example:

~/.config/labwc/autostart
wlr-randr --output HDMI-A-2 --preferred --pos 0,0 --output HDMI-A-1 --preferred --pos -1920,0

Wallpaper

Use external tools like swaybg, wpaperd and wbgAUR can be used to show backgrounds. For example:

~/.config/labwc/autostart
swaybg -c '#113344' >/dev/null 2>&1 &

Custom keybindings

Keybindings are configured by adding <keyboard><keybind> sections with <action>. For example:

~/.config/labwc/rc.xml
<labwc_config>
  <keyboard>
    <keybind key="W-q"><action name="Close" /></keybind>
    <keybind key="A-Tab"><action name="NextWindow" /></keybind>
    <keybind key="W-Tab"><action name="ToggleMaximize" /></keybind>
    <keybind key="W-s"><action name="Execute" command="foot" /></keybind>
    <keybind key="W-a"><action name="Execute" command="fuzzel" /></keybind>
  </keyboard>
</labwc_config>

Workspaces

Workspaces are configured in <desktops> section and switched with keybindings. For example:

~/.config/labwc/rc.xml
<labwc_config>
  <desktops number="4" />
  <keyboard>
    <keybind key="W-1"><action name="GoToDesktop" to="1" /></keybind>
    <keybind key="W-2"><action name="GoToDesktop" to="2" /></keybind>
    <keybind key="W-3"><action name="GoToDesktop" to="3" /></keybind>
    <keybind key="W-4"><action name="GoToDesktop" to="4" /></keybind>
  </keyboard>
</labwc_config>

Menu

Labwc follows Openbox's syntax for menu configuration in ~/.config/labwc/menu.xml. For example:

~/.config/labwc/menu.xml
<?xml version="1.0" ?>
<openbox_menu>
  <menu id="root-menu" label="">
    <item label="󰈹   Firefox">
      <action name="Execute" command="firefox" />
    </item>
    <item label="  Terminal">
      <action name="Execute" command="foot" />
    </item>
  </menu>
</openbox_menu>

Also, you can use menu generators for Openbox like archlinux-xdg-menu and obmenu-generatorAUR.

See labwc-menu(5) for details.

Themes

Labwc loosely follows Openbox 3 theme specification. You can install themes to following directories:

  • ~/.local/share/themes/<theme-name>/openbox-3/
  • ~/.themes/<theme-name>/openbox-3/
  • /usr/share/themes/<theme-name>/openbox-3/
  • /usr/local/share/themes/<theme-name>/openbox-3/
  • /opt/share/themes/<theme-name>/openbox-3/

These directories contain themerc which defines the theme colors and geometries, and button icon files like close-active.svg and close-inactive.svg. XBM, SVG and PNG formats are supported for icon files.

Additionally, you can override the theme entries with ~/.config/themerc-override.

labwc-artwork provides some themes for labwc.

See labwc-theme(5) for details.

Xwayland

xorg-xwayland starts automatically if Xwayland support is enabled at build time. To force disable it, set:

~/.config/labwc/environment
WLR_XWAYLAND=

See also