Commit Graph

50 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 86d1b1c22c doc: Add a mandatory `@noreturn` for functions and methods.
The goal is to catch cases where the return value exists, but is
forgotten. There was a large enough number of them to turn this
into a real check. Initially, I just wanted to implement it to fix
the problems, then delete the code. But since this is so common, I
think it is worth the annoyance.
2022-08-29 22:49:45 -07:00
Emmanuel Lepage Vallee 4bd90f0f35 doc: Add documentation linting and fix all issues it found. 2022-08-29 22:48:54 -07:00
actionless b91a033141 test(menubar): don't try to cover deprecated methods (calling any of them will make the warning-check fail in tests) 2021-05-28 00:40:24 +02:00
actionless 2249dc3c81 refactor(menubar, textbox): replace menubar.utils.compute_text_width() with textbox.get_markup_geometry()
feat(menubar): allow setting beautiful.menubar_font

fix(menubar: init: get_current_page): label return value

Update lib/wibox/widget/textbox.lua

Co-authored-by: Lucas Schwiderski <4508454+sclu1034@users.noreply.github.com>

Update lib/wibox/widget/textbox.lua

Co-authored-by: Lucas Schwiderski <4508454+sclu1034@users.noreply.github.com>

revert textbox changes

fix(menubar: init: show): fix font height detection

Update lib/menubar/init.lua

fix(menubar: init: get_current_page): list_spacing depends on presence of icon; also take cursor block width into consideration

fix(menubar: init: label): force icons to be square

fix(menubar: init: get_current_page): also take border_width into consideration when computing available space

merge conflict
2021-05-26 14:18:10 +02:00
Emmanuel Lepage Vallee 90a29f92eb doc: Fix all the property, theme and field types. 2019-06-08 18:14:14 -04:00
Emmanuel Lepage Vallee b4ece0f053 doc: Use an explicit tag for all static functions.
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.
2019-06-08 18:14:13 -04:00
Sorky 3f26624160 Aligning 'regex' with other PR / Minor readability improvements
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
2019-02-09 19:21:46 +11:00
Sorky 9927b7a88d squash 2019-01-21 21:37:45 +11:00
Daniel Hahler 1e4ef0bca0
Merge pull request #2379 from Perlovka/menubar/utils.lua
menubar.utils: Allow to add programs with OnlyShowIn option being set
2019-01-03 13:47:26 +01:00
Uli Schlachter 55639547a2 menubar.utils: Remove some (basically) dead code
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>
2018-11-07 13:23:25 +01:00
Michael Perlov b487826719
Check for non-empty utils.wm_name before checking OnlyShowIn attribute
Signed-off-by: Michael Perlov <perlovka@gmail.com>
2018-08-30 17:04:37 +03:00
Michael Perlov cbb8f41261
menubar.utils: Allow to add programs with OnlyShowIn option being set
Bug: https://github.com/awesomeWM/awesome/issues/2377

