Previously, odd things could happen if a widget was getting fitted into a
negative width or, even worse, width being NaN (not a number)!
This can e.g. happen due to a margin layout which doesn't get enough space to
even draw the margin that it is supposed to add.
Fix this by enforcing a minimum value of 0 for the width and height that a
widget gets fitted into.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Given an imagebox i with i.resize_forbidden = false and a valid image set, the
call t:fit(0, 0) would return two times "not a number".
This is because the code first does some calculations to get the input image
into the available space and then tried to do some calculations needed for
scaling images up.
The first calculation already gave us h == 0 == w, the second calculation would
then calculate 0/0. This results in NaNs.
This was only noticed because NaN is not a valid table index in lua.
Fix this by returning 0,0 if we have an image of width or height 0 after the
first calculation. Since 0x0 images are valid in cairo, this also fixes the same
bug with such images.
Signed-off-by: Uli Schlachter <psychon@znc.in>
There is a strong hint that you are doing something wrong: You call
client.emit_signal(some_signal, c). Chances are high that this signal is
supposed to be emitted on the client object 'c' instead of the underlying client
class.
This applies to awful.rules' usage of this signal.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Before commit 1b2826 in lgi, the get_rgba() function on cairo SolidPatterns was
specified like this:
get_rgba = { ret = cairo.Status,
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' } },
The above commit fixed this (without saying so) and the code became:
get_rgba = { ret = cairo.Status,
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' },
{ ti.double, dir = 'out' } },
The prototype for the corresponding cairo function is:
cairo_public cairo_status_t
cairo_pattern_get_rgba (cairo_pattern_t *pattern,
double *red, double *green,
double *blue, double *alpha);
As you see, this functions gets four double* as arguments and it will save its
result via those pointers. Old versions of lgi call this function with too few
arguments and this will cause a segmentation fault when cairo dereferences an
invalid pointer.
Signed-off-by: Uli Schlachter <psychon@znc.in>
We now handle all "important" EWMH messages in lua and lua can decide to do
different things than the current obvious one.
Consistency!
Signed-off-by: Uli Schlachter <psychon@znc.in>
If a client gets moved to a screen without any selected tags, that client
disappears and it is non-trivial to get it back. Since this is unexpected and
annoying, make movetoscreen do nothing if the target screen has no tags
selected.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This allows to apply properties and callbacks to a client like
awful.rules.apply would do, without the matching part.
This is useful with the new startup notifications, and lets you apply
the same properties and callbacks from e.g. a manage signal handler.
If a drawable has an opaque background, we don't need pseudo transparency and
thus its content don't change when it is moved. However, when we need pseudo
transparency, then we have to redraw the drawable to apply the new background.
Previously we just always did the redraw. This commit adds a helper function
gears.color.create_opaque_pattern() that analyzes a cairo pattern for
transparency. We use this new function to only redraw-on-move when there is
actual pseudo transparency in effect. Otherwise, this redraw can be skipped.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This allow to spawn something, then apply some properties or rules when
the client show up ("manage").
This commit add:
* "startup_id" property for all clients object (immutable, can be nil)
* Second return value to awful.util.spawn() with the startup_id
* Update the documentation
Example:
local wait_for_it = {}
local pid,snid = awful.util.spawn("urxvtc")
wait_for_it[snid] = {ontop=true,sticky=false,
tag = awful.tag.gettags(mouse.screen)[1] }
client.connect_signal("manage", function (c, startup)
if c.startup_id and wait_for_it[c.startup_id] then
for k,v in pairs(wait_for_it[c.startup_id]) do
c[k] = v
end
if wait_for_it[c.startup_id].tag then
c:tags({wait_for_it[c.startup_id].tag})
end
end
end)
Signed-off-by: Uli Schlachter <psychon@znc.in>
This helps in cases where you have accidentally cloned an entry from
`layouts`.
Previously, no current index would be found and the function would
silently fail.
Signed-off-by: Daniel Hahler <git@thequod.de>
This allows for having clones of a table, where its entries are still
references to the original values.
This is useful for copying a "default props" table, where you want to
keep the reference to entries like `awful.layout.suit.tile`.
Signed-off-by: Daniel Hahler <git@thequod.de>
Instead, use stack_client_push and emit the `request::activate` signal
from awful.rules.apply, if the client gets focus.
Signed-off-by: Daniel Hahler <git@thequod.de>
Pressing CTRL+DELETE removes the visible history entry, if any, then moves to the next history entry (like pressing DOWN would do).
If the last history entry is removed the previous one is shown in the prompt (like pressing UP would do).
CTRL+DELETE works on history entries only: i.e. it has no effect on a command entered but not executed yet.
To implement above behaviour I added saving history table to file on Escape key press.
Signed-off-by: Massimiliano Brocchini <massimiliano.brocchini@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead of having the C code mess with which tags are selected, we now emit a
signal on the tag that says that something requested it to be selected. Lua can
then handle this by only switching tags on the correct monitor and by updating
the focus history correctly.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commits adds awesome.register_xproperty(). This allows lua code to register
arbitrary X11 properties with awesome which will then watch these properties.
Whenever such a property is changed on a client or drawin, we will emit the
xproperty::name signal.
This also adds window:get_xproperty(name) and window:set_xproperty(name, value)
which allows to mess with properties.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Ever since commit 6b2e4352b (from 2010!), awesome.spawn() doesn't have a screen
argument anymore and the extra argument from util.spawn was just ignored. Fix
the code and the luadoc for these functions.
Thanks to blueyed for noticing this.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This reverts commit 20afb26080.
The commit caused endless loops with tracebacks like this (shortened):
lib/awful/ewmh.lua.in:122: in function <lib/awful/ewmh.lua.in:117>
[C]: in function 'geometry'
lib/awful/ewmh.lua.in:122: in function <lib/awful/ewmh.lua.in:117>
[C]: in function 'geometry'
lib/awful/ewmh.lua.in:122: in function <lib/awful/ewmh.lua.in:117>
[C]: in function 'geometry'
When a client's geometry changes (and I consider the border width to be part of
the geometry here) and that client is one of fullscreen or
maximized_{horizontally,vertically}, make sure that the geometry as specified by
the state is still obeyed.
This also (accidentally) fixes things when a client gets moved to another
screen!
Signed-off-by: Uli Schlachter <psychon@znc.in>
Due to a copy&paste error, maximized_vertical and maximized_horizontal were
handled the same. Of course, vertical and horizontal aren't the same direction.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When we receive a _NET_ACTIVE_WINDOW request on the root window, we used to just
focus and raise the window. This didn't do much for clients which are on
non-selected tags.
Thus, this commit makes awesome emit request::activate on the client instead.
This is used in awful.ewmh to implement the old behavior again, but with
additionally marking the client as urgent if it isn't visible.
People who don't like this behavior can use client.disconnect_signal to disable
this behavior again. To make this really possible, awful.ewmh becomes a
"non-nil" module.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This makes the drawable paint the wallpaper in the background
(i.e. pseudo transparency) only if there is not a composite manager running,
as reported by the value of awesome.composite_manager_running.
In other words: drawables can now make use of true transparency.
Signed-off-by: Björn Åström <bjoast@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
The default value for the second argument to :find() is 1, so nothing is changed
here. The third arguments disables pattern matching and instead gets us literal
interpretation of strings. This means that pattern characters like e.g. [, ] and
. don't get interpreted.
Signed-off-by: Massimiliano Brocchini <massimiliano.brocchini@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
When an area is split in two, for example horizontally, one of the windows
should have height math.floor(previous height / 2) and the other
math.ceil(previous height / 2), to be certain that no gaps are left between the
windows.
For instance, if the first window has height h and the second window has height
math.floor(h / 2), the height of the third window should be math.ceil(h / 2)
instead of the same as for the second window.
So to compute the size of window n + 1 it’s necessary to remember the size of
window n - 1 as well as that of window n.
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This adds a :set_color() method so that the margin layout can color the margins,
drawing a bordered widget.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This gets rid of the unused first argument and adds a new second argument that
can influence individual items.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The documentation says that screen, the last argument to viewmore(), is an
optional argument. However, the implementation only treated it as an optional
argument in one place.
Fix this by always setting the screen variable itself to a screen.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Label of menu entries will be escaped automatically. Doing it manually
in menu:clients() will escape it it twice.
Patch removes the util.escape() call in menu:clients()
Signed-off-by: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
The activated property was added to tag objects between awesome 3.4 and 3.5.
This is used in the C code to keep tags alive even when nothing else refers to
it and includes a tag e.g. in some root window properties.
Thus, to get rid of a tag and to make the C code drop its reference to it, we
have to set activated to false in this function.
Signed-off-by: Uli Schlachter <psychon@znc.in>
In case loading the theme failed and we don't have fg_normal or bg_normal, add
default values for these properties. All the other colors are only used if they
are defined, but these two always need to be defined.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When awesome restarts because a new screen was added or removed, clients can end
up being on a different screen than before the restart. However, the tags will
be carried across the restart. This means that a client could end up being
tagged with a tag from another screen. This results in weird behavior of tag
switches and confuses users.
To work around this, remove the client from any tags that are on a different
screen during startup. If the client ends up without any tags, it will then be
tagged with the currently selected tags.
Signed-off-by: Uli Schlachter <psychon@znc.in>
I am looking forward to the bug reports requesting awful.client.floating.set(c,
true) to also automatically un-fullscreen the client...
Signed-off-by: Uli Schlachter <psychon@znc.in>
Setting mouse.screen moves the pointer to the top left corner of that screen.
However, the very next line would then move the pointer elsewhere again. Thus,
the first one wasn't needed at all.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The last widget always took up the remaining
space even though fill_space(false)
had been called on the layout.
This got broken in commit 9d333113dd.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit adds and uses wibox.layout.base.fit_widget(). This function is a
wrapper for widget:fit() that caches the result and thus speeds things up.
This is necessary because some layouts call :fit() from their :fit() and :draw()
functions. Nesting such layouts means that at the widget at the tail of the
stack gets its :fit() function called quite often. If this function is not
blazingly fast, this results in noticeable slowness.
Signed-off-by: Uli Schlachter <psychon@znc.in>