Commit Graph

226 Commits

Author SHA1 Message Date
Uli Schlachter 675900407a Deprecate gears.filesystem.get_dir
It is a useless thin wrapper around other functions. It's better to use
these other functions directly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-03-11 16:08:07 +01:00
Emmanuel Lepage Vallée aabff6dac7
Merge pull request #1487 from Elv13/fix_1482
Add an awful.rules chain of responsibility
2018-03-04 16:42:05 -05:00
Emmanuel Lepage Vallee 4e0915674d gears: Add a new sort module
The first use case is a topological sort to handle dependency graphs

Closes #2159
2018-03-04 01:29:33 -05:00
Emmanuel Lepage Vallee 45135b28b1 shims: Use cairo PNG support instead of GDK
It is inferior, but at least doesn't print warnings on Travis due
to the lack of X server.
2018-02-25 18:01:08 -05:00
Uli Schlachter b2d1e8574f Merge branch 'gdkpixbuf' of https://github.com/psychon/awesome 2018-02-17 13:26:23 +01:00
Uli Schlachter 28e8894f05 Give the docs for gears.color some improvements
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-22 11:53:39 +01:00
Uli Schlachter 0864829c0a Add some introductionary documentation to gears.wallpaper
Related-to: https://github.com/awesomeWM/awesome/issues/1373
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-22 11:22:05 +01:00
Uli Schlachter ee944f4da8 gears.surface: Use GdkPixbuf
This now does directly what previously awesome.load_image() did. Also,
this commit removes the only caller of awesome.load_image(), so that
function could (in theory) be removed now.

