Commit Graph

163 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 05ecb513c5 menubar.init: Update the property documentation. 2022-08-29 22:49:47 -07:00
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 Vallée 535b296b59
Merge pull request #3070 from aDogCalledSpot/menubar_match_empty
Menubar match empty
2020-05-04 01:45:51 -07:00
Yauhen Kirylau 6c7a5a5073
Update lib/menubar/init.lua
Co-Authored-By: Ari <ari.breitkreuz@pm.me>
2020-04-22 22:03:28 +02:00
Ari Breitkreuz 138e37576d Add note that prompt_args will override defaults 2020-04-22 13:05:19 +02:00
Ari Breitkreuz 30911a3959 Rename v to entry in add_entry loop 2020-04-22 13:02:46 +02:00
Ari Breitkreuz ec5ec642c3 Add match_empty option to menubar 2020-04-22 13:02:41 +02:00
Ari Breitkreuz 788d8fec33 Don't force defaults in menubar 2020-04-21 16:45:40 +02:00
Xaver Hellauer df5d092304
Fix documentation of beautiful.menubar* options 2020-02-27 11:19:09 +01:00
Aire-One 82a2769e04 Fix ldoc modules summaries missing the final `.`. 2019-11-28 13:53:59 +01: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
Kevin Zander 012f130738 Add Science category to menubar menu generation categories table. Fixes #2602 2019-01-21 11:58:44 -06:00
Sorky 9927b7a88d squash 2019-01-21 21:37:45 +11:00
Daniel Hahler ef4f3277b0 doc: fix @treturn usage with index_theme:get_per_directory_keys 2019-01-03 14:30:21 +01: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
glenvt18 61970761fb fix(menubar): escape XML entities in the item name (#2522) 2018-12-31 15:35:52 -05: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
Yauhen Kirylau 3931ae370c feat(menubar): expose menubar styling to beautiful (#2375) 2018-09-28 00:35:10 -04: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
Yauhen Kirylau e332e2d868 fix(menubar): apply both menu bg and fg, not only bg (#2372) 2018-08-26 12:35:14 -04: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
Uli Schlachter c8d6b7d28a Use get_cache_dir() where appropriate
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-03-11 16:08:07 +01: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
Daniel Hahler babc11a9be
Merge pull request #2111 from psychon/glib_keyfile
Menubar: Use GlibKeyFile
2017-11-18 01:51:04 +01:00
Uli Schlachter 5363225217 Deprecate menubar.index_theme
The previous commit deprecated its only user.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-11-16 13:58:25 +01:00
Uli Schlachter 0b0b466705 Deprecate menubar.icon_theme
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>
2017-11-16 13:12:59 +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
Uli Schlachter 74a6cbedce Fix menubar screen handling
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>
2017-10-08 14:53:58 +02:00
Zach Peltzer 013abf5a39 Display desktop entries with no categories (#2039) 2017-09-28 22:58:14 +02: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
Daniel Hahler 31e25dc6a5 Cleanup usages/patching of awful.util.deprecate (#1966) 2017-08-10 12:18:54 +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 f0368c21c5 menubar.icon_theme: Never use nil as icon theme name
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>
2017-06-14 11:10:22 +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