Setting up Notifications with eww in NixOS
In this article, we will go over the process of setting up notifications with eww in NixOS. This guide will provide a detailed explanation of the key concepts and steps involved in getting eww notifications to show up in the top left of your screen. By the end of this article, you will have a solid understanding of how to configure eww notifications in NixOS.
Prerequisites
Before we begin, it is assumed that you have a working installation of NixOS and have eww set up and functioning. If you have not done so already, please refer to the eww documentation for instructions on how to install and configure eww in NixOS.
Configuring eww Notifications
To configure eww notifications, we will need to modify the eww configuration file. This file is typically located at /etc/nixos/configuration.nix and may look something like this:
services.eww.yuckConfig = ''
(defwindow :monitors (list monitor)
...
To enable notifications, we will need to add the following code to the configuration file:
services.eww.yuckConfig = ''
(defwindow :monitors (list monitor)
(defwindownotifications :notifications
(let [position (nth (get-window-positions) 0)]
(set-window-position! position)
(set-window-border-color! "#ff0000")
(set-window-title! "Notifications")
(set-window-type! "notification")))
...
This code defines a new window for notifications and sets its position, border color, title, and type. The notification window will appear in the top left of the screen, with a red border and the title "Notifications".
Testing Notifications
To test the notifications, you can use the following command:
eww display :notifications "This is a test notification"
This should display a notification in the top left of your screen with the message "This is a test notification".
In this article, we have covered the process of setting up notifications with eww in NixOS. By following the steps outlined in this guide, you should now be able to display notifications in the top left of your screen. This can be a useful tool for displaying important information or alerts in a prominent location.
References
- eww documentation: https://github.com/chrisdone/eww
- NixOS manual: https://nixos.org/manual/nixos/stable/
Types of references:
- Online resources