Commit Graph

1027 Commits

Author SHA1 Message Date
Uli Schlachter eff4474c6d Move size-hints handling to lua
The C core now completely ignores size hints and let's lua handle them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-11 17:21:00 +01:00
dodo 5d9fa5614e display ontop mode for clients in awful.widget.tasklist
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-08 19:40:42 +01:00
Uli Schlachter 07164aa995 awful.menu: Handle invalid images better
This fixes problem where e.g. loading an image fails and thus the displayed
layout gets messed up.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-04 22:07:36 +01:00
Uli Schlachter 01e6e2a07b imagebox: Refuse invalid images
This makes the imagebox widget refuse images which have a zero or negative width
or height. A zero size causes problems where a division by zero results in inf
which makes various stuff fail in weird ways later on.

Additionally, cairo's "error surfaces" have a negative size. Displaying those
would cause all sorts of weird problems, too, so we better reject those.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-04 22:03:42 +01:00
Uli Schlachter 00273528b0 awful.placement.no_overlap: Honor original position
awful.placement.no_overlap caused clients on an otherwise empty desktop to stich
to the top-left corner of the screen because it always preferred the top-left
corner of the available space.

This commit doesn't change the way in which the available area is computed, but
instead this now tries to keep the client at its original position if that is
available.

This fixes cases where calling awful.placement.no_overlap as a callback from an
awful.rule rule didn't work because the manage signal in the default config
later overrode that via calling awful.placement.no_overlap.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-01 17:52:00 +01:00
Andres Freund af6915fda2 Correct typo in awful.client.restore
This corrects a type in awful.client.restore which caused it not to restore any
client at all  if all clients are minimized.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-01 16:08:09 +01:00
dodo 9befc30a7b add pango alignment to wibox.widget.textbox
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-28 10:02:09 +01:00
Uli Schlachter 935e9a0e30 Add awful.client.restore()
This restores the first minimized client it finds on the selected tags.

Optionally, this function accepts a screen number as its first argument.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-19 22:23:35 +01:00
Uli Schlachter 9d0cf27593 tasklist: Update when a c.minimized changes
This fixes a bug where the tasklist would still show its old content after a
client was minimized/unminized because it didn't connect to the appropriate
signal.

This wasn't noticed before, because in most cases minimizing a client also
unfocuses this client which causes a tasklist update.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-19 21:42:39 +01:00
Uli Schlachter d8dc4bb2f5 awful.client.floating.toggle: Fix for dialogs
awful.client.floating.get() does some sensible defaults. E.g. dialogs are
floating by default. Since floating.toggle only checked the property, these
defaults made it break.

So floating.toggle() should use floating.get to decide if a given client is
floating. It should also use "false" instead of "nil" when the client is made
non-floating or else the default will apply again.

Thanks to vsp for making me figure this out. :)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-10 23:03:05 +01:00
André Aparício 3b0a20ca3b Fix default naughty preset for dbus notifications
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-03 18:08:04 +01:00
jpike 4972a280b0 Add naughty.config.notify_callback
This optional callback can be used for filtering and/or editing
notifications.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-28 21:05:09 +01:00
Uli Schlachter 88aff03005 Don't focus a different screen on unmanage (FS#850)
When some client on the left monitor was closed while client.focus is on the
right monitor (e.g. 'sleep 5 ; exit' in a terminal), awful.autofocus would shift
the input focus to whatever client happened to be next in the focus history on
the left monitor.

