Commit Graph

2835 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee cedeb2bb5a wibox: Add a `to_widget()` and `save_to_svg()` method.
Take a wibox snapshot as a widget. It also add an helper to save
it to a file. This is useful for debugging when called from
`awesome-client`
2017-10-21 19:34:04 +02: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 c7d75ed119 awful.screen.object.get_dpi: Ignore outputs with size 0 (#2063)
For example, Xephyr reports its output with a size of 0x0. Since a
division by zero is in no one's interest, just ignore such outputs when
trying to compute the DPI value.

Thanks to @timroes for pointing this out:
c8fac753c4 (commitcomment-25072296)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-21 19:23:04 +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
Uli Schlachter c8fac753c4 Merge pull request #2055 - psychon/auto_screen_dpi 2017-10-14 18:26:50 +02: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
Uli Schlachter d0fbb96d2d screen.dpi: Use RandR for per-screen DPI
This commit makes awesome automatically compute the DPI of a screen
based on its RandR outputs. If multiple outputs exist, the lowest DPI is
used.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-08 14:40:20 +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 7e395e7bc0 Use memory shorter with awful.client.shape (#2051)
To apply the shape of a client, we have to create an image and draw the
shape we want to it. Since clients can be quite large, we have to make
sure that we do not keep this image alive unnecessarily long.

The code in awful.client.shape.get_transformed() however needs another
temporary surface in case the client has its own shape and another one
was set in Lua (side note: currently the code also creates this extra
temporary surface if the client does not have its own shape; that might
be worth fixing). This temporary surface is then used as the source of a
cairo context to draw it to the image that will be used as the client's
final source.

After we are done, the temporary surface is still kept alive since it is
the current source of the cairo context. The cairo context in turn is
only freed when Lua's garbage collector collects it, which may take
quite a while.

Improve this by setting a different source to the cairo context. Thus,
it now releases the temporary surface as soon as possible and it is only
allocated for a short time.

Fixes: https://github.com/awesomeWM/awesome/issues/2050
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-07 18:22:50 +02:00
Uli Schlachter 4e42996d9a naughty: Fix replaces_id + changing colors (#2041)
This fixes a regression introduced in be29ee6768. This commit changed
naughty to reuse an already-existing wibox when replaces_id is used,
instead of creating a new wibox. However, some of the properties that
are set only when creating a wibox were ignored due to this.

Fixes: https://github.com/awesomeWM/awesome/issues/2040
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-09-30 21:37:33 +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
Uli Schlachter 55dee1ea87 magnifier layout: Never manage floating windows (#2046)
The magnifier layout handles the currently focused client specially.
However, if the currently floating client is floating, it should not be
handled by the layout at all. A bug caused the magnifier layout to
handle a focused and floating client anyway if it was the only tiled
client.

Fix this by removing the '#cls > 0'-case. If #cls == 0, then no client
is available to be managed. Thus, cls[1] will be nil, which is fine
since, well, no client is available to be managed. This only made a
difference in the specific bug that I described above. Thus, drop this
case.

Fixes: https://github.com/awesomeWM/awesome/issues/2045
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-09-28 22:56:41 +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
Yauhen Kirylau ebcc19844e fix(awful: placement: no_overlap): use new placement infrastructure (#2032)
Fixes #2030
2017-09-09 16:26:54 -04:00
Daniel Hahler 66c4e55511 Merge pull request #2029 from actionless/calendar-fix-click-hide
Calendar popup click/hover fix
2017-09-09 05:14:02 +02:00
getzze 35432e9f21 Avoid skipping a month if the day is 31 (#2028) 2017-09-08 22:08:47 +02:00
actionless c9fbecd1e8 refactor(awful: widget: calendar_popup): s/_calendar_clicked/_calendar_clicked_on/ 2017-09-01 22:43:57 +02:00
actionless 23613bac05 fix(awful: widget: calendar_popup): hover was not working anymore if hiding popup by clicking on it 2017-09-01 22:43:07 +02:00
Yauhen Kirylau 9e4446060e feat(awful: widget: calendar_popup: attach): implement 'on_hover' option (#2008)
* feat(awful: widget: calendar_popup: attach): implement 'on_hover' option

* feat(awful: widget: calendar_popup): smarter handling of click and hover at the same time
2017-08-27 21:01:24 +02:00
Yauhen Kirylau fd66d12a4b feat(awful: widget: calendar_popup): implement 'margin' widget property (#2010) 2017-08-27 14:23:43 +02:00
Emmanuel Lepage Vallée ec08af4e76 clienticon: add a client setter (#2018)
It's required to work with the declarative syntax and be used
in the tasklist due to its limitations.
2017-08-27 14:23:06 +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 aa1ff23b19 Merge pull request #1992 from Veratil/string-funcs
Add two new gears.string functions: startswith, endswith.
2017-08-21 21:11:25 +02:00
Emmanuel Lepage Vallée fd2307afd0 grid: fix an unavoidable assert (#2017)
`:add()` was called with the optional `...` arguments, but the
function required at least one argument.
2017-08-21 21:10:43 +02:00
Daniel Hahler 784472f212 doc: improve/fix doc for awful.rules (#2005) 2017-08-20 13:37:03 -04: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
Emmanuel Lepage Vallee 2303e31355 mouse: Fix a bad refactoring
The `wibox_under_mouse` property was renamed `current_wibox` but
a call wasn't updated.
2017-08-19 22:50:17 -04: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
SpiritCroc a20dd4ad61 KeyboardLayout widget: add EurKey (#2003) 2017-08-17 17:21:40 +02: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
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
Nick Diego Yamane bfe58d65f1 docs: fix some typos/leftovers (#1989)
Signed-off-by: Nick Yamane <nick.diego@gmail.com>
2017-08-14 16:06:44 +02:00
Uli Schlachter 8166e2ff8b Fix the example in the tooltip docs (#1980)
Reference: https://github.com/awesomeWM/awesome/pull/1978
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-08-13 12:23:40 +02: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
Daniel Hahler 31e25dc6a5 Cleanup usages/patching of awful.util.deprecate (#1966) 2017-08-10 12:18:54 +02:00
Florian Gamböck 0bd74b4f72 Append slash on true local directories
A slash must only be added if the current completion item starts with
`./` and is actually a directory.
2017-08-09 21:20:22 +02:00
Florian Gamböck 7c677e01cc Replace os.execute with gfs function 2017-08-09 21:20:22 +02:00
Florian Gamböck e8ad3a32f5 Add string helper function
This function returns true if a string starts with a given prefix.
2017-08-09 21:20:22 +02:00
Florian Gamböck 1802a44018 Import gears.filesystem
This is needed for some future filesystem checks.
2017-08-09 21:20:22 +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
José Romildo Malaquias 0def266c84 Add entry for menu font in theme (#1961) 2017-08-07 14:36:40 -04:00
Emmanuel Lepage Vallée 90e8b67d37 Merge pull request #1960 from psychon/fix-some-leaks
Fix some leaks
2017-08-07 14:36:08 -04:00
Daniel Hahler 828eefed79 awful.tooltip: border: do not default to border_width (#1955)
Several themes use `dpi(2)` which is quite thick, and it is better to
use the default of 0 here, instead of `beautiful.border_width`, which is
meant for borders on clients.
2017-08-05 16:07: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
Uli Schlachter 0da790c026 awful.tooltip: Finish temporary image
For setting the shape of the tooltip, this code creates an image surface
describing the wanted shape. After this commit, this image surface is
finished when it is no longer needed. This results in most of the
image's memory to be freed 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:16:12 +02:00
Uli Schlachter 11216d8ca4 awful.mouse.snap: Finish temporary image
This function creates a temporary image surface to set the shape of a
wibox. After this commit, the image is now finished after use. This
results in most of the image's memory to be freed immediately instead of
waiting for the garbage collected to collect it.

Related-to: https://github.com/awesomeWM/awesome/issues/1958
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-08-04 13:14:51 +02:00