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>
Patch allows user to define menu position in pixels when
showing menu in keyboard-driven mode.
Note: Patch changes signature of show() and toggle() functions.
Signed-off-by: Julien Danjou <julien@danjou.info>
Initial implementation of stacked graphs. Adds two new methods,
set_stack (false by default) and set_stack_colors (i.e. {"red",
"white", "blue"}). The order of the colors matters, because the
add_value method now accepts an (optional) last argument, an index of
a color from your stack color group.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Setting width or height (horizontal or vertical) to an arbitrary value
causes the wibox not to be stretched. Instead the align() function is
called, which might not modify any wibox property in many situations,
or none when align parameter was not provided by the user. The major
side effect is that wibox struts were never updated and clients
covered the wibox (until a first signal handler caused struts to be
updated).
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Second implementation of the progressbar ticks. Adds set_ticks,
set_ticks_gap and set_ticks_size methods. Default gap is 1, size 4 in
respect to the default progressbar width of 100px.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Return the label of the selected menu item as an argument for the
callback function
Signed-off-by: Pierre Mazière <pierre.maziere@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Changing the width or height of a (right or bottom positioned)wibox,
after it was initialized, to a value different than used when it was
created would leave the wibox in a wrong position. Position was off by
as many pixels as the difference between the old and the new
value. Now every wibox is repositioned to reflect this new setup.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
The awful.widget.graph allows to change the maximum value a graph can
handle, thus allows users to use widgets and scripts that don't scale
the values down to 0 - 1 range. The progressbars did not allow this
and worked with a hard-coded value of 1.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Commit 87070ca introduced support for access keys in menus. Chosen
character was "&", an XML entity that has potential to cause problems;
if a user tries to add multiple access keys or just put an ampersand
in the name of the item the menu will break. Breaking happened because
ampersands were not escaped - first one was substituted and the rest
were ignored, but not escaped which triggered a pango markup error.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit adds naughty.suspend() and naughy.resume() which allow
suspension of notifications, which is useful e.g. when watching a movie,
where notifications popping up all the time would be disturbing.
While suspended, notifications are collected and displayed after
naughty.resume() is called.
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Julien Danjou <julien@danjou.info>
Commit a757dda replaced the awful.client.movetotag call with c:tags()
in the tag property handler. Which introduced a regression when more
than one screen is used. The awful.tag.withcurrent function was being
called even when there was a valid tag property. Now the clients
screen is set to the tag screen to ensure the client is moved to the
correct tag and screen.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Changing screen focus to an empty tag leaves focus on a client on the
previous screen, if a tag with clients is focused next the focus
remains on the previous screen. Now awful.autofocus compares the tag
screen and clients screen to learn if the focus should be given to a
client on the focused screen. Client that gets the focus is selected
from history, as usual.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
We unregister the default awful.tag.withcurrent 'manage' signal handler
and have awful.rules.apply handle initial client tagging.
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This explicitly registers withcurrent(c) as a manage signal handler so
that it can be removed if necessary.
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
When both height and width arguments are provided to the function
new() there is a check to see if one of them was a screen percentage,
and is expected to be a string. If the user provided absolute pixels,
and argument is of type number awesome will crash. Now tostring is
used to sanitize the arguments during this check.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
awful.wibox.align() in 3.4.x gets the available screen area from
capi.screen[screen].geometry.
this can easily result in overlapping wiboxes since the work area
provided does not account for existing wiboxes.
In my configuration I use a vertical wibox positioned at the
right and it half-overlaps my top wibox because it is streched and
hard-coded to align at the middle.
Signed-off-by: Julien Danjou <julien@danjou.info>
Function wibox_update_strut would not take the border width into
account when calculating struts. When a wibox border was in use
clients would overlap the wibox. With a border of 1px we loose 1px of
the wibox, but as the wibox border increases it is "pushed" by the
border nearest the screen edge and clients steal more and more space.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
This call is required by the freedesktop specification.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
Commit 6c5d0ca9 introduced a side effect. If tooltip text isn't changed
place() function is not called. To prevent multiple place() set_geometry
calls that function when tooltip is not visible (before it appears to the
user).
Signed-off-by: Sébastien Gross <seb•ɱɩɲʋʃ•awesome•ɑƬ•chezwam•ɖɵʈ•org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Functions show() and toggle() accept a boolean parameter controlling
keyboard navigation. In case of the clients menu neither is called
directly, instead the clients menu is always re-created in case any
new clients appeard since the last invocation. This patch adds a
keygrabber parameter to the clients() function as well.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
You can define a menuitem like before:
awful.menu({ items = { { "&awesome", myawesomemenu,
beautiful.awesome_icon },
{ "open &terminal", terminal },
})
and the letters following the ampersand in itemname can be used as
access key. (at least former fvwm users might find this familiar)
When there are submenus open awesome ascends during the search from the
current menu to the top level menu.
The access key is shown underlined.
There is no warning for multiple used keys, only the first one found
gets the price.
Signed-off-by: Julien Danjou <julien@danjou.info>
This reverts commit 7575f64993.
As seen on ML:
Switching tags with multiple heads causes focus to change
screens with this commit
Signed-off-by: perry <perry.hargrave@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
We check the wibox border width for inappropiate values now, if we set
border_width to a negative value (invalid) in our theme and draw it, the
actual border_width will be 0 so the menu will be drawn incorrectly.
This fixed this.
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
There might be multiple screens with visible windows. When closing the
last window of the current screen, try to focus them as well.
If no window has focus and yet some windows are visible (e.g. on another
screen), awesome misbehaves: it uses sloppy keyboard focus (as is the X11
default), but doesn't refresh their border colors or tasklists etc.
Signed-off-by: Tomi Belan <tomi.belan@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Function set_geometry was never called if the timer_function argument
was omitted. show function only called place() which would not display
a tooltip since it didn't have proper geometry.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
change example since the example with a centered client doesnt work
on the default config (due to no_overlap).
Signed-off-by: Julien Danjou <julien@danjou.info>
Prevent from blinking the first screen in multiheads by using
the mouse-focused screen tag list for a new client instead of
screen 1.
Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Also changes prompt_text_with_cursor() to take a table instead of
list of arguments allowing to incorporate font setting and
'prettyprompt' settings into the function.
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Helper function to toggle tag selection whilst updating history.
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This fixes a long standing tag history breakage. To store history
of tag switching we rely on a special signal "tag::history::update"
which needs to be emitted by any function which deals with tag
selection.
History is multi-level with a configurable limit:
awful.tag.history.limit = 20 (by default).
awful.tag.history.restore function gets a new argument 'idx' which can
be either 'previous' (default) which will revert to the previously
selected set of tags, or a numerical index in the tag history table.
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>