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
[links]
# ...
"gtk-css.css" = [
  # ...
  "~/.config/swaync/style.css"
]

INFO

You need to generate colors for these configuration files to be created. Run:

bash
rong video path/to/image/or/video

Apply

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

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

Reload

To apply style changes without restarting the daemon, run:

bash
swaync-client --reload-css

WARNING

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

bash
pkill swaync
swaync &