Fix this by only ever moving the input focus between screens when a tag is
selected, not when some client does its magic.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-27 18:10:39 +01:00
Anurag Priyam 514fd796f3 add usage example for awful.menu
Added a very simple example to show the usage, and applicability of
awful.menu by dynamically constructing a menu of clients that match a
particular rule.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-26 22:10:00 +01:00
Anurag Priyam 2a4503ef04 fix minor grammar, and typo in awful.menu.new's documentation
Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-26 22:10:00 +01:00
Anurag Priyam 63503ac107 add markup to awful.menu.new's documentation
Display the possible keys to the 'menu' params as a bullet list
(unreadable otherwise).

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-26 22:10:00 +01:00
Uli Schlachter 40958f9d21 Use ._NAME for identifying oocairo surfaces
image:type() was removed from oocairo, because the ._NAME property already
exists and there's no need for two functions doing the same job.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-21 19:54:27 +01:00
Uli Schlachter 78a1788c6f Fix a stupid typo, sorry
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-14 19:06:54 +01:00
Uli Schlachter ecb8376c44 naughty: Try ignoring all markup before giving up
naughty now tries to ignore all pango markup by using :set_text() instead of
:set_markup(). If this fails, too, we must have been fed invalid utf8 which we
cannot do anything about.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-14 16:16:04 +01:00
Uli Schlachter ec72ee1b43 Fix naughty
I removed textbox' check() function, but forgot to see if anything actually
calls it. Just removing the call fixes all problems here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-14 16:12:05 +01:00
Uli Schlachter d16ca829aa textbox: Verify a text when it is set
This makes the textbox pass the markup/text it is given to oopango immediately.
If it is invalid, a lua error will be thrown and the old text will still be
shown.