Signed-off-by: Michael Perlov <perlovka@gmail.com>
2018-08-29 22:39:07 +03:00
Sagar Tewari 6617d786b3 program.Terminal is a boolean, not a string (#2239) 2018-04-22 02:06:38 -04:00
Reiner Herrmann e8c23bd9e7 Add categories path to icon lookup (#2224)
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.
2018-04-22 02:03:28 -04:00
get a65079b104 Fix icon path resolution in menubar.utils
Issue #2152

Rewrites get_icon_lookup_path to find icons and themes in
$HOME/.icons. Also adds 'scalable' as the top priority icon size.
2018-01-15 23:25:31 +01:00
Uli Schlachter 5d21e85bfb menubar.utils.parse_desktop_file: Improve type handling
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>
2017-11-15 15:27:05 +01:00
Uli Schlachter e88f1e8735 menubar.utils.parse_desktop_file: Use GKeyFile
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>
2017-11-15 15:27:05 +01:00
lePerdu 926c126738 Fix typo: "OnlyShownIn" -> "OnlyShowIn" 2017-11-02 20:08:48 -04:00
Zach Peltzer 8d34201ec3 Unescape strings when parsing desktop entries (#2043)
* 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()
2017-09-28 22:57:39 +02:00
actionless 0a75f09d1d fix(menubar: utils: parse_dir): print to log the current failed directory instead of the root one 2017-08-24 23:06:16 +02:00
actionless 960f59b228 fix(menubar: utils: parse_dir): print warning instead of error if directory can't be opened 2017-08-24 23:06:16 +02:00
Crazy Lemon 2886095358 Specifies the wibox dependency on the menubar utils (#1953)
Only this particular module is needed
2017-07-30 13:42:20 -04:00
Uli Schlachter b9d9587afa menubar: Produce better errors for broken .desktop files
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>
2017-06-28 09:17:13 +02:00
Uli Schlachter bcc3de469e Fix menubar under Lua 5.1 (#1838)
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>
2017-06-13 01:59:30 +02:00
Haochen Tong c1bcad5f5e parse_desktop_file: rtrim lines before parsing (#1677) 2017-05-25 01:22:13 +02:00
Uli Schlachter 0dbe8a344d menubar.utils: Fix for invalid utf8 file names
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>
2017-05-01 13:26:17 +02:00
Uli Schlachter f958b6a023 menubar.utils: Don't switch between path and GFile
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>
2017-05-01 13:23:05 +02:00
Uli Schlachter 50cfa6c111 Run menubar.utils.parse_dir in protected context
Fixes: https://github.com/awesomeWM/awesome/issues/1761
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-01 13:19:19 +02:00
getzze 26b2065c40 Remove deprecated function call 2017-03-31 00:25:04 +01:00
Kevin Zander 7687275607 Move awful.util.deprecate and awful.util.deprecate_class to gears.debug
Change all awful.util function calls to gears.debug function calls
Update all old deprecate calls to have deprecated_in=4
2017-03-15 20:08:22 -05:00
Kevin Zander 45dadde0dd Move filesystem functions out of awful.util into new gears.filesystem
Update awful.util filesystem function calls to gears.filesystem function calls
Rename getdir to get_dir for consistency
2017-03-15 13:46:33 -05:00
Emmanuel Lepage Vallee 05717026b7 menubar: Fix a typo in the code
Find/replace error when porting the deprecated code

Regression from 2f105eac86
Fix #1652
See #1072
2017-03-13 03:40:41 -04:00
Kevin Zander 2f105eac86 Move string functions out of awful.util into new gears.string (#1584)
Update deprecated awful.util string function calls to gears.string calls
2017-03-11 18:57:32 -05:00
Yauhen Kirylau f9975f763c Avoid cyclic dependency between awful and menubar (#1433) 2017-01-23 22:51:41 +01:00
Uli Schlachter bc75ef5689 menubar.utils: Use a protected call (#1174)
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>
2016-10-19 12:29:54 +02:00
Uli Schlachter 259c4f716f Remove @release @AWESOME_VERSION@ everywhere (#1157)
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>
2016-10-09 22:36:20 +02:00
Uli Schlachter a37f12c0a1 menubar.utils.parse_dir: Ask Gio for file type
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>
2016-04-30 19:23:46 +02:00
actionless 4eb80853c2 feat(lib: menubar): replace io.popen to lgi 2016-04-28 17:07:24 +02:00
Daniel Hahler 2bcff5af27 Merge pull request #708 from psychon/less_screen_indicies2
Less screen indicies
2016-02-28 22:15:37 +01:00
Daniel Hahler 9205feea5e menubar: rename utils.parse to utils.parse_desktop_file 2016-02-28 22:14:35 +01:00
Daniel Hahler 25eff81878 menubar: look for .desktop files recursively
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.
2016-02-28 22:14:08 +01:00
Uli Schlachter d9f4ed9fb6 menubar: Support screen objects
This commit makes meanubar accept a screen object everywhere where a screen
index is accepted.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-26 18:25:55 +01:00
Uli Schlachter f2cf4a6385 Fix luacheck warnings in beautiful and menubar
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-11 21:55:32 +01:00
Uli Schlachter 16994f3b12 Fix API documentation broken in eb8577a424
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-22 18:31:48 +01:00
actionless 0516203610 feat(lib: awful: hotkeys_popup): widget to show awesome and third-party keybindings
Closes https://github.com/awesomeWM/awesome/pull/421.
2015-12-02 01:02:15 +01:00
dyslesiq ecf6b55b55 Added value check of required 'Name' entry in .desktop parsing
Closes https://github.com/awesomeWM/awesome/pull/574.
2015-12-01 20:17:21 +01:00
Uli Schlachter 234100ebdf Fix/silence various ldoc warnings in menubar
Closes https://github.com/awesomeWM/awesome/pull/559.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-19 22:22:23 +01:00
Daniel Hahler efbddb5875 Add cache for menubar.utils.lookup_icon
I have tried to use `utils.icon_cache =
require("gears.cache").new(utils.lookup_icon_uncached)`, but that
appears to get garbage-collected too much?!
2015-10-13 22:27:20 +02:00
Daniel Hahler 7afd8e3179 get_icon_lookup_path: only return readable/existing dirs 2015-10-13 22:26:39 +02:00
Julian Wollrath 6cc7be512c Remove the *.in from all files.
Signed-off-b: Julian Wollrath <jwollrath@web.de>
2015-06-19 22:33:32 +02:00