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.
This changes a line of code that was added in the previous commit.
Previously, when menubar.cache_entries was set to false,
menubar.refresh() was called twice.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The function seems useless and its documentation is wrong. It does not
return a wibox, but a widget. Also, the widget cannot really be used on
its own since it depends on the size of the wibox.
So menubar.get() and its wrapper through the metatable __call should
just be removed. Until then, the needed initialisation code is moved
around a bit and the function is deprecated.
Signed-off-by: Uli Schlachter <psychon@znc.in>
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>
* This commit add a new module to avoid a (4 level) loop dependency
* It is now possible to call awful.spawn() with a table of properties
* awful.rules is used to execute the rules.
* Everything is public to allow alternative workflow modules such as
Tyrannical to use their own callback implementation.
The way of icon path lookup for `menubar` is enhanced so that it is
based on a theme-oriented way as described in the specification:
Icon Theme Specification, Ver. 0.12
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
To accomplish this:
* Add the two new files `icon_theme.lua` and `index_theme.lua`.
The former implements an icon lookup algorithm suggested in the URL
above. The latter implements a helper object to parse the cache file
`index.theme` of which data is used by the former.
* Modify `menu_gen.lua` to use the new algorithm.
- The implementation of `lookup_category_icons` is changed
accordingly.
- The values of the field `all_categories.icon_name` are changed file
names to icon names, i.e., file extensions which are used to
indicate image file formats are removed.
* Add the new file `icon_theme_spec.lua` for a unit test for checking
if `icon_theme.lua` together with `index_theme.lua` works as
expected.
The previous attempt at making the utils.wm_name variable useful for
accessing some entries was silly. This is because a typical ShowOnlyIn
string would look as: 'Unity;Gnome;KDE;' and the matching currently is
done for the whole string, where as we need to match only a part of it.
This small (hackish) commit fixes that, or do we wanna parse this line
of a .desktop file properly?
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
When parsing .desktop, we care only about [Desktop Entry] group.
Everything else is ignored.
Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit makes it possible to change the wm_name attribute, which
means that programs can be shown/hidden according to the wishes of the
user.
Possible usecase: A user is using Gnome and Awesome together, but sinc
wm_name by default is awesome, all the apps shipped with GNOME DE are
hidden by default. Changing wm_name attribute in this case would solve
the issue.
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Add a parameter to configure menubar's prompt.
Signed-off-by: Alexander Yakushev <yakushev.alex@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
After the rewrite from modules they ended up being local, but should
be available to user externally.
Also remove unnecessary local context bindings.
Signed-off-by: Alexander Yakushev <yakushev.alex@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This adds the documentation about keybindings for luadoc.
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>