Commit Graph

282 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 3d918258e2 widget: Turn `:buttons()` into a normal property. 2019-10-05 18:06:51 -04:00
Emmanuel Lepage Vallee 4cab9f8c38 widget: Return `nil` in case of failure.
Instead of an assert. If there is a "real" error, then a warning is
still printed, but otherwise this relax the requirements.
2019-10-05 18:06:50 -04:00
Emmanuel Lepage Vallée 0857a8fef8
Merge pull request #2800 from psychon/fix_negative_sizes
Fix negative sizes with the margin container
2019-06-21 17:30:59 -04:00
worron 3295e9f33d imagebox: Better svg support (#2779)
Use rsvg api to render svg image at requested size.
2019-06-21 17:30:10 -04:00
Uli Schlachter 2aa198a57b wibox.widget.base.place_widget_*: Protect against negative sizes
This commits adds assertions to catch negative width or height.

Would-have-helped-with: https://github.com/awesomeWM/awesome/issues/2799
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-06-19 18:20:09 +02:00
worron 99e81c097a imagebox: apply shape before scale (#2793) 2019-06-12 19:39:00 -04: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
Emmanuel Lepage Vallee 11d7a614d9 doc: Add a constructor stereotype for everything.
This forces the constructor functions to be at the top of the API
documentation rather than in a random position.
2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee 63ca0f0d8f doc: Use an explicit @method stereotype for all methods.
ldoc has a magical `@classmod` module type which tries to detect
what is a method and what is a static function. It fails about as
often as it works. This commit makes everything explicit to remove
such issues.

Fixes #2640
Ref #1373
2019-06-08 18:13:42 -04:00
Emmanuel Lepage Vallee bb51add089 doc: Move all widgets to a new section. 2019-06-08 17:49:14 -04:00
Hùng 755c44ca52 Slider new feature `bar_active_color` and examples
- Fill slider bar with a linear pattern based on current value (if `bar_active_color` and `bar_color` are correctly provided)
- Add examples for the apidoc
2019-04-23 23:13:32 -04:00
Emmanuel Lepage Vallee 02ed7ceed5 widget.base: Allow widgets constructor in the declarative template.
This avoids the boilerplate of having to do:

    {
        widget = awful.widget.mywidget
    }

in the templates.
2019-04-05 21:06:11 -04:00
Uli Schlachter 5f2cdabc01 textclock: Produce reproducible output (#2622)
When $SOURCE_DIRECTORY is set, we are most likely currently running the
examples test, i.e. generating images. These images end up in the
documentation.

To make the images reproducable, i.e. independent from the current time,
this commit makes the textclock honor $SOURCE_DATE_EPOCH if
$SOURCE_DIRECTORY is set.

See commit 9d7eaf02 for some more details.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-31 20:34:41 +01:00
Emmanuel Lepage Vallée a2cd918603
wibox: Stop monkey-patching the `get_children_by_id` function. (#2513)
Before this commit, it was added by `wibox.widget.base` if
`:setup()` is used. However it doesn't work for the `awful.popup`
because of the extra indirection.

This commit stops the monkey-patching and make sure the function
always exists. This doesn't prevent it from not working and in
the long run this should still be moved into the hierarchy.

However for now it makes the situation a lot more consistent and is a
quick band-aid without too much controversy.

Mitigate #2181
2019-01-01 15:04:47 -05:00
Emmanuel Lepage Vallée 5b9180fc1b
Merge pull request #2249 from Aire-One/fix_widget_slider_doc
Fix widget slider doc
2018-04-26 20:46:54 -04:00
Aire-One 7521a861e6 add documentation for signal "property::value" 2018-04-24 00:23:42 +02:00
Jim Garrison 301d5b80c4 Move timezone determination to callback (#2229)
Patch by @psychon.  Fixes #2218.
2018-04-22 02:05:40 -04:00
Emmanuel Lepage Vallée 1182ad0f92
Merge pull request #2153 from otommod/master
Add set/get for textclock attributes
2018-01-22 17:44:03 -05:00
Otto Modinos 3687d198f2 textclock: mimick other widgets for docs/naming 2018-01-21 02:32:26 +02:00
Otto Modinos 1e685635a8 textclock: rename timeout to refresh 2018-01-21 02:06:24 +02:00
Otto Modinos 9d3a9547b1 Add set/get for textclock attributes
To allow "declarative" construction of clocks.
2018-01-21 02:04:12 +02:00
Uli Schlachter a4936c963c Fix 'creating new widgets' link (#2157)
This was broken ever since it was introduced in commit b1e69dba8c.
Yay. :-(

Fixes: https://github.com/awesomeWM/awesome/issues/1373#issuecomment-357891791
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-16 21:15:49 -05:00
Emmanuel Lepage Vallée 056af3d48d
Merge pull request #2109 from Elv13/revert_dpi_per_screen
screen: Revert the DPI per screen changes.
2017-11-23 23:42:26 -05:00
Emmanuel Lepage Vallee 314e307cd6 textbox: Ensure that the DPI arguments are not nil
Otherwise it fails. This allows better error message to be sent to the
user.
2017-11-23 23:28:32 -05:00
Uli Schlachter 5ef937c07c textclock: Detect failures from g_date_time_format (#2119)
If g_date_time_format() fails, it returns a NULL pointer. This change
makes the textclock detect this and print a warning. This warning
contains 'g_date_time_format()' so that people can ask their favorite
search engine for the supported formats of this function. This warning
also contains the actual format string so that all the information is
available in one place and possible bug reports hopefully include the
format string.

Reference: https://github.com/awesomeWM/awesome/issues/2118
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-11-23 23:27:18 -05:00
Emmanuel Lepage Vallee 33124d8605 widget: Add a separator widget. 2017-11-06 05:19:17 +01:00
Uli Schlachter 1592180c83 textbox: Make some screen arguments optional again (#2057)
Since beautiful.xresources.get_dpi(s) allows nil as argument to query
some "global DPI", the functions to query the size of a textbox also
allowed to use nil as the screen, even though this was never documented
to work. Commit a137655791 broke this by assuming a valid screen
object.

This commit makes a nil argument work again, but will cause a
deprecation warning in awesome 5.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-21 19:32:35 +02:00
Daniel Hahler c362524a5f Merge pull request #2012 from Elv13/doc_tests_and_notif_p1_2
widget: Add a flexible generic constructor
2017-10-21 19:26:49 +02:00
Uli Schlachter a137655791 Add & use a dpi property on screen objects
Once upon a time, beautiful.xresources.get_dpi was added to query
Xft.dpi. That made sense since this queried an xresources property. Over
time, other, non-xresources-based ways to query DPI were added to this
function. Now, it makes no more sense to have this function here.

Also, recently it became possible to add new properties to C objects
from Lua code. Thus, we no longer need to have a get_dpi() function
somewhere, but can add s.dpi directly.

Thus, this commit adds s.dpi and makes everything use it. No functional
changes are intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-08 12:30:21 +02:00
Uli Schlachter b04b1b27af Add a force_update() method to the textclock (#2034)
Reference: https://github.com/awesomeWM/awesome/issues/344
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-09-10 20:12:25 +02:00
Emmanuel Lepage Vallee 7e8f3e9b9b widget: Add a flexible generic constructor
This avoid copy pasting this kind of code in many places.
2017-08-19 22:45:54 -04:00
Uli Schlachter 12bb7f5a9e Improve docs for emit_signal_recursive (#1998)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-08-16 13:37:14 +02:00
Uli Schlachter 07d561ee91 wibox.widget.calendar: Stop using make_widget_declarative
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-07-09 19:00:16 +02:00
getzze 5b0abb9541 widget: Add a calendar widget 2017-06-12 02:58:06 -04:00
Uli Schlachter 6de6419180 Add functions to draw widgets to a cairo surface
These are supposed to eventually replace the already-existing functions
in gears.surface which have a similar signature

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-30 11:22:07 +02:00
Matt ddf9689767 Add timezone option for textclock widget (#1743)
Adds a third parameter "timezone" to the textclock widget that is
optional. Defaults to local timezone if nil.

Signed-off-by: Matt Harrison <matt@harrison.us.com>
2017-04-21 16:34:23 +02:00
getzze 59662bc971 wibox.widget.base: do not call set_children if children is nil 2017-04-18 15:00:39 +02:00
axujen 8e70b71c9c Fix imagebox:set_image not returning anything
set_image should always return true or false according to the docs
2017-04-06 19:33:14 +01:00
FireFish5000 ffda3b0c4c Add null check to set imagebox to blank state 2017-03-25 00:07:55 -05: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
Emmanuel Lepage Vallée 957966d636 Merge pull request #1646 from psychon/systray_removal
Partly fix removal of systray from a wibox
2017-03-12 15:43:40 -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
Uli Schlachter 64b964972b systray: Enable properties and improve documentation
I spent way too much time trying to figure out why setting "visible" to
false did not work...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11 18:46:40 +01:00
Uli Schlachter 51e4a47938 Partly fix removal of systray from a wibox
This commit changes the systray widget, wibox.drawable and the C code to
fix the following bug: When the systray widget is removed from a
drawable without being moved somewhere else, the systray stayed visible.
This was because the systray is not drawn by awesome, but only placed.
When the widget is no longer "drawn", it stays wherever it was placed
last.

This change works by detecting the situation when the systray is
removed. Then, the C code is specifically told to remove the systray
window from the drawable.

Note that this is only a partial fix. This change works correctly when
the widget is removed completely, because it is no longer placed by its
parent widget. However, for example, when you do
wibox.widget.systray().visible = false, the effect is just that the
systray widget gets size 0x0. This is not really visible, but as far as
this change is concerned, the widget is still part of the drawable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11 18:14:38 +01:00
Kevin Zander c3461b535c gears: Move awful.util.table to gears.table (#1641)
* Move table functions out of awful.util into new gears.table

* travis: Use v9999 prefix for full requests

Make sure no newly deprecated functions are used

* Move all `awful.util.table.*` calls to `gears.table.*` calls
Move table test functions from awful/util_spec to new gears/table_spec
Change awful.util.subsets call to gears.math.subsets in awful/key.lua
2017-03-08 15:18:33 -05:00
Uli Schlachter 9f2c4719ed Make the piechart deterministic (#1258)
Previously, the API to set the data that should be displayed was
:set_data(t) where t is a table. This table has the labels to use as its
keys and the numbers as its values. With this API, it was not possible
to influence the order in which the "pie pieces" were drawn.

This commit adds and uses a new API called :set_data_list(t). Here, t is
a table with integer keys and tables as values, thus one can iterate
over this with ipairs() and the order is well-defined. The tables used
as values contain the label as their first entry and the number as their
second entry.

Fixes: https://github.com/awesomeWM/awesome/issues/1249
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-07 20:20:09 +01:00
MoreThanOneAnimal 51bbb53b30 Add references to gears.color in documentation. 2016-11-28 20:07:29 -08:00
Daniel Hahler fc13b1b4eb doc: s/Wether/Whether/ 2016-11-22 02:40:15 +01:00
Daniel Hahler eed3d7e63a lib/wibox/widget/base.lua: doc fixes 2016-11-22 02:40:15 +01:00
Emmanuel Lepage Vallee 4b34e64fe2 widget: Add a slider widget. 2016-10-12 02:24:47 -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
Daniel Hahler 332681aaad progressbar: keep set_height/set_width working (#1141)
Ref: https://github.com/awesomeWM/awesome/issues/1140
2016-10-05 00:24:43 +02:00
Emmanuel Lepage Vallee b6421699da doc: Add more graph documentation. 2016-09-26 01:20:57 -04:00
Emmanuel Lepage Vallee 5ef9b64b40 graph: Add shape support
This complete the shape API. Now, everything support shapes.
2016-09-26 01:20:57 -04:00
Emmanuel Lepage Vallee 68999f4a86 graph: Add min_value
Fix #277
2016-09-26 01:20:56 -04:00
Emmanuel Lepage Vallee 549d68dcc5 doc: Add more progressbar shape examples 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 7b11f1c1b4 tests: Test progressbat paddings, margins and clip 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee a8568eb969 doc: Add examples for vertical and labelled progressbar 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee e1733dd37a progressbar: Add paddings and margins properties
This restore a feature that was available in Awesome 2.1-3.2.

The reason margin is implemented rather than use a container is to
be able to make the background smaller than the bar.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 915c10b1f8 progressbar: Add shape support
The current progressbar code dates from a time when Awesome had
a very limited drawing API. This commit first re-write the
algorithm to remove the workaround used to draw the border using
full rectangles only. It then add support for outer and inner
shapes with their respective border settings.

This commit also add clip support. This is enabled by default, but
could be disabled to have the bar taller than the background.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 8ec53c827b progressbar: Fix a race condition
When created using the declarative syntax, set_value could be
called before set_max_value, this trimmed the value.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee e5d4c188f1 progressbar: Remove vertical/width/height code
The deprecation message should be enough. This doesn't remove
the functionalities themselves.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee e28b79944f doc: Use @property for the progressbar doc. 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 8d7f228301 progressbar: Conform to the new widget conventions.
It is not Awesome 3.2 anymore, progressbars are no longer userdata.
2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 7cbcc800bc progressbar: Remove dead code. 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 2c620468f0 progressbar: Deprecate width, height and vertical properties. 2016-09-26 01:18:09 -04:00
Emmanuel Lepage Vallee 89f796b268 doc: Fix copy paste mistake. 2016-09-25 22:47:35 -04:00
Emmanuel Lepage Vallee 0a3a71dd45 widgets: Add a piechart widget. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 3f0b033e72 checkbox: Add a shape based checkbox widget. 2016-09-24 14:45:09 -04:00
Emmanuel Lepage Vallee 370d333590 widget: Add recursive signals.
This allows to ignore containers and layouts when a signal is sent.
2016-08-20 15:41:12 -04:00
Emmanuel Lepage Vallee 41feec02a5 widget.base: Fix the root get_children_by_id() widget.
If the wibox root widget had an id, it was added to the properties,
but not the get_children_by_id() table
2016-08-01 15:26:29 -04:00
Emmanuel Lepage Vallee 79394c0965 widgets: Apply attributes before adding the widgets
For example, some layouts may place the widgets in a different order
depending on some attreibutes.
2016-07-23 17:24:13 -04:00
Emmanuel Lepage Vallee 6eca36d764 progressbar: Add missing includes documentation variables 2016-06-24 15:59:02 -04:00
Uli Schlachter 0857f6f1b5 Lua: Remove calls to add_signal()
The requirement to call add_signal() was added to catch typos. However, this
requirement became increasingly annoying with property::<name> signals and e.g.
gears.object allowing arbitrary properties to be changed.

All of this ended up in a single commit because tests/examples fails if I first
let add_signal() emit a deprecation warning.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-04 18:23:48 +02:00
Emmanuel Lepage Vallee 756862dff6 systray: Use table.crush 2016-05-30 23:12:49 -04:00
Emmanuel Lepage Vallee cbe046b0db progressbar: Add theme options 2016-05-30 23:10:03 -04:00
Emmanuel Lepage Vallee 7c00b2a55a graph: Add theme options 2016-05-30 23:10:02 -04:00
Emmanuel Lepage Vallee 18500838d9 textclock: Add missing documentation 2016-05-30 23:10:02 -04:00
Emmanuel Lepage Vallee c62ca6c665 imagebox: Enable the property system
And add the missing documentation
2016-05-30 23:10:02 -04:00
Emmanuel Lepage Vallee 5a0f7b7efe textbox: Enable the property system
And add the missing documentation
2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee ea16481228 graph: Enable the property system
And add the missing documentation
2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee 9630f3c3ed widget: Move the identifier index into _private 2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee fdf86ba84d widget: Move height and width into _private 2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee c0eabf9d8f widget: Move 'visible' into _private 2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee afa17fd8f9 widget: Move 'widget_buttons' into _private 2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee c828e56b57 widget: Fix documentation 2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee 542070205f widget: Add proper accessors for the 'opacity' property
To avoid collision with the property system and comply with the
API guidelines.
2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee c9dd32424f doc: Fix wibox.widget.base documentation
It was set as `module` instead of `class` because ldoc was confused
set shown the methods as functions and functions as methods.

This commit set the explicit section so ldoc don't gress (wrongly)
2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee adb2f88383 objects: Add a table for private elements
Provide a standardized place for them rather than having each
widgets use their own conventions.
2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee efcbda0a78 widget.base: Add property support 2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee a8505ed019 doc: Add an imagebox widget default screenshot 2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee 83a9a9e67a doc: Add a progressbar widget default screenshot 2016-05-30 18:00:59 -04:00
Emmanuel Lepage Vallee f29eeed82e doc: Add a graph widget default screenshot 2016-05-30 18:00:58 -04:00
Emmanuel Lepage Vallee ec2cfc7be2 doc: Add a textbox widget default screenshot 2016-05-30 18:00:58 -04:00
Emmanuel Lepage Vallee 3c2aa09b86 doc: Document the beautiful vars used by the systray and textbox 2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee 9d0693ce3a doc: Do not export draw, fit and layout methods
They are used internally, users should never call them.

This will make the API documentation cleaner.
2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee be23bf0f15 widget: Fix documentation 2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee f9c9e11d11 graph: Move to wibox.widget 2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee 6493cbee76 progressbar: Move to `wibox.widget` 2016-05-30 17:51:19 -04:00