Labwc
labwc is a stacking wlroots-based Wayland compositor, inspired by openbox.
Installation
USE flags
The following USE flags are available:
~amd64, X, nls, svg
Emerge
labwc is currently only available in the wayland-desktop ebuild repository.
If the overlay is not activated, run:
root #
eselect repository enable wayland-desktop
root #
emaint sync -r wayland-desktop
After activating the overlay, install by:
root #
emerge --ask gui-wm/labwc
Configuration
The configuration of labwc aligns with openbox in order to avoid reinventing configuration and theme syntaxes, the openbox 3.6 specification is used. This does not mean that labwc is an openbox clone but rather that configuration files will look and feel familiar.
There are five configuration files:
~/.config/labwc/ is used to store the user-specific custom version of these files, though it needs to be created and populated.
For example:
user $
mkdir -p ~/.config/labwc/
user $
bzcat /usr/share/doc/labwc/rc.xml.all.bz2 > ~/.config/labwc/rc.xml
user $
bzcat /usr/share/doc/labwc/menu.xml.bz2 > ~/.config/labwc/menu.xml
user $
vim ~/.config/labwc/autostart
Starting
To start labwc it is possible to use a display manager or via a tty.
labwc can be started from a tty or a terminal with:
user $
dbus-run-session labwc
For display manager that utilise *.desktop files, a labwc.desktop file is installed in /usr/share/wayland-sessions.
for login managers like greetd a suitable startup script can be produced and the relevant entry added to /etc/greetd/environments
autostart
The autostart script is the place to execute specific commands and programs when labwc starts. It makes no difference if labwc is started via a tty command or a display manager, autostart will be executed either way.
# start pipewire sound service
gentoo-pipewire-launcher restart &
# ensure relevant portals are launched
/usr/libexec/xdg-desktop-portal-gtk -r &
/usr/libexec/xdg-document-portal -r &
/usr/libexec/flatpak-portal --no-idle-exit -r &
sh -c 'sleep 5;exec /usr/libexec/xdg-desktop-portal -r' &
sh -c 'sleep 5;exec /usr/libexec/xdg-desktop-portal-wlr -r' &
# set a wallpaper
swaybg -i ~/Pictures/wallpaper-WoT.jpg -m fill &
# additional wayland helpers
mako &
waybar &
# any other useful commands
xhost +SI:localuser:$(id -un) &
xhost +SI:localuser:root &
discord --enable-features=UseOzonePlatform --ozone-platform=wayland &
thunar --daemon &
flatpak run com.valvesoftware.Steam -console -silent &
environment
The environment script is the place to export global variables and configure the Openbox environment.
XKB_DEFAULT_LAYOUT=gb
QT_WAYLAND_DISABLE_WINDOWDECORATION=1
QT_AUTO_SCREEN_SCALE_FACTOR=1
QT_QPA_PLATFORMTHEME=qt5ct
QT_QPA_PLATFORM="wayland;xcb"
_JAVA_AWT_WM_NONREPARENTING=1
NO_AT_BRIDGE=1
GTK_USE_PORTAL=0
CLUTTER_BACKEND=wayland
SDL_VIDEODRIVER="wayland,x11"
SDL_AUDIODRIVE=pipewire
The menu.xml file defines the right-click labwc menus. By default the right-click menu is predefined with some common applications, so unless the applications are installed on the system most of the default links on the menu will not be operational.
The default menu.xml can be seen below
<?xml version="1.0" ?>
<openbox_menu>
<menu id="root-menu" label="">
<item label="Web browser"><action name="Execute" command="firefox" /></item>
<item label="Terminal"><action name="Execute" command="alacritty" /></item>
<item label="Reconfigure"><action name="Reconfigure" /></item>
<item label="Exit"><action name="Exit" /></item>
</menu>
</openbox_menu>
See menu-generators for ideas on how to automatically create menu.xml files.
rc.xml
The rc.xml file defines labwc behavior, keyboard bindings, and mouse bindings.
The following is a list of special key 'modifiers':
Key | Description |
---|---|
S | Shift key |
C | Ctrl key |
A | Alt key |
W | Super (windows) key |
M | Meta key |
H | Hyper key |
To make a key binding, combine modifiers and a key. They are separated with the -
(dash) sign.
Case matters! S (uppercase) equates to the Shift key while s (lowercase) is the s alphabet key.
Example content
The rc.xml is split into multiple sections with each offering configuration over the respective section
- CORE General window management options
- PLACEMENT How new windows should be placed
- WINDOW SWITCHER Define window switcher behaviour
- RESISTANCE How resistance to movement windows are with regards other windows and screen edge
- FOCUS windows focus with respect to mouse cursor
- WINDOW SNAPPING snapping behaviour
- REGIONS Define snapping regions
- WORKSPACES naming and numbering of virtual workspaces
- THEME Specific themes as well as other customisation, corner radius, drop shadow...
- MARGIN edge margin reserving
- RESIZE popup resize indicator control
- KEYBOARD keyboard control and configuration
- MOUSE mouse control and configuration
- TOUCH touchpad control and configuration
- TABLE tablet control and configuration
- LIBINPUT additional input control and configuration
- WINDOW RULES per window based behaviour overrides
- MENU right-click menu controls
- MAGNIFIER onscreen magnifier control
<?xml version="1.0"?>
<labwc_config>
<core>
<gap>10</gap>
<decoration>server</decoration>
<windowSwitcher show="yes" preview="yes" outlines="no" />
</core>
<focus>
<followMouse>yes</followMouse>
<raiseOnFocus>no</raiseOnFocus>
</focus>
<resistance>
<screenEdgeStrength>20</screenEdgeStrength>
</resistance>
<theme>
<name>Arc-Clone</name>
<cornerRadius>10</cornerRadius>
<font><name>sans</name><size>10</size></font>
<dropShadows>yes</dropShadows>
</theme>
<placement>
<policy>automatic</policy>
</placement>
<desktops number="4" />
<keyboard>
<keybind key="A-Tab"> <action name="NextWindow" /> </keybind>
<keybind key="W-Return"><action name="Execute" command="foot" /></keybind>
<keybind key="Print"> <action name="Execute"> <command>sh -c 'grim -t jpeg ~/screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg'</command> </action></keybind>
<keybind key="W-Print"> <action name="Execute"> <command>sh -c 'grim -t jpeg -g "$(slurp)" ~/screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg'</command> </action></keybind>
<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>
<keybind key="W-S-1"> <action name="SendToDesktop" to="1" /> </keybind>
<keybind key="W-S-2"> <action name="SendToDesktop" to="2" /> </keybind>
<keybind key="W-S-3"> <action name="SendToDesktop" to="3" /> </keybind>
<keybind key="W-S-4"> <action name="SendToDesktop" to="4" /> </keybind>
<keybind key="XF86_AudioLowerVolume"> <action name="Execute" command="wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"/> </keybind>
<keybind key="XF86_AudioRaiseVolume"> <action name="Execute" command="wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"/> </keybind>
<keybind key="XF86_AudioMute"> <action name="Execute" command="wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle "/> </keybind>
</keyboard>
</labwc_config>
All options can be viewed either at https://labwc.github.io/labwc-config.5.html or https://github.com/labwc/labwc/blob/master/docs/rc.xml.all
shutdown
The shutdown file is executed as a shell script when labwc is preparing to terminate itself. All environment variables, including WAYLAND_DISPLAY and DISPLAY, will be available to the script. However, because the script runs asynchronously with other termination tasks, the shutdown file should not assume that the display will be usable. This file is useful to perform any custom operations necessary to finalize a labwc session.
TBD
Several menu-generators exist to automatically create a menu.xml with system applications:
- labwc-menu-generator: Independent of Desktop Environments and associated menu-packages. Very easy to build and use. Written in C.
- labwc-menu-gnome3: Depends on GTK and a menu package such as gnome, mate and cinnamon. Written in C.
- obmenu-generator: Popular with openbox communities. Written in Perl.
- openbox-menu: XDG menu spec compliant, using LXDE’s library and menu package. Used to be packaged by debian, but isn’t anymore. Written in C.
- arch-xdg-menu: Arch Linux’s xdg-menu package based on SuSE 2003 implementation. Written in Perl.
- obamenu: Designed for pipemenus, but could easily be modified to produce a root-menu. Written in python3.
themes
Since the configuration re-uses the syntax of openbox, existing openbox themes are usable. A good collection of openbox themes can be found here: https://github.com/addy-dclxvi/openbox-theme-collections
The themes should be copied to ~/.local/share/themes/\<theme-name\>/openbox-3/ and then can be set via the rc.xml file under the THEME section