Setting up Notifications with eww in NixOS
In this article, we will cover the process of setting up notifications using eww in NixOS. We will walk through the steps required to make eww display a window in the top-left corner of the screen using the eww.yuck configuration file.
Prerequisites
Before we begin, it is assumed that you have a working installation of NixOS and have eww installed. If you do not have eww installed, you can do so by running the following command:
nix-env -i eww
Setting up Notifications
To set up notifications with eww, we will need to create a configuration file. This file will define the layout of the eww window and the content that will be displayed. We will call this file eww.yuck.
The first step in creating this file is to define the window. We will use the monitored variable to specify that we want to display a window in the top-left corner of the screen. The code for this is as follows:
(defwindow notifications
(monitor 0))
Next, we need to define the content that will be displayed in the window. We will use the text variable to specify the text that will be displayed. For this example, we will display the text "Notifications" in the window. The code for this is as follows:
(defnotifications
(text "Notifications"))
Now that we have defined the window and the content, we need to put it all together. We will use the define-window function to define the layout of the window and the define-layout function to define the layout of the page. The final code for the eww.yuck file is as follows:
(define-window notifications
(monitor 0)
(define-layout
(column 10
(define-layout
(frame notifications
(text "Notifications"))))))With the eww.yuck file created, we can now run the eww command to display the notifications window. The command to do this is as follows:
eww open eww.yuck
- In this article, we covered the process of setting up notifications with eww in NixOS.
- We created an eww.yuck configuration file to define the layout of the notifications window and the content to be displayed.
- We ran the eww command to display the notifications window.