Skip to content
Piotr Miller edited this page Jun 19, 2022 · 2 revisions

The DwlTags module displays tags (free, occupied, selected), layout and the active window name from the dwl Wayland compositor. Starting from v0.5.0, nwg-panel comes with the nwg-dwl-interface entry point, which provides dwl -> panel communication. It also executes the autostart script, if found.

Note: this module in not under active development, at least for now.

How it works

For the interface to work, you need to start dwl with the dwl -s nwg-dwl-interface command. Probably so far you used the -s argument to autostart stuff. From now on you may do it in the ~/.config/nwg-panel/autostart-dwl.sh file. Mine looks like this:

#!/usr/bin/env bash

~/.azotebg &
lxsession &
mako --icons 1 --markup 1 --actions 1 --padding 10 --background-color "#81a1c1" --default-timeout 10000 &
nwg-drawer -r &
nwg-panel -c config-dwl &
wlsunset -l 52.4 -L 22.2 -t 4500 &

The nwg-dwl-interface script will read the dwl output from stdin, and once several lines (4 * number of outputs) save it to the nwg-dwl-data file in your cache directory. Then it will send the SIGUSR1 (10) signal to nwg-panel, for it to read the file and update the DwlTags module instances.

If you'd like to use another signal, e.g. SIGUSR2, you need to:

  1. specify the signal number with the environment variable while starting dwl: dwl -s 'SIG=12 nwg-dwl-interface'
  2. remember to start nwg-panel with the -sigdwl flag: nwg-panel -c your_config_file_name -sigdwl 12

You also need to add some definitions to the ~/.config/nwg-panel/style.css (or whichever css file you use):

#dwl-tag-box {
    padding-top: 4px;
    padding-bottom: 4px
}

#dwl-tag-occupied {
    font-family: monospace;
    color: #eee;
    background-color: #006699;
    padding-left: 3px;
    padding-right: 3px;
}

#dwl-tag-free {
    font-family: monospace;
    color: #eee;
    background-color: rgba (32, 50, 90, 1.0);
    padding-left: 3px;
    padding-right: 3px;
}

#dwl-tag-urgent {
    font-family: monospace;
    color: #eee;
    background-color: #ee6600;
    padding-left: 3px;
    padding-right: 3px;
}

#dwl-tag-selected {
    border: solid 2px;
    border-color: #81a1c1
}

In case you've just installed nwg-panel for the first time, this has already been done for you.

Configuration

There are only two things to configure:

  1. tag names

If you'd like your tags to have other names than just numbers, define them here, as a space-separated series of strings. It means: don't use spaces inside a single tag name.

  1. window title length limit

image