This way their name doesn't get mangle by the broken magic. It will also
eventually allow to `error()` in the template when the implicit
`@function` is used.
This commit also fixes a large number of issues found while
proof-reading everything.
https://github.com/awesomeWM/awesome/issues/2596
Re-matched regex used elsewhere & updated test cases for "." in filename
Allowed for alternative extensions to be found even if specified
Reverted the change of behaviour but adjusted code for readability
Small readability change
Avoided delay searches that would never work
Untabify
Reverted possible [unlikely/undesired] behaviour changes
Untabify
This removes unused public functions from menubar.utils. This is not an
API break, because these functions were only added in commit
8d34201ec3, which is after v4.2. These new functions became
unused in commit e88f1e8735, not long after they were added.
Signed-off-by: Uli Schlachter <psychon@znc.in>
In #2112 the way of loading category icons was changed to use
utils.lookup_icon. However this function does not look in the
categories paths where the categories icons are located, and
so the category icons are no longer being displayed.
The code in menubar.icon_theme naively implements the algorithm from the
base dir specification. This is a problem: On this system,
/usr/share/icons/{Adwaita,hicolor}/index.theme list 91, respectively 649
subdirectories. Since we check for three file extensions (png, svg,
xpm), this means that a failing icon lookup for the Adwaita theme checks
for (91+649)*3 = 2220 files (in practice it might be a bit better since
the directories have specific meanings, but still). That's insane.
Since we only use this code for looking up category icons anyway, just
deprecate this mess. Category icons are now looked up in the same way
that icons for individual applications are looked up.
Since menubar.init does not require("menubar.icon_theme"), this means
that menubar.icon_theme is no longer actually loaded. That's bad.
(Hopefully) Fixes: https://github.com/awesomeWM/awesome/issues/1496
Signed-off-by: Uli Schlachter <psychon@znc.in>
This is a slight API break, but should not cause many problems for
people. This makes parse_desktop_file() handle the type of keys
correctly, so that e.g. booleans are actually parsed as booleans. Also,
locale-sensitive entries are now looked up in a way that obeys the
current locale.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This replaces our own, hand-written parser of desktop files with the one
that GLib provides. No functional changes intended.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Running test-menubar.lua just failed for me locally. The reason was that
the textbox was indexing a nil value when doing 's.dpi'.
This commit fixes the menubar so that its optional screen arguments are
really handled correctly. In fact, a default screen is now chosen way
earlier than before, so that no nil values are used as screens later on.
In other news: I guess test-menubar.lua is not run on any of our Travis
targets...
Signed-off-by: Uli Schlachter <psychon@znc.in>
* Unescape strings when parsing desktop entries
* Fix unused value warning in menubar/utils.lua
* Move menubar.utils.unescape() tests
* Clean up menubar.utils.unescape() function
* Fix warning for using "_" in a non-local context
* Do not ignore trailing whitespace in menubar.utils.parse_list()
This now runs parse_desktop_file in a protected context so that a single
broken desktop file does not break the whole menubar.
Also, the error message that is produced when a Lua error occurs now
also includes the file name of the .desktop file which we attempted to
parse. This should help quite a lot in debugging.
Related-to: https://github.com/awesomeWM/awesome/issues/1880
Signed-off-by: Uli Schlachter <psychon@znc.in>
The return value for this function is used as an index in a table and
Lua does not like nil as an index.
The function that actually looks for icons, find_icon_theme() already
falls back to "hicolor" if it does not find anything via the current
theme, so fix this issue by just falling back to "hicolor" here as well.
Fixes: https://github.com/awesomeWM/awesome/issues/1819
Signed-off-by: Uli Schlachter <psychon@znc.in>
LGI's async support was trying to yield inside a protected call. Lua 5.1
cannot do that. Work around this by reverting to the behaviour before
commit 50cfa6c: Only call the callback in a protected context.
Fixes: https://github.com/awesomeWM/awesome/issues/1837
Signed-off-by: Uli Schlachter <psychon@znc.in>
The previous commit made this code handle invalid directories correctly.
However, it was still possible that we come across invalid file names
for which :get_path() returns nil and then we assumed this was a file
name.
Fix this by silently ignoring such files.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before this commit, the code always used GFile instances, then used
get_path() for a recursive call and turned the path into a GFile
instance again. This is not only inefficient, but also causes issues
with directories with invalid utf8, because the get_path function
returns nil in this case.
Fix this by keeping things as a GFile all the time.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The freedesktop specifications let desktop files be stored in
different directories indicated by the environment variables
XDG_DATA_HOME and XDG_DATA_DIRS.
Only use the default value for these variables if the variables are
not defined.
This is important for systmes like NixOS which does not follow the LFS
and installs files differently.
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.