Skip to content

Commit

Permalink
Add labwc patch to color app's frames
Browse files Browse the repository at this point in the history
This commit adds the labwc patch which allows to change the frame color
of choosen app by using window rules. As an example foot terminal has
aqua colored frame.
To get solution working labwc must be enabled in guivm.nix (uncomment
this line # profiles.graphics.compositor = "labwc";)
The patch approach was choosen cause there is no better solution
(which should revise the theme handling) ready.
The discussion about better soultion will be held here
labwc/labwc#1092.
The documentaion was also updated with LabWC section.

Signed-off-by: dmitry-erin <[email protected]>
  • Loading branch information
dmitry-erin authored and brianmcgillion committed Feb 5, 2024
1 parent 46bf722 commit 704e5cd
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- [Installer](ref_impl/installer.md)
- [Cross-Compilation](ref_impl/cross_compilation.md)
- [Creating Application VM](ref_impl/creating_appvm.md)
- [LabWC Desktop Environment](ref_impl/labwc.md)
- [Ghaf as Library: Templates](ref_impl/ghaf-based-project.md)
- [Example Project](ref_impl/example_project.md)
- [Modules Options](ref_impl/modules_options.md)
Expand Down
Binary file added docs/src/img/colored_foot_frame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions docs/src/ref_impl/labwc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!--
Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
SPDX-License-Identifier: CC-BY-SA-4.0
-->

# Labwc Desktop Environment

[Labwc](https://labwc.github.io/) is a configurable and lightweight wlroots-based Wayland-compatible desktop environment.
To use Labwc as your default desktop environment, add it as a module to Ghaf:

* change the configuration option `profiles.graphics.compositor = "labwc"`
or
* uncomment the corresponding line in [guivm.nix](../modules/virtualization/microvm/guivm.nix) file.


The basis of the labwc configuration is the set of following files: `rc.xml`, `menu.xml`, `autostart`, and `environment`. These files can be edited by substituting in the Labwc overlay `overlays/custom-packages/labwc/default.nix`.


## Window Border Coloring

The border color concept illustrates the application trustworthiness in a user-friendly manner. The color shows the application's security level and allows avoiding user's mistakes. The same approach can be found in other projects, for example, [QubeOS](https://www.qubes-os.org/doc/getting-started/#color--security).

Ghaf uses patched Labwc which makes it possible to change the border color for the chosen application. The implementation is based on window rules by substituting the server decoration colors (`serverDecoration` = `yes`). The `borderColor` property is responsible for the frame color.

> **TIP:** According to the labwc specification, the **identifier** parameter is case-sensitive and relates to app_id for native Wayland windows and WM_CLASS for XWayland clients.
For example:
```
<windowRules>
<windowRule identifier="Foot" borderColor="#00FFFF" serverDecoration="yes" skipTaskbar="yes" />
<windowRule identifier="firefox" borderColor="#FF0000" serverDecoration="yes" skipTaskbar="yes" />
</windowRules>
```

![Foot Terminal with Aqua Colored Frame](../img/colored_foot_frame.png)
6 changes: 6 additions & 0 deletions overlays/custom-packages/labwc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
(final: prev: {
labwc = prev.labwc.overrideAttrs (prevAttrs: {
patches = [./labwc-colored-borders.patch];
buildInputs = with final;
[
foot
Expand All @@ -27,6 +28,11 @@
substituteInPlace ../docs/menu.xml \
--replace alacritty ${final.foot}/bin/foot
#frame coloring example
substituteInPlace ../docs/rc.xml \
--replace '</labwc_config>' \
'<windowRules><windowRule identifier="Foot" borderColor="#00ffff" serverDecoration="yes" skipTaskbar="no" /></windowRules></labwc_config>'
chmod +x ../docs/autostart
'';
});
Expand Down
Loading

0 comments on commit 704e5cd

Please sign in to comment.