The $XDG_DATA_HOME environment variable may not necessarily end in a
slash, so insert it when generating the list of all menu dirs to make
sure the directory can be found.
When menubar.refresh() is called, it tries to update the menubar widget.
The call chain looks like this: menulist_update -> common.list_update ->
get_current_page. get_current_page then tries to query information about
the size of the menubar.
Since there is not much point in this, just skip the whole callback in
this case.
Side note: What is the point of menubar.get()? It seems quite useless to
me.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When awesome calls any Lua code, it does so with a protected call. This
means that any kind of Lua error should (there are exceptions) just
result in an error message being printed and everything continuing as
usual. When LGI calls Lua code, it uses a normal call. This means that
in an asynchronous context, that is, when there is no more call
generated by awesome's C code on the call stack, we must be careful,
since any error results in Awesome's unprotected error handler to be
called which restarts the WM.
menubar.utils.parse_dir() asynchronously parses a directory containing
.desktop files. This means that it is no longer in a protected call
context. Let's assume that the code itself is fine. However, the
callback that the caller provided for handling the results can be quite
arbitrary. Make sure that it is run in a protected context.
Helps-with: https://github.com/awesomeWM/awesome/issues/1173
Signed-off-by: Uli Schlachter <psychon@znc.in>
It does not provide much value. The version number is already known to
ldoc globally in the "description" variable.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When not including standard::type in the query for children of a file then Gio
may not look up this information. This might work on some file systems (e.g.
ext4), but other (apparently XFS) do not provide the needed file type
information (see man readdir on the d_type field). The result was that the
menubar contained no entries because no .desktop files were identified as
regular files and thus read.
Fix this by including standard::type in the queries.
Also, this commit makes the code use some pre-defined string constants from Gio
to make "double sure" that typos are caught.
Thanks to @Jajauma for doing the hard part on debugging this.
Fixes: https://github.com/awesomeWM/awesome/issues/863
Signed-off-by: Uli Schlachter <psychon@znc.in>
It was missing apps/entries from /usr/share/applications/kde4.
This patch also makes sure that entries are unique (by Exec/Name).
Closes https://github.com/awesomeWM/awesome/pull/711.
This avoids having to mock half the C API just because all of awful is loaded
needlessly in this unit test and is generally a good idea.
Signed-off-by: Uli Schlachter <psychon@znc.in>