Commit Graph

9848 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 93b90026e9 root: Add a `has_key` and `has_button` functions. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 86d8ef3142 awful.button: Turn into an object. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 21ae9c1edb awful.key: Turn into an object. 2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 3b5db8a9be rc.lua: Add root keys and buttons instead of setting the list.
As visible in various modules and even built-in components like
`awful.keygrabber`, it was previously necessary to work around the
fact that keybindings could not be added later without using some
low level API hacks.

From now on, `rc.lua` will be a good citizen and use the same APIs as
the module to manage keybindings.
2019-11-09 16:43:12 -05:00
Emmanuel Lepage Vallee 4501f0e768 Allow to add and remove keys and buttons.
Another step in moving these APIs toward the common object oriented and
declarative paradigms used by other APIs.

This commit introduces the `awful.keyboard` module. It currenly only
exists as a placeholder for the first few append/remove function, but
will grow in scope in another pull request to expose the currently
private modifier APIs and to provide keybindings collision detection
and replace some of `awful.hotkey_popup` business logic.

The `keygrabber` tests which uses root keybindings are disabled for
now to keep the commit size small. This is necessary since the shims
will need many iterations of changes before this work again with the
new syntax.
2019-11-09 16:42:06 -05:00
Emmanuel Lepage Vallee 4dbc83fa7d doc: Modify the template to allow merging sections.
It might not be the most pretty of change, but it works. With this
change, it is possible to have multiple "things" in the "same"
section having the "same" name.

This allows for C/C++ style functions with the same name but different
signatures. Lua doesn't handle this well, so it should usually be
avoided. However, constructors might be a valid exception. Most older
widget (and object) constructors have multiple random argument while
newer one use `args`. Deprecating the old ones for the sake of
standardization might be a bit too much for users upgrading from v3.5.

Given the only reason all of those deprecation would happen is because
"its pretty that way", then lets allow 2 constructors and avoid outrage.
2019-11-03 01:28:29 -05:00
Emmanuel Lepage Vallée 0297bfff9a
Merge pull request #2913 from actionless/add-vim-test-dep
doc(readme): add vim to test deps
2019-10-18 18:28:34 -04:00
actionless 68651477fb refactor(test: awesomerc: hotkeys): imitate fake vim client instead of depending on vim as test dep 2019-10-18 19:02:47 +02:00
actionless e048c4200c style(readme): remove dots at the end of the list items 2019-10-18 18:52:44 +02:00
actionless 0333cddfa2 doc(readme): add xterm to test deps 2019-10-18 18:50:43 +02:00
actionless e78d711846 doc(readme): add vim to test deps 2019-10-18 18:45:18 +02:00
mergify[bot] f6f5b461e3
Merge pull request #2910 from xinhaoyuan/pr-ewmh-merge_maximization
fix ewmh.merge_maximization
2019-10-18 16:41:18 +00:00
Xinhao Yuan 0e8dd4c1c9 Added more tests to check partial maximization handling, which require wmctrl as an optional dependency. 2019-10-17 18:54:29 -04:00
Xinhao Yuan 33570e45d7 Added a test to check if window state is restored after a client unmaximizing itself. 2019-10-16 18:23:21 -04:00
Xinhao Yuan 8beb0286ea Fix: toggling the `maximized` state properly when a client requests to unmaximize.
The fix focuses on ewmh.merge_maximization function, which handles client intentions to change maximization states.
The fix includes:

  1. Fixing the `get_value` helper function to return the proper resulting state that client wanted to change.
     For example, when `c.maximized and not c.maximized_horizontal and not c.maximized_vertical` holds,
     the client would observe the `MAXIMIZED_VERT` and `MAXIMIZED_HORZ` atoms in X11, but get_value would compute
     the result values based on `c.maximized_{horizontal,vertical}`, which are all false. The fix makes the computation
     consistent to clients' view.

  2. Interpret a client's maximization intentions based on the client's view of how the X11 atoms changes.
2019-10-16 18:23:18 -04:00
mergify[bot] 344964a44a
Merge pull request #2529 from actionless/hotkeys-popup-dont-show-empty-groups
fix(awful: hotkeys_popup): don't show group label if group itself is empty
2019-10-12 22:14:48 +00:00
mergify[bot] bafe028a05
Merge pull request #2905 from psychon/imagebox_raw_pointers
imagebox:set_widget(): Handle userdata again
2019-10-11 16:50:57 +00:00
Uli Schlachter 08e230b1b3 imagebox:set_widget(): Handle userdata again
This function is not documented to handle userdata, but historically it
would just pass all arguments to gears.surface.load(), which interpreted
userdata as cairo surfaces. After 3295e9f33d, userdata
objects are restricted.

Accept userdata objects again by explicitly passing them to
gears.surface.load().