Fixes: https://github.com/awesomeWM/awesome/issues/1235
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-18 18:19:07 +01:00
Uli Schlachter 8cc469322f ensure_pango_color: Support hex values with alpha
Reference: https://github.com/awesomeWM/awesome/pull/2129#discussion_r155397507
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-13 02:15:30 +01:00
necauqua aa64978c31
Add call_now argument to gears.timer 2017-10-31 18:24:53 +02:00
Daniel Hahler 03580db5bb Merge pull request #2015 from Elv13/doc_tests_and_notif_p1_5
object: Add support for signal forwarding
2017-10-21 19:20:41 +02:00
Emmanuel Lepage Vallee ce3be7ca1b object: Add support for signal forwarding
The CAPI signal system already has this mechanism.
2017-08-19 22:52:08 -04:00
Kevin Zander 5d0e9fd9e3 Add startswith and endswith function to gears.string, change awful.completion to use startswith over local function 2017-08-14 10:48:12 -05:00
Emmanuel Lepage Vallée 2900ea6f01 Merge pull request #1842 from psychon/lgi-check
Port lgi-check.sh to C
2017-08-12 15:59:18 -04:00
Daniel Hahler 68497dffc4 gears.debug.print_{warning_error}: add "awesome: " prefix (#1968)
This makes it consistent with the C functions (`_warn` and `_fatal`).
2017-08-10 14:08:32 +02:00
Florian Gamböck a68cc783c9 Add function to check file executable bit
This is just a plain copy of the file_readable function, with "read"
replaced with "execute".
2017-08-08 20:33:47 +02:00
Uli Schlachter e73eb3ad38 gears.surface.apply_shape_bounding: Finish temporary image
This function draws the wanted shape to a cairo image surface and then
uses it to set the shape of the passed-in object. After this commit,
this temporary image is finished afterwards, making it free most of its
memory immediately instead of only later when the garbage collector
collects the image surface.

Related-to: https://github.com/awesomeWM/awesome/issues/1958
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-08-04 13:18:01 +02:00
Emmanuel Lepage Vallée 1f8b07d475 debug: Add a signal for deprecation warnings (#1832)
Fixes #1612.
2017-06-21 02:06:32 +02:00
Uli Schlachter ddc51cf38c Port lgi-check.sh to C
Previously, the lgi check used the normal Lua interpreter to check if
lgi is installed. However, nothing ensures/requires that awesome is
built against the same Lua version as the Lua interpreter. This means
that if lgi is only available for some Lua version, then the check could
succeed even though awesome would later fail to start. Also, the check
might have failed even though awesome would not have any problems
finding lgi.

This commit replaces lgi-check.sh by a small C program which does the
same thing. This ensures that the same Lua version is used as awesome
will be using.

There are some places that still use the Lua interpreter: Example tests
(run through the Lua interpreter directly) and unit tests (run through
busted). For unit tests, this should not make much of a difference and
example tests might later get similar treatment.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-06-13 15:47:07 +02:00
Uli Schlachter 801a1f0a89 Deprecate widget-drawing functions in gears.surface
This marks the functions gears.surface.widget_to_svg() and
gears.surface.widget_to_surface() as deprecated in awesome 5. This means
that by the time that awesome 6 becomes a thing, we can finally remove
these...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-30 11:22:07 +02:00
Emmanuel Lepage Vallee 74bb34ff00 wallpaper: Turn asserts into warning
Regression in v4.1. It causes the `rc.lua` (and the fallback) to
exit when the wallpaper is missing or something went wrong.

In <= 4.0, the wallpaper wasn't loaded, but Awesome didn't "crash".

There should be no asserts in the code called during the first
event loop iteration.
2017-04-24 03:10:03 -04:00
Daniel Hahler f533d0bfd8 doc: fix filesystem.make_parent_directories (#1739) 2017-04-18 15:40:57 +02:00
Uli Schlachter 4d0c9eb86e Rename filesystem.mkdir to make_directories
The longer name is a bit more self-explanatory. The plural is meant to
indicate that this recursively creates missing parent directories and
does not just try to create the single given target directory.

Since filesystem.mkdir() is part of the v4.1 release, a deprecation stub
is needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-08 11:20:50 +02:00
Uli Schlachter 48c15e4dfb g.fs.get_cache_dir: Ensure the dir exists
This makes get_cache_dir() try to ensure the cache directory that it
returns exists.

Should-fix: https://github.com/awesomeWM/awesome/issues/1663
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-08 11:02:01 +02:00
Uli Schlachter b4b070785f Add gears.filesystem.make_parent_dir(path)
Given a path, this function tries to recursively create parent
directories.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-08 11:02:01 +02:00
Uli Schlachter dc717af3ad gears.filesystem: Convert tabs to spaces
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-08 11:00:28 +02:00
romildo 62edc5a200 Add get_xdg_data_home and get_xdg_data_dirs functions to gears.filesystem 2017-03-20 20:20:36 -04:00
romildo d22207386f Add map function to gears.table 2017-03-20 20:20:36 -04:00
romildo 894c254c42 Add string split function to gears.string 2017-03-20 20:20:36 -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
Patrick Uven 008bd185ba Add scale factor to gears.wallpaper.centered (#1653) 2017-03-14 20:53:27 +01:00
Emmanuel Lepage Vallée 901df65eb0 Merge pull request #1629 from psychon/geometry_spec
Some small-ish work on gears.geometry
2017-03-12 15:45:00 -04:00
Uli Schlachter 2a57d944ba gears.geometry: Fix rectangle intersection computation
Previously, when gears.geometry.rectangle.get_intersection() was called
with two non-intersecting rectangles, it would return a negative
width/height.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-12 17:01:45 +01:00
Luke Bonham d3b8088c1b ldoc: fixes in lib/gears/color.lua and objects/client.c 2017-03-12 11:45:41 +01: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
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
Christoph Mertz 9cb60b8130 awful.screen: extract screen:get_next_in_direction() (#1597)
This extracts the code for finding the next screen
from focus_bydirection to a separate method on
the screen object.

The main reason was to use the finding code without
actually changing the screen focus but this should
incidentally make the code slightly easier to test
as well since both concerns can be tested in
isolation.

Signed-off-by: Christoph Mertz <chris@nimel.de>
2017-03-04 22:16:15 -05:00
Kevin Zander d8f57e4997 Move math functions out of awful.util into new gears.math 2017-03-02 18:15:59 -06:00
Uli Schlachter 4efee3c3d6 gears.wallpaper: Check for cairo errors
This makes things fail loudly which otherwise fail without giving a hint
on what went wrong.

Reference: https://github.com/awesomeWM/awesome/issues/1570
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-02-19 14:10:26 +01:00
Uli Schlachter 4fc396ec57 gears.wallpaper: Only finish own surfaces
If the caller provides a file name, these function load the image, set
it as the wallpaper and make sure that the memory used for the image
data is freed immediately. However, this was also done when the caller
provided a cairo surface, thus breaking their surface.

Fix the code so that it does not finish surfaces that it did not create
itself.

Fixes: https://github.com/awesomeWM/awesome/issues/1570
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-02-19 14:10:05 +01:00
Holger Schurig bf2c1993db doc: fix signals (#1455)
- rule reordering was mentioned twice in the NEWS
- fix all shown luadoc errors
- add missing descriptions for signals in module "awesome"
2017-01-28 15:03:56 +01:00
Emmanuel Lepage Vallee 1e1bebc269 timer: Add a "real world" example
This was asked on IRC. While many user configs have such patterns,
the documentation had none.

It isn't using the test framework because of the delay.
2017-01-20 00:22:49 -05:00
Emmanuel Lepage Vallee 595ade2228 timer: Add a `singleshot` constructor property.
Also save some boilerplate code.

This closes the gap between timer.start_new and timer.new. Now the
only difference is that one have a special callback format while
the other only has predefined properties.
2017-01-20 00:22:49 -05:00
Emmanuel Lepage Vallee d8f51a4039 timer: Add a callback constructor property
Avoids having to keep a local variable just to be able to
register the callback.
2017-01-20 00:22:49 -05:00
Emmanuel Lepage Vallee bd96eacbe2 timer: Add an autostart constructor property 2017-01-20 00:22:49 -05:00
Emmanuel Lepage Vallee 790d2aa6ee doc: Add a missing test example macro
I found this while doing a review in case the intentation changes
broke other tests.
2017-01-03 00:07:57 -05:00
Daniel Hahler 4b9e8e232d Merge pull request #1341 from psychon/modeline
Lots of fun with vim modelines
2017-01-02 19:56:06 +01:00
Uli Schlachter 1078a9f395 Bump minimal LGI version to 0.8.0 (#1350)
Turns out that menubar already uses features that were only added in
that version.

Fixes: https://github.com/awesomeWM/awesome/issues/1348
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:53:02 +01:00