Repository: qtile/qtile

Issue:
[BUG] Configurations test notification crashes xfce4-notifyd
# Issue description
The notification for valid or invalid config file is displaying once and then
crashing xfce4notifyd. I am not sure whose fault this is but on qtile stable it
was working.

# Qtile version
```sh
$ qtile --version
0.17.1.dev315+g67f97604
```

# Error Logs


qtile
```python
2021-06-09 17:58:30,020 ERROR libqtile base.py:on_done():L559 Failed to reschedule.
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/libqtile/widget/base.py", line 551, in on_done
    self.update(result)
  File "/usr/lib/python3.9/site-packages/libqtile/widget/base.py", line 462, in update
    old_width = self.layout.width
  File "/usr/lib/python3.9/site-packages/libqtile/drawer.py", line 80, in width
    return self.layout.get_pixel_size()[0]
  File "/usr/lib/python3.9/site-packages/libqtile/pangocffi.py", line 135, in get_pixel_size
    pango.pango_layout_get_pixel_size(self._pointer, width, height)
TypeError: initializer for ctype 'PangoLayout *' must be a cdata pointer, not NoneType
2021-06-09 17:58:30,022 WARNING libqtile lifecycle.py:_atexit():L34 Restarting Qtile with os.execv(...)
```

***
xfce4notifyd
***

```sh
$ /usr/lib/xfce4/notifyd/xfce4-notifyd 

(xfce4-notifyd:1110745): GLib-CRITICAL **: 18:04:02.329: g_key_file_set_string: assertion 'string != NULL' failed

(xfce4-notifyd:1110745): GLib-CRITICAL **: 18:04:07.415: g_key_file_set_string: assertion 'string != NULL' failed
[1]    1110745 segmentation fault (core dumped)  /usr/lib/xfce4/notifyd/xfce4-notifyd
```

On version 0.17.0 this problem didn't happen. It works Ok with dunst though. I didn't test more versions or notifier daemons.



Discussion:
Hi @matheusfillipe 

Thanks for bug report. Can you help provide a bit more information as to what you're seeing as I'm not completely sure I understand what the issue is. Providing your config file would be good too.

When you say it's displaying once and then crashing xfce4notifyd, do you mean that:

- You start qtile
- You get a notification
- You reload the config (rather than exiting qtile and restarting)
- xfce4notifyd crashes

Providing this would help us try to recreate the issue you're seeing.

My config is very bloated and messy for now. I don't think that's the cause though, but In case nobody is able to reproduce then I will test with a smaller config when I have time. 

Yes I start qtile, the notifications are working with xfce4notifyd launched on autostart.sh then I use `lazy.restart()` to reload the config. When there is a syntax error this should show as a notification that shows the first time but then xfce4notifyd crashes after the notification is displayed.
Can you test whether qtile can send notifications to xfce4notifyd but not as part of the config error? 

e.g. if you created a function to use the `send_notification` function (`from libqtile.utils import send_notification`) and bound this to a key press, do the notifications display ok?

I'm just trying to understand if this is in the error handling part of the code or the send notification part. My guess is it's the latter.
Running this code on a lazy.function:
```python
libqtile.utils import send_notification
name = qtile.current_group.layout.info()['name']
 send_notification("Title", f"name is {name}")
```

Here are outputs from xfce4notifyd and dunst:

```bash
# matheus @ arch-matheus in ~ [15:48:20] 
$ /usr/lib/xfce4/notifyd/xfce4-notifyd              

(xfce4-notifyd:2046487): GLib-CRITICAL **: 15:48:24.625: g_key_file_set_string: assertion 'string != NULL' failed
[1]    2046487 segmentation fault (core dumped)  /usr/lib/xfce4/notifyd/xfce4-notifyd

# matheus @ arch-matheus in ~ [15:48:24] C:139
$ dunst
WARNING: Odd length in actions array. Ignoring element: 
WARNING: Odd length in actions array. Ignoring element: 
```
> e.g. if you created a function to use the send_notification function (from libqtile.utils import send_notification) and bound this to a key press, do the notifications display ok?

Then the  answer is no. While if i use something like `subprocess.Popen("notify-send....` it still works.

OK - so it sounds like our send_notification code is a bit broken although I wouldn't expect a missing field to cause xfce4notifyd to crash, dunst's warning seems more appropriate.

I think I know what the problem may be. Let me do some testing and I'll submit a PR if it works.

I can install dunst and if the warnings disappear, I'll take that as a sign of success!

Resolving patch:
diff --git a/libqtile/utils.py b/libqtile/utils.py
--- a/libqtile/utils.py
+++ b/libqtile/utils.py
@@ -222,7 +222,7 @@ async def _notify(title, message, urgency, timeout, id):
                     "",  # icon
                     title,  # summary
                     message,  # body
-                    [""],  # actions
+                    [],  # actions
                     {"urgency": Variant("y", urgency)},  # hints
                     timeout]  # timeout
 


Test patch: