Skip to content

SwayNC

SwayNC is a notification daemon for Wayland compositors. It supports GTK-CSS for theming, allowing you to style notifications css.

Common Issue with GTK-CSS

GTK's CSS implementation supports many features of standard (vanilla) CSS used in web development; however, some features are not available or behave differently. The level of support can also vary depending on the specific application or widget.

One commonly used feature in GTK CSS is color variable via the @<name> syntax (e.g., color: @mycolor;). This approach, while convenient, is not part of the official CSS specification and may trigger syntax errors or warnings in many text editors.

There are two common ways to handle this:

  1. Ignore editor warnings: You can safely ignore these errors.
  2. Use SCSS preprocessing: Define your variables in SCSS and compile it into standard CSS with hardcoded values. This avoids editor errors while maintaining maintainability in your source stylesheets. Learn more.

Add the following line to the configuration:

toml
[[themes]]
target = "gtk-css.css"
links = "~/.config/swaync/style.css"
cmds = "swaync-client --reload-css"

INFO

You need to generate colors for these theme files to be created.

  • If you're running rong for the first time:
    bash
    rong video -vv path/to/image/or/video
  • Else regenerate colors from current image:
    bash
    rong regen -vv

Apply

Create the SwayNC style file at ~/.config/swaync/style.css with the following content:

css
.notification {
  color: @on_background;
  background-color: @background;
}

Reload

Reloading via --reload-css may not work sometimes. Restarting the service manually might be required.

bash
pkill swaync
setid swaync & disown