This fixes a bug where the whole wibox isn't redrawn when a textbox complains
about broken UTF8.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-08 13:55:36 +01:00
Uli Schlachter 75956804bd Make awful.client.idx public
The luadoc API documentation already contained this function and it seems to be
useful for user configs.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-03 14:18:11 +01:00
Uli Schlachter 3ec32306db (Try to) document the wibox constructor
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-14 21:07:04 +01:00
Uli Schlachter df116331a1 Improve wibox' API documentation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-12 21:45:54 +01:00
Uli Schlachter 07bbe14d02 Wibox: Set the drawin's background color if possible
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-12 21:18:32 +01:00
Uli Schlachter b833ae75eb awful.client.setwfact: Handle invisible clients (FS#693)
setwfact() calls idx() on the client that it works on. When idx() is called with
a client that isn't visible, it fails while trying to find outs the client's
index in the current layout.

  event_handle_mousegrabber:119: error running function:
    lib/awful/client.lua:688: attempt to compare nil with number

Fix this by ignoring all clients that aren't visible in setwfact().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-11 14:20:42 +01:00
Radu Andries 66aa5beaf7 Improve naughty's dbus interface
Evil spec from galago project.
image_data should be read too as in http://www.galago-project.org/specs/notification/0.9/x344.html

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-10 17:20:47 +01:00
Matthias e75186701e Fixed oocairo.image_surface_create_... typo
its oocairo.image_surface_create_from_data not oocairo.image.surface...

Signed-off-by: Matthias <ms@softimpulse.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-11-12 17:13:33 +01:00
Uli Schlachter 8882cf360a wibox: Fix mouse event handling
If you managed to press mouse button 4 exactly between two entries in the
taglist, the taglist would jump by two tags instead of just one. This is because
the mouse event was forwarded to both taglist items.

This happened because the calculation in wibox' find_widgets() was wrong. If you
have a widget at (1, 1) with a size of 1x1, then (1, 1) is the only point that
this widget covers. However, the math also included the pixels (2, 1), (1, 2)
and (2, 2) in the widget's extents. This is obviously wrong.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-30 19:56:07 +02:00
Uli Schlachter f1fd4a52a1 wibox.widget.base: Use assert() instead of error()
This means you now get a backtrace (traceback?) that helps identifying
the faulty code.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-22 14:50:45 +02:00
Uli Schlachter 1f95825a1e gears.debug: Import
So far this only contains an "assert()" function, but I guess this could be
enhance. For example, a function which pretty-prints a table's contents might be
useful to have.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-22 14:49:12 +02:00
Julien Danjou c98624077f awful.prompt: add ctrl-backspace
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-10-21 09:05:40 +02:00
Julien Danjou 016b76e7bb awful.tag: do not update history when identical tags
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-10-20 17:30:57 +02:00
Julien Danjou e2083050d4 awful.tag: remove useless line
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-10-20 17:00:14 +02:00
Danny Navarro a44439a6c0 Add awful.widget.tasklist.filter.minimizedcurrenttags
Added function to show only minimized clients in the taskbar for the
 current tag.

 Signed-off-by: Danny Navarro <j@dannynavarro.net>

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-17 15:45:56 +02:00
Uli Schlachter 107ba3fefc Systray: Configure background color via beautiful
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-17 09:24:59 +02:00
Uli Schlachter 1beb274944 Wibox: Use the "refresh" signal for redrawing
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>
2010-10-15 18:57:50 +02:00
Uli Schlachter 8712be7265 awful.widget.prompt: Fix error display
This has to use :set_text() now.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-14 21:17:02 +02:00
Stjujsckij Nickolaj 8bca1025ac Remove last known usage of deprecated in Lua 5.1 `arg`
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-12 18:38:04 +02:00
Uli Schlachter bb52505bb8 awful.util.join: Stop using arg
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>
2010-10-11 16:55:56 +02:00
koniu dc6a2c6b0d awful.completion: callback functions return table of matches
Signed-off-by: koniu <gkusnierz@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-11 15:22:44 +02:00
koniu 4429bea62f awful.prompt: add 'autoexec' argument
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>
2010-10-11 15:22:18 +02:00
Uli Schlachter 38d4602425 margin: Accept individual margins
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-08 17:22:00 +02:00
Uli Schlachter 2ca25128a5 Remove outdate require("awful.widget.layout")
The file isn't present any more and it's not needed anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 21:46:52 +02:00
Uli Schlachter e64d36b104 Awful.menu: Fix the text
Looks like someone wasn't using set_markup() where he was supposed to do so.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 14:24:16 +02:00
Uli Schlachter 688b4fb628 textbox: Prefix internal variables with "_"
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>
2010-10-07 14:22:44 +02:00
Uli Schlachter 650b3d6df5 Progressbar: Fix border
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 13:52:32 +02:00
Uli Schlachter 734973c60c Graph: Fix border and geometry
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 13:50:44 +02:00
Uli Schlachter 547f732b00 systray: Automatically fit into available space
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>
2010-10-07 11:54:45 +02:00
Uli Schlachter 7edabc39fd awful.tooltip: Fix for new widget layouts
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 11:11:48 +02:00
Uli Schlachter 9d4e5d31bf awful.widget.layout: Remove
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 11:07:25 +02:00
Uli Schlachter 5eed35b7e0 awful.menu: Make sure the arrow is always visible
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>
2010-10-07 10:15:29 +02:00
Uli Schlachter bb975a2464 awful.prompt: Fix for the new textbox
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 21:27:42 +02:00
Uli Schlachter 6b972ffde0 widgets: Add mouse::{enter,leave} signals
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 21:17:05 +02:00
Uli Schlachter 4af11b821c Whoops, fix wibox signals
emit_signal() already adds the object as the first argument, so we don't have to
add it ourselves.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 20:46:11 +02:00
Uli Schlachter 18799f32f8 Emit mouse::move signals when we get a motionnotify
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 20:44:22 +02:00
Uli Schlachter ebcda492a1 wibox.layout.fixed: Always draw "empty" widgets
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>
2010-10-06 19:47:34 +02:00
Uli Schlachter 1fab3aa745 wibox.layout.align: Bugfix
It didn't correctly attach to its second and third widget's widget::updated
signal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 19:46:47 +02:00
Uli Schlachter 27d448bc97 awful.widget.common: Add background to the icon
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>
2010-10-06 18:45:50 +02:00
Uli Schlachter 01aa7e66e6 wibox.widget.background: Use draw_widget()
Without draw_widget(), the input handling is broken.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 18:45:13 +02:00
Uli Schlachter 661a8a7b38 Some more minor fixes, make "strict" happy
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 16:27:38 +02:00
Uli Schlachter c271ed7b13 tasklist: Use a fixed layout
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>
2010-10-06 15:48:50 +02:00
Uli Schlachter 58bf0b0c64 wibox.layout.fixed: Fix typo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 15:48:50 +02:00
Uli Schlachter bddecffe97 Be compatible to oopango 1.0
Some idiot broke the API in oopango git. Work-around this by checking which
version of oopango we have.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 15:11:20 +02:00
Uli Schlachter b55dc20319 awful.widget.textclock: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:30:45 +02:00
Uli Schlachter 0cb3569e3e awful.widget.layoutbox: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:30:00 +02:00
Uli Schlachter 3b9150f05a awful.widget.button: Port to new widget layout
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:28:43 +02:00
Uli Schlachter 1b134b2361 lua.widget.prompt: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:27:16 +02:00
Uli Schlachter bf23ebdf46 graph,progressbar: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:25:59 +02:00
Uli Schlachter 97ed5e70b8 {task,tag}list: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:23:36 +02:00
Uli Schlachter 05c49a3a2b awful.menu: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:21:19 +02:00
Uli Schlachter 6a7fdc8fb0 awful.wibox: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:20:30 +02:00
Uli Schlachter 52e678a8c7 Naughty: Port to new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:19:20 +02:00
Uli Schlachter ad2bc9d183 beautiful: Track the font for oopango
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 14:18:11 +02:00
Uli Schlachter 2eae7e5cf4 Import lib/wibox/, a new widget system in lua
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 12:42:56 +02:00
Uli Schlachter ad3e965e16 Fix some broken luadoc
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 21:38:06 +02:00
Uli Schlachter c8b93cec76 progressbar: Remove gradients
gears.color can do the same in better and they are currently broken anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 19:26:23 +02:00
Uli Schlachter d8dce35269 progressbar: Port to oocairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 19:24:36 +02:00
Uli Schlachter 048064b8ef graph: Remove gradients
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>
2010-09-29 19:02:03 +02:00
Uli Schlachter 6375ce4175 graph: Port to oocairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 18:57:52 +02:00
Uli Schlachter d74198b7db gears.color: Add much more sophiscated stuff
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 18:54:20 +02:00
Uli Schlachter fce09d4d42 tasklist: Remove unused local variables
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:18:21 +02:00
Uli Schlachter 40aa974ac2 taglist: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:17:03 +02:00
Uli Schlachter f4d37f74d3 naughty: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:15:11 +02:00
Uli Schlachter 6f5862a2de beautiful: Remove unused local variables
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:11:53 +02:00
Uli Schlachter 523661760a Layoutbox: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:10:01 +02:00
Uli Schlachter 03fd3f3146 awful.wibox: Remove unused local variables
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:08:16 +02:00
Uli Schlachter e53054553d awful.menu: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:06:44 +02:00
Uli Schlachter 4279c879b3 awful.widget.button: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 15:57:10 +02:00
Uli Schlachter c3e0f72c56 gears.object: Import
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>
2010-09-28 16:23:00 +02:00
Uli Schlachter b75ada22d8 gears.sort: Import
The difference to table.sort() is that this is guranteed to be stable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 16:09:40 +02:00
Uli Schlachter 51068f5cdf naughty: Set the window type to "notification"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 13:14:27 +02:00
Uli Schlachter 5f90e92f09 awful.menu: Set the window type to "popup_menu"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 13:13:14 +02:00
Uli Schlachter 9a8177e457 awful.wibox: Set the window type to "dock".
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 13:09:19 +02:00
Uli Schlachter 825efd21b3 Naughty: Add a missing "local"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-18 16:34:31 +02:00
Uli Schlachter 49b4573bc8 awful.widget: Stop using named colors
Those were removed a while ago already.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-18 12:27:09 +02:00
Uli Schlachter 71b15d292c Fix a "table expected instead of nil" error
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>
2010-09-16 19:02:15 +02:00
Uli Schlachter 89f05c90ca {tag,task}list: Use a weak-valued table
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>
2010-09-16 17:28:50 +02:00
Ignas Anikevicius (gns_ank) 2c1d09ebc2 Add match_any function and rule_any definition for different client matching.
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-14 16:51:40 +02:00
Uli Schlachter 9a24779425 Implement color parsing
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>
2010-09-09 16:54:57 +02:00
Julien Danjou c38e326242 Revert "tag.lua: check name argument to add() is valid"
This reverts commit 6cb61939c4.
2010-09-08 10:18:21 +02:00
Uli Schlachter e77b979092 awful.placement.no_overlap: Ignore desktop clients
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>
2010-09-03 17:43:36 +02:00
immerrr a3f911cf95 awful.prompt: insert selection at cursor position
Signed-off-by: immerrr <immerrr@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-31 13:48:59 +02:00
Uli Schlachter 03e0ee53d2 Wibox: Remove shape support
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-30 10:22:50 +02:00
Uli Schlachter 932e0bfcd0 Add two more missing signals
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-27 21:42:14 +02:00
Uli Schlachter d5209cca1f awful.placement: Fix a mis-calculation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 21:29:34 +02:00
Uli Schlachter 1cab627d5d awful.prompt: "Fix" for multi-byte characters
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>
2010-08-26 20:42:22 +02:00
Uli Schlachter b6c8b95e34 Convert some more code to "class signals"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 18:42:38 +02:00
Uli Schlachter 1ce0b7915b Use signal emitions on classes
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>
2010-08-26 18:31:06 +02:00
Uli Schlachter 3bdd4793d7 awful.tag: Add property::icon
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 18:11:13 +02:00
Uli Schlachter f89252962e Fix an invalid index in awful.rules
A rule like { focus = true } would cause debug::index::miss and
debug::newindex::miss to be emitted.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 17:48:00 +02:00
Uli Schlachter ab4c151ed8 Add signals before using them
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>
2010-08-25 23:00:36 +02:00
Julien Danjou 6d332f07a0 lua{class,object}: rename signals functions
I knew this was wrong at the beginning, f*ck.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-25 20:28:20 +02:00
Uli Schlachter 71ba321032 Check "focusable" in awful.client.focus.filter(c)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-12 13:18:40 +02:00
Uli Schlachter ac2ff7f7a7 prompt: Only show error messages
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>
2010-08-09 14:24:58 +02:00
Uli Schlachter fae5dfcd08 Naughty: Handle invalid UTF-8 more sanely
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>
2010-08-06 19:53:34 +02:00
Konstantin Stepanov 842dfc3064 stack graph mode works with max_value
Signed-off-by: Konstantin Stepanov <kstep@p-nut.info>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-05 14:28:14 +02:00
Ignas Anikevicius (gns_ank) e6a2bf7220 Functionality for deleting a tag using awful.tag.
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>
2010-08-02 22:05:58 +02:00
Uli Schlachter edbc3fa652 awful.placement: Honor border width
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>
2010-07-24 15:29:55 +02:00
Uli Schlachter 6fa27c7b48 Naughty: Catch invalid markup in notifications
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>
2010-07-16 19:35:51 +02:00
Uli Schlachter 2e0ea80cb3 Tasklist: Listen to the correct signals
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>
2010-06-22 16:45:06 +02:00
Uli Schlachter 470c2e20d0 Update the tasklist when a client's icon changes
Thanks to a pidgin-using friend for reporting this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-14 20:06:02 +02:00
Uli Schlachter 0e869b7b15 Remove invalid variable usage
There is no variable called "startup" in awful.rules.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-14 20:04:38 +02:00
Julien Danjou e0c259406e naughty: return nothing, not nil
This is not a valid return value for a D-Bus method.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-06 10:39:16 +02:00
Julien Danjou e4c8c11564 Fix missing tostring
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-01 11:43:45 +02:00
Perry Hargrave 6cb61939c4 tag.lua: check name argument to add() is valid
Signed-off-by: Perry Hargrave <perry.hargrave@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-01 10:31:24 +02:00
Uli Schlachter 1615cff82a Tasklist: Add some missing parentheses
"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>
2010-05-30 18:53:04 +02:00
Perry Hargrave 2f3f84c994 tag.lua: add() create tags with full table of properties
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>
2010-05-29 11:22:27 +02:00
Perry Hargrave 77e39a5f07 tag.lua: getidx() returns index of tag
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>
2010-05-29 11:07:25 +02:00
Perry Hargrave 7b60f84fd0 tag.lua: move() re-index tags
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>
2010-05-29 11:05:36 +02:00
Gregor Best f890aa392c layouts/tile: completely fix client borders
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-29 10:53:47 +02:00
Gregor Best 752f0225d2 layouts: let client sizing honor the border width
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 20:39:56 +02:00
Julien Danjou 38edc58097 client: implements maximized and fullscreen requests with Lua
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:29:29 +02:00
Julien Danjou 9ce234a533 awful.widget.tasklist: use symbols chars rather than images
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:43 +02:00
Uli Schlachter 2b98f82588 awful.menu.clients: Raise the newly focused client
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>
2010-05-03 11:03:54 +02:00
Andrei 'Garoth' Thorp b43da6611d docs: progressbar.lua.in missing a dash to prevent luadoc generation
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-03 11:02:20 +02:00
Sergey Mironov 15aed64fd8 awful.menu: Add menu position argument
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>
2010-04-14 09:38:17 +02:00
Yves Frederix 0710031f1e awful.menu: add item_enter in access key handling
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-04-12 10:06:02 +02:00
Sergey Mironov 499da45edb awful.menu: Fix menu hide/show overloading
Fixes bug that prevents calling user-defined menu methods

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-04-12 10:04:50 +02:00
Adrian C. (anrxc) 4f4259c702 awful.widget: add graph stack property
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>
2010-03-29 17:39:22 +02:00
Adrian C. (anrxc) 4119e92d82 awful.wibox: update struts on align()
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>
2010-03-23 11:06:32 +01:00
Adrian C. (anrxc) 7ea4478b38 awful.widget: add progressbar ticks property
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>
2010-03-23 10:57:37 +01:00
Pierre Mazière a89c94e9d7 Avoid wibox borders to be recovered by clients
Signed-off-by: Pierre Mazière <pierre.maziere@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-03-19 10:02:32 +01:00
Pierre Mazière 62ac15d9d8 fix wibox origin when stretched
Signed-off-by: Pierre Mazière <pierre.maziere@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-03-19 10:02:30 +01:00
Pierre Mazière 67fc0b1810 Add the possibity for dynamic menu
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>
2010-03-17 16:00:18 +01:00
Adrian C. (anrxc) bafe41e174 awful.wibox: update position on height/width property change
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>
2010-03-04 09:31:37 +01:00
Adrian C. (anrxc) 54233fa383 awful.widget: add progressbar set_max_value property
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>
2010-03-02 11:59:58 +01:00
Adrian C. (anrxc) d07f3533c6 awful.menu: sanitize support for access keys
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>
2010-03-01 15:56:39 +01:00
Gregor Best b04a75c697 naughty: add suspend() and resume()
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>
2010-02-17 16:23:47 +01:00
Andrei 'Garoth' Thorp 11963175bc Fix naughty.destroy parameter documentation
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-02-17 16:23:47 +01:00