Previously, we used a timer with a timeout of 0 for redrawing the wibox. I had
the visual impression that the wibox was black for a moment. With strace I was
able to measure a latency of 10ms until the wibox was finally redrawn.
This now uses the "refresh" signal. With this, we get our latency down to
something like 0.15ms which sounds a lot better. :)
Signed-off-by: Uli Schlachter <psychon@znc.in>
Implementing vararg functions via arg is deprecated in lua. This kind of thing
should instead be done via "...".
Signed-off-by: Uli Schlachter <psychon@znc.in>
If set the prompt will execute the command upon completion which returns
only one match.
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This makes sure that textbox.text = "foo" doesn't work at all. It was never
supposed to work anyway. Sorry that I break stuff again.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Instead of having to set the systray's base size by hand, it now automatically
uses min(avail_width, avail_height) as its base size. That's way less surprising
for people.
Signed-off-by: Uli Schlachter <psychon@znc.in>
By setting the textbox in an align layout's middle, the submenu icon will always
get the space it needs and the textbox will get the rest. Previously, the
textbox took as much as it wanted and the image got the rest. This looked ugly.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If a widget has a width/height of 0, we can safely draw it without running out
of the available space. This code checks if we got enough space after we now how
much space the next widget wants.
This fixes the systray. It has to be drawn at least once so that the C core can
set up stuff correctly. However, thanks to the systray having a width of 0, it
wasn't drawn by the layout.
Signed-off-by: Uli Schlachter <psychon@znc.in>
The icon should get the same background everything else gets. Fix this by making
the background the outer-most widget in each item.
Signed-off-by: Uli Schlachter <psychon@znc.in>
We need a fixed layout here to make tag names like "media" work. Without this,
every take would get the same space, no matter how long its name is.
Signed-off-by: Uli Schlachter <psychon@znc.in>
They can and should now be done via gears.color instead. It was porting ever
since this was ported to oocairo anyway...
Signed-off-by: Uli Schlachter <psychon@znc.in>
This implements objects in lua. Objects provide the signal functions that are
known from the C API ({dis,}connect_signal(), emit_signal(), add_signal()).
Signed-off-by: Uli Schlachter <psychon@znc.in>
It seems like with lots of bad luck, the garbage collector manages to "steal"
the table with the buttons right after we decided to use it. Evil collector!
Signed-off-by: Uli Schlachter <psychon@znc.in>
The data table is used to map objects (clients/tags) to the buttons associated
with them. This is done so that we don't have to re-create the button objects
each time this lists are updated.
The problem was that this weak-keyed table was never cleared, because the value
had a strong reference to the key (via the button's signal):
btn:connect_signal("press", function () b:emit_signal("press", o) end)
"o" is the key in the table and btn is reachable from the value. This prevented
the garbage collection of the key. Using a weak-keyed and weak-valued table
fixes this.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This adds a lua module for parsing colors. Named colors like "black" aren't
supported, but #rrggbb and #rrggbbaa colors do work.
Signed-off-by: Uli Schlachter <psychon@znc.in>
EWMH describes desktop windows like this:
"_NET_WM_WINDOW_TYPE_DESKTOP indicates a desktop feature. This can include a
single window containing desktop icons with the same dimensions as the screen,
allowing the desktop environment to have full control of the desktop, without
the need for proxying root window clicks."
An example for such a window is nautilus' virtual root window. Naturally, such a
window would always overlap with any given client, so awful.placement.no_overlap
just didn't do anything at all. The fix is to ignore such clients for placement
calculations.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If you entered a multi-byte character into a prompt and then changed your mind
and used backspace to fix the character, only the last byte of the character was
removed. Because pango is intelligent, it noticed the broken utf8 and
complained.
So far nothing new. But since 711d78b50c the textbox will throw a lua error
when it gets an invalid text (= pango complains). Throwing an unprotected lua
error in this context causes the keygrabber to be killed which stops the prompt.
Fix this by removing bytes as long as there are bytes left that can be removed.
This is FS#801.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Since 3fbb5f1535 "luaobject: emit signals on class too" when a signal
is emitted on some object, it will also be emitted on the class. This means that
we don't have to connect our signals via the "new" signal anymore, but can
instead connect to the signal on the class.
(Of course, the signal on the class gets as first argument the object on which
the signal was emitted)
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit makes it an error if an unknown signal is connected, disconnected or
emitted. All signals have to be added before they can be used.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Ever since awesome.spawn() also returns the pid of the started process, the
prompt accidentally displayed the pid of processes that it started.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, if setting the textbox's text failed this caused more problems later
on. This commit makes sure that an invalid text never breaks pango.
Signed-off-by: Uli Schlachter <psychon@znc.in>
tag.delete(t, fb):
Delete tags if certain criteria are met:
- There are no clients assigned exclusively to this tag.
- Stickied clients have somewhere to go, 'fb' the fallback tag
If after deleting there is no tag selected then try and
history.restore() or select the first tag on the screen.
Return true if successful and nil otherwise.
Signed-off-by: Perry Hargrave <perry.hargrave@gmail.com>
Signed-off-by: Ignas Anikevicius <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
While calculating if part of the window is outside the visible region, this code
should also add the border width. (FS#684)
Signed-off-by: Uli Schlachter <psychon@znc.in>
Previously, an invalid markup caused an empty popup. Since the C core now throws
a lua error on invalid markup, we have a way to notice that something is wrong.
This patch first tries to set the notification's text the same way we did
previously. If that fails, everything is escaped and the result is used as the
text for the notification.
Thanks to farhaven/Gregor Best for the initial version of this and for the
string.gsub() call I stole from him. :)
Signed-off-by: Uli Schlachter <psychon@znc.in>
The tasklist shouldn't care about the tag history or new tags showing up and it
also shouldn't care about tags disappearing on other screens (on the current
screen the tasklist needs to update because the tag might have been selected).
On the other hand, the tasklist really should care about tags being selected and
unselected. This worked before because this causes changes to the focus history.
Signed-off-by: Uli Schlachter <psychon@znc.in>
"a .. b or c" is equivalent to "(a .. b) or c", but we want "a .. (b or c)".
This bug caused an "attempted to concatenate a nil value" error message.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
tag.add(name, props):
make tags and pass a table of properties to apply to it
tag.new:
modified to use add() instead of calling capi.tag
Signed-off-by: Perry Hargrave <perry.hargrave@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
tag.getidx(t):
Return the index of 't' in the screen[]:tags() table. Return 'nil'
if 't' is not found.
Signed-off-by: Perry Hargrave <perry.hargrave@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
tag.move(i, t):
move tag 't', or tag.selected(), to index 'i' in the current
screen's tags table.
Signed-off-by: Perry Hargrave <perry.hargrave@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Raising it makes it more obvious that the focus was really changed and makes
working with the client easier since it's, well, raised.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>