Fixes: https://github.com/awesomeWM/awesome/issues/2903
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-10-11 16:14:57 +02:00
actionless 0374bf1b1b test(awful: hotkeys_popup): test pagination and app-specific hotkeys (on vim example) 2019-10-11 15:33:43 +02:00
actionless beb54c7d5f fix(awful: hotkeys_popup): don't show group label if group itself is empty
1) factor out grouplabel-related logic into _create_group_columns() method
2) check the number of keys in group before calling that method
2019-10-11 15:31:57 +02:00
mergify[bot] 3340a7dce9
Merge pull request #2902 from xordspar0/patch-1
Add documentation about textclock format
2019-10-11 06:04:46 +00:00
Jordan Christiansen 580883add3 Add documentation about textclock format 2019-10-10 22:33:53 -05:00
Emmanuel Lepage Vallée e888d983ef
legacy: Temporary workaround for #2897. (#2898)
The `:keys()` and `:buttons()` APIs moved from get/set single methods
to properties. It works fine if you use the new or old API, but has
limitations when mixing them. `awful.rules` calls properties in a loop
after checking if it is a function. Thus it triggers the secondary
codepath to try to handle this case.

This codepath was tested with gears.objects based components
(ie. widgets). It was not tested with clients and tags, and it
didn't work because they use `awful.tag.getproperty` and
`awful.client.property.get` instead of `._private` like all
newer components. Those old functions are officially deprecated,
but used by tons of configs and modules ported from v3.5 and thus
still the default way to access Lua properties in our implementation.

This commit adds a `_private` to anything that doesn't have one to
at least make the error stop. It will "mostly" work until a more
complete solution is added. Reverting the 2 PRs that changed this
would delay getting more feedbacks.
2019-10-09 13:35:05 -04:00
mergify[bot] ab0b4dc8ac
Merge pull request #2896 from streetturtle/patch-2
Fix typo and wrong property name in popup docs
2019-10-08 16:35:36 +00:00
streetturtle 1b79dec685
Fix typo and wrong property name in popup docs
Fix typo: maxmimum -> maximum and fix wrong name of the property.
2019-10-07 21:45:41 -04:00
Emmanuel Lepage Vallée f294ab37fe
Merge pull request #2508 from Elv13/xmas_2k18_2
New round of API standardization (for v4.4)
2019-10-06 04:34:56 -04:00
Emmanuel Lepage Vallee 2c08c2fa39 quality: Port all legacy `:buttons()` to `.buttons`. 2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee fa414a86a3 tests: Test `widget:add_button()` 2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee ab1e62a332 Remove the instances of :buttons(awful.button()).
Having buttons without an awful.util.table.join/gears.table.join
has never been officially documented to be supported. I hope there
isn't too many of those and they wont try to mix the new and old
API syntax, because that will totally break.
2019-10-06 03:50:56 -04:00
Emmanuel Lepage Vallee cf0385af80 widget: Add an `:add_button()` method.
This is done now because a lot of code in `lib/` add buttons by manually
extracting buttons from awful.button. Instead of adding ugly code to
prevent using the legacy API, do this.
2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 57f38f4824 layoutbox: Deprecate the old constructor 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee b23a2e81c5 tests: Stop using the legacy layoutbox constructor.
(done in a commit so the CI can test some commits with the old
constructor)
2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee f4a0e1fc39 rc.lua: Use `.widget =` instead of `:setup()`.
More work on the property vs. r/w methods standardization.
2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 48ac59c0b6 rc.lua: Use the new keys API for the global keys. 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 965d7c1b47 rc.lua: Use the new API to set the client keys 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 4617365ee2 rc.lua: Use the new client API for the titlebar buttons. 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 5f829171c4 rc.lua: Use the new API for the client buttons 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 951b774a70 rc.lua: Use the new API for root.buttons 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 8eda69adbe rc.lua: Use the modern layoutbox constructor 2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 56b242906d rc.lua: Use the buttons property instead of method for the tag/tasklist
Begin to bring consistency to these ancient components.
2019-10-05 22:57:05 -04:00
Emmanuel Lepage Vallee 82db9180b1 widget: Mutualize all set_widget implementation to behave the same
Now always call both check_widget and make_widget_from_value. This
should make it a lot less confusing when randomly trying to create
a widget as all ways to do it slowly converge toward an unified
one.
2019-10-05 22:57:04 -04:00
Emmanuel Lepage Vallee 349b75994f titlebar/wibox: Support widget definition in set_widget.
So now it is mostly identical to `:setup()` beside some legacy
difference in how the get_children_by_id is implemented.
2019-10-05 22:57:04 -04:00
Emmanuel Lepage Vallee 249f11ec82 drawable: Add property getter/setter support.
Just like the wibox and the other APIs
2019-10-05 22:57:04 -04:00
Emmanuel Lepage Vallée 019a36535f
Merge pull request #2893 from Elv13/xmas_2k18_2_merge_p1
API standardization merge part 1
2019-10-05 22:53:42 -04:00
Emmanuel Lepage Vallee cbb90d8bd1 root: Turn `root.keys()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 296ad18922 client: Move the `c:keys()` method to a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee f747438879 layoutbox: Modernize the constructor.
Another step in the long running project to unify all constructors
design.
2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 29e804a4f8 drawin: Turn `:buttons()` into a property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 3d918258e2 widget: Turn `:buttons()` into a normal property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee d5dd3fc794 tests: Test root.buttons
Try both legacy and standardized code paths. Also try invalid mixes of
them in case some modules abuse of rc.lua and ingest the wrong format
by accident.
2019-10-05 18:06:51 -04:00