Commit Graph

160 Commits

Author SHA1 Message Date
Uli Schlachter 3f2bcfdb97 Fix misuse of @deprecated tag
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-18 10:43:55 +01:00
Emmanuel Lepage Vallée 2c30991579 Merge pull request #1620 from psychon/menubar-remove-get2
Deprecate menubar.get()
2017-03-16 16:40:23 -04: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
Kevin Zander 0066257a59 Move ensure_pango_color out of awful.util into gears.color
Update deprecated awful.util.ensure_pango_color calls to gears.color.ensure_pango_color calls
2017-03-08 15:28:48 -06:00
Emmanuel Lepage Vallée d3ca6aa301 Merge pull request #1637 from psychon/deprecation_warnings
Fix some deprecation warnings
2017-03-07 18:43:32 -05:00
Jan Larres 862bfbf795 menubar: add trailing slash with $XDG_DATA_HOME (#1631)
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.
2017-03-06 22:58:09 +01:00
Uli Schlachter 6f803cf3b3 Fix code using awful.util.round
This gets rid of lots of deprecation warnings

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-06 17:11:05 +01:00
Kevin Zander 3f6df8ddee Fix Luacheck 0.19.0 release Travis breaks 2017-03-03 16:41:12 -06:00
Uli Schlachter 232c5a014a menubar.show(): Remove duplicate call to menubar.refresh()
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>
2017-03-03 18:46:55 +01:00
Uli Schlachter 67b12579d9 Deprecate menubar.get()
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>
2017-03-03 18:45:47 +01:00
copycat-killer ad72d204c9 menubar.init: menulist_update doc fixed 2017-02-15 12:38:46 +01:00
actionless 20c132fa38 feat(menubar): cache count_table reading 2017-02-11 16:58:57 +01:00
actionless 0089b5d7c7 refactor(menubar): simplify file handling for count_table 2017-02-11 16:58:57 +01:00
actionless 978889e739 fix(menubar): close count_file after opening
closes #1548
2017-02-11 16:58:57 +01:00
Yauhen Kirylau 439d0c804c fix(menubar): reset search query when menubar closes (#1553)
* fix(menubar): reset search query when menubar closes

* refactor(menubar): remove redundant argument for menulist_update()
2017-02-11 01:16:57 +01:00
actionless 4c3b63009c fix(menubar): use current query after refreshing entries list
closes #1421
2017-02-05 22:06:29 +01:00
Yauhen Kirylau f9975f763c Avoid cyclic dependency between awful and menubar (#1433) 2017-01-23 22:51:41 +01:00
Uli Schlachter dadf8463bd menubar: Fix refresh without show
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>
2017-01-02 17:23:20 +01:00
Uli Schlachter 7f3ff5f26f menubar: Fix hide()
When hide() was called without any calls to shown() before, an error
would occur.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 17:21:10 +01:00
Uli Schlachter 68f0883a44 menubar: Refactor initialisation
No functional changes intended. I just like things more like this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 17:20:41 +01:00
Emmanuel Lepage Vallee 0e1c193450 prompt: Make exe_callback optional
The menubar already bypass it using keypress listener. Having an
empty callback is ugly.

Fixes #1180
2016-12-11 14:19:25 -05:00
Uli Schlachter 7292be1add Merge branch 'fix-missing-args' of https://github.com/hexchain/awesome 2016-10-22 10:31:45 +02: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
Haochen Tong a6af703c5d menubar: Fix missing exe_callback in args table (#1173)
Signed-off-by: Haochen Tong <i@hexchain.org>
2016-10-18 12:40:47 +08:00
Emmanuel Lepage Vallee 07f3a178fa prompt: Fix 2 deprecation warnings
An oversaw in a previous commit introduced deprecation warnings
on the default config.
2016-10-12 01:53:53 -04: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
Emmanuel Lepage Vallee 260aeba78b doc: Fix the menubar fields documentation 2016-09-26 00:40:20 -04:00
Emmanuel Lepage Vallee 4d0c426040 menubar: Do not use the deprecated geometry access 2016-09-11 01:55:33 -04:00
modk 12ea5e2318 menubar: Refactoring and cleanup 2016-09-11 00:32:57 -04:00
modk 1a40333b9e menubar: Fix entry use count for categories
Fix #999
2016-09-11 00:32:47 -04:00
modk 45d555d473 Priority heap to sort menubar entries by execution count (#879) 2016-07-09 19:23:36 +02:00
Max 8ff60f034f Try menu_* colors before regular normal/focus (#949) 2016-06-05 17:08:43 +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
Uli Schlachter a1e340d118 Merge branch 'replace-popen-to-async' of https://github.com/actionless/awesome 2016-04-30 09:11:50 +02:00
actionless 4eb80853c2 feat(lib: menubar): replace io.popen to lgi 2016-04-28 17:07:24 +02:00
actionless b93d6a4b25 fix(lib: menubar): take in account common list padding 2016-03-02 15:47:50 +01: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 3db87c693a menubar.icon_theme: Don't require("awful")
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>
2016-02-21 16:55:06 +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 1aed092fea Merge branch 'util-getdir' of https://github.com/psychon/awesome 2016-01-17 15:59:54 +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
Uli Schlachter 8953218e5c Use get_cache_dir() instead of getdir("cache") everywhere
Just because I like that function more. :-)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-11 18:16:26 +01:00
actionless eb8577a424 feat(lib: menubar): dpi support in menubar
Closes https://github.com/awesomeWM/awesome/pull/580.
2015-12-10 23:18:43 +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 a648b27af6 menubar.icon_theme: cache index_theme instances
Ref: https://github.com/awesomeWM/awesome/pull/523#commitcomment-13716821
2015-10-13 22:28:34 +02:00
Daniel Hahler 7d9b78c13c menubar.icon_theme.lookup_icon: check for dist in outer loop 2015-10-13 22:28:30 +02:00
Daniel Hahler 75341d9e38 menubar.menu_gen.generate: do not call lookup_icon again
`menubar.utils.lookup_icon` gets called via `menubar.utils.parse`
already.
2015-10-13 22:27:20 +02: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 7fa3dc97c8 Optimize menubar.icon_theme.lookup_icon: do not look twice 2015-10-13 22:27:11 +02:00
Daniel Hahler 7afd8e3179 get_icon_lookup_path: only return readable/existing dirs 2015-10-13 22:26:39 +02:00
Kazunobu Kuriyama fbfa6b8995 menubar/icon_theme.lua: Handle scalable icons correctly
This bug was caused by typos.

Closes https://github.com/awesomeWM/awesome/pull/525.
2015-10-13 22:20:43 +02:00
Daniel Hahler 1bd7aa103b Fix signature for recursive find_icon_path_helper
Ref: 81072c0420 (commitcomment-13705007).

This reverts a part of 81072c0.

Closes https://github.com/awesomeWM/awesome/pull/518.
2015-10-13 22:16:01 +02:00
Daniel Hahler 2723399785 Move is_readable_directory to awful.util.dir_readable 2015-10-11 13:17:57 +02:00
Daniel Hahler 765a5f5790 menubar.icon_theme: use GLib.build_filenamev to join paths
This eliminates double slashes from the resulting paths.
`GLib.get_system_data_dirs` might return paths with and without trailing
slashes.
2015-10-11 13:09:33 +02:00
Daniel Hahler e93ce7c2a8 menubar.icon_theme: minor code style fixes
- fix/streamline usage if metatable.__call
2015-10-11 13:09:15 +02:00
Daniel Hahler a140d80d76 icon_theme.find_icon_path: fix typo: s/filaname/filename 2015-10-11 11:53:31 +02:00
Uli Schlachter b1493c8f76 Merge branch 'enhance_menubar_icon_path_lookup' of https://github.com/nuko8/awesome 2015-10-10 19:54:23 +02:00
Emmanuel Lepage Vallee 4095eb91a8 Move util.spawn to a new module, add ability to spawn with properties
* 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.
2015-09-29 18:05:56 -04:00
Kazunobu Kuriyama 9ae945c931 Enhance menubar icon path lookup
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.
2015-09-26 11:45:38 +09:00
Daniel Hahler a0f8948c71 menubar: fix height to be rounded
Fixes https://github.com/awesomeWM/awesome/issues/414.
Closes https://github.com/awesomeWM/awesome/pull/432.
2015-08-31 20:47:22 +02:00
Daniel Hahler 410a6e5bb2 Merge pull request #155 from silverhammermba/pango_color
Replace color_strip_alpha with check_pango_color
2015-07-25 23:26:22 +02:00
Daniel Hahler cbe684efd1 Add awful.screen.focused [FS#1029]
This allows to configure / override what gets considered to be the
"focused screen".

Ref: https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1029

Closes https://github.com/awesomeWM/awesome/pull/94.
2015-07-21 12:51:45 +02:00
Max d22a65a103 Replace uses of color_strip_alpha with ensure_pango_color, refactor
This simplifies the logic a bit since all of the fg/bg colors are
always set when it gets to checking the client state.
2015-07-10 18:11:45 -04: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
Julian Wollrath 3a34b49179 Fix LDoc warning. 2015-02-28 23:14:13 +01:00
Julian Wollrath 939dab8ba9 Some more doc fixes all over the place.
Signed-off-by: Julian Wollrath <jwollrath@web.de>
2015-02-28 23:14:13 +01:00
Ignas Anikevicius (gns_ank) a0051c7dc4 Docs: Start menubar refactoring
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
2015-02-28 23:14:11 +01:00
actionless 2a9b1d00e1 feat(lib: menubar): add paginated scrolling
also fixes some local/global issues and adds saving current geometry to the instance table
2015-02-23 20:34:26 +01:00
Daniel Hahler 60e04d3ae3 menubar: get_icon_lookup_path: only look in apps/ with icon_themes
Ref: https://github.com/awesomeWM/awesome/pull/100#issuecomment-73559676
2015-02-09 20:45:32 +01:00
Daniel Hahler dc41e62f9a menubar: icon_formats: svg is supported 2015-02-09 20:45:32 +01:00
Daniel Hahler d25e15001f Move building of icon lookup path into get_icon_lookup_path 2015-02-09 20:45:32 +01:00
salorium c315687dad menubar: improve path icon behavior
This adds $XDG_DATA_DIRS and HOME/.icons for icon lookups.
2015-02-09 20:45:32 +01:00
Roy Crihfield 02bfd06038 menubar: quote special chars
- Simplified & renamed nocase function
 - Add pattern-quoting functions to awful.util:
   - awful.util.query_to_pattern
   - awful.util.quote_pattern
 - awful.util: Add basic unit tests for menubar query

Fixes https://github.com/awesomeWM/awesome/issues/84.
2015-02-06 18:27:38 +01:00
Roy Crihfield d268dba075 menubar: handle nil Name in .desktop files 2015-01-21 17:56:12 -05:00
Daniel Hahler f2f6eb6821 menubar: skip comments in .desktop files 2014-09-25 02:47:40 +02:00
Sindre Føring Devik 1e6f9f22a5 FS#1278 - Menubar should check all standard directories
Added local desktop directory to list of directories parsed by menubar
by using the XDG specification
2014-06-30 15:08:43 +02:00
Uli Schlachter dcc348d75e Fix some random ldoc warnings
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-13 18:06:49 +02:00
Uli Schlachter aa51379be0 menubar: Fix API docs
ldoc wants documentation comments to start with "---", not just "--".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-12-30 00:17:07 +01:00
Alexander Yakushev b0a056f50a menubar: Treat KP_Enter as pressing Enter (FS#1072)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-01-10 17:01:41 +01:00
Ignas Anikevicius (gns_ank) 9631ada0d2 Menubar utils fix the wm_name matching once more.
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>
2013-01-10 16:45:05 +01:00
Arvydas Sidorenko f57bd595dc Improved .desktop parsing (FS#1057)
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>
2012-12-01 16:25:59 +01:00
Arvydas Sidorenko 56170db631 Renamed string.gfind to string.gmatch
Lua 5.1: string.gfind renamed to string.gmatch
Lua 5.2: string.gfind removed

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-12-01 14:19:10 +01:00
Gregor Best 2badbed440 Menubar: silence find warnings
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-24 18:15:35 +01:00
Gregor Best d3a05e4822 Menubar: also look in /usr/local/share/applications
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-24 18:15:34 +01:00
Gregor Best 6b4d839fef Menubar: don't die if there's no item selected
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-24 18:15:34 +01:00
Ignas Anikevicius (gns_ank) 633e8f2f06 Menubar: Expose the wm_name attribute
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>
2012-11-22 14:12:35 +01:00
Alexander Yakushev c1addbbf72 menubar: Make prompt configurable
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>
2012-09-12 17:34:22 +02:00
Alexander Yakushev 8150482a53 menubar: Make some parameters configurable again
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>
2012-09-12 17:34:22 +02:00
Ignas Anikevicius (gns_ank) bfedd3c136 Menubar: some more prefixes
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-01 14:47:39 +02:00
Arvydas Sidorenko 61ff9ce2b7 Ported awful to lua 5.2
Tested with lua 5.1: all good

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-16 17:37:30 +02:00
Arvydas Sidorenko a75112160f Ported menubar to lua 5.2
Tested with lua 5.1: all good

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-16 17:37:30 +02:00
Ignas Anikevicius (gns_ank) 224bc63ab2 Menubar: document keybindings, some luadoc fixes.
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>
2012-05-18 12:52:29 +02:00