Commit Graph

1684 Commits

Author SHA1 Message Date
Daniel Hahler 4d5a3eb3ba Fix awful.util.spawn*/.pread deprecation wrappers
- Fix `util.spawn_with_shell`.
 - Provide deprecation wrapper for awful.util.pread.
 - Return in deprecation wrapper for awful.util.spawn*.

Closes https://github.com/awesomeWM/awesome/pull/506.
Closes https://github.com/awesomeWM/awesome/pull/511.
2015-10-10 22:19:45 +02:00
Uli Schlachter b1493c8f76 Merge branch 'enhance_menubar_icon_path_lookup' of https://github.com/nuko8/awesome 2015-10-10 19:54:23 +02:00
Uli Schlachter e3199edca1 Merge branch 'snid_callback' of https://github.com/Elv13/awesome-1 2015-10-10 19:52:41 +02:00
Uli Schlachter b89918d0f1 Merge branch 'remember-mouse-pos-per-screen' of https://github.com/Bew78LesellB/awesome 2015-10-10 19:51:00 +02:00
Uli Schlachter e15df8cba9 Merge branch 'client-movetoscreen-raise-true' of https://github.com/blueyed/awesome 2015-10-10 19:50:18 +02:00
lesell_b 4003331b41 fix missing scope on the mouse position table 2015-10-09 21:27:17 +02:00
Uli Schlachter 67faf52bab Properly update multiple taglists
My recent refactoring accidentally made the taglist only connect to the signal
for the first screen on which a taglist is created. This commit fixes the code
so that it connects for all screens.

Fixes https://github.com/awesomeWM/awesome/issues/500

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-09 20:59:18 +02:00
Daniel Hahler dcdd60382f Raise client in awful.client.movetoscreen
The intention of [#98] / fbc72624 was to actually raise the client,
but that was never the case apparently, and got totally lost in
[#441] / 57755b3.

[#98]: https://github.com/awesomeWM/awesome/pull/98
[#441]: https://github.com/awesomeWM/awesome/pull/441
2015-10-08 13:59:57 +02:00
lesell_b f2b6aa105c Update saved mouse position on screen focus change
Signed-off-by: lesell_b <lesell_b@epitech.eu>
2015-10-08 04:40:59 +02:00
lesell_b 23b2fae6a9 Remember mouse position per screen
The mouse position is saved and restored when focusing another screen

If the target screen has no saved mouse position, the relative position
of the current screen is used

Signed-off-by: lesell_b <lesell_b@epitech.eu>
2015-10-08 03:52:03 +02:00
actionless 0e3009936c feat(lib: awful: key): save current hotkeys 2015-09-30 13:17:12 +02:00
Emmanuel Lepage Vallee 4095eb91a8 Move util.spawn to a new module, add ability to spawn with properties
* This commit add a new module to avoid a (4 level) loop dependency
* It is now possible to call awful.spawn() with a table of properties
* awful.rules is used to execute the rules.

* Everything is public to allow alternative workflow modules such as
    Tyrannical to use their own callback implementation.
2015-09-29 18:05:56 -04:00
Uli Schlachter a3e690d191 imagebox: Redraw in :set_image()
If someone modifies a cairo surface and then sets the resulting object as the
image of an imagebox, the imagebox needs to redraw. Thus, since surfaces are
modifiable, we cannot assume that nothing changed when the same image is set
multiple times on an imagebox.

However, the dimensions of a surface cannot be changed and thus this does not
need to emit widget::layout_changed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-29 00:28:26 +02:00
Uli Schlachter a71d12f07b awful.client.cycle: Fix API docs
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-29 00:28:26 +02:00
Uli Schlachter 3e9fdea650 test-leaks: Fix with Lua 5.1
I have no idea why this needs collectgarbage() to be called twice.

On the other hand, I can explain the change in tooltip.lua. Lua 5.2 introduced
"ephermeron tables". This means that in the following sitation, lua 5.2 can
collect the entry from the table, while 5.1 keeps the entry alive, because the
table has a strong reference to the value and that in turn has a strong
reference to the key:

  t = setmetatable({}, { __mode = "k"})
  do
    local k = {}
    t[k] = function() print(k) end
  end
  collectgarbage("collect")
  print(next(t, nil))

To handle this incompatibility, this commit just removes the whole indirection
through the module-level variable "data".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 16:04:20 +02:00
Uli Schlachter bd47edb4ef leak test: Make the layoutbox test pass
This commit does two things: It gets rid of the reference to the layoutbox that
the default config created and it changes the widget dependency cache to not
keep widgets alive unnecessarily.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:42:39 +02:00
Uli Schlachter abc5a552a4 Make tasklist garbage-collectable
Again, instead of directly connecting to various signals for updating a
tasklist, this commit changes the code so that there is just a single, global
connections and based on this a weak table with all tasklist instances is used
do the updates.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:20:24 +02:00
Uli Schlachter 40db0b7337 Make taglists garbage-collectable
Similar to what the previous commit does for layoutboxes, this changes the code
for the taglist so that there is only a single, global connection to the various
signals and these update all taglists via weak tables.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 14:03:59 +02:00
Uli Schlachter 6f2e7bba25 Make layoutbox kind-of garbage-collectable
Instead of connecting to the needed tag-update-signal again for every layoutbox,
this now just creates a single connection and updates all layoutboxes from here.
A new weak table is used to find the layoutboxes from these callbacks.
Additionally, layoutboxes are now per-screen unique. So even if you try to
create three layoutboxes for screen 1, the code will now always return the same
instance.

This kind-of fixes the leak test for layoutboxes. The problem is that the
default config also creates a layoutbox and adds it to a wibox. Since this is
now the same layoutbox, the test still fails. Just removing the layoutbox-part
from the default config makes this problem go away.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 13:19:12 +02:00
Uli Schlachter e9377c4808 Make textclock garbage-collectable
This fixes the textclock-specific part of the test that the previous commit
added.

To fix this, gears.timer.weak_start_new() is used. This function creates a timer
that is automatically stopped when its callback function is garbage collected.
The callback function is saved as a member of the texbox widget that is the
"widget behind the textclock". Thus, the timer can only be stopped after the
widget is garbage-collected, but the timer does not keep the widget alive.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-27 12:44:10 +02:00
Kazunobu Kuriyama 9ae945c931 Enhance menubar icon path lookup
The way of icon path lookup for `menubar` is enhanced so that it is
based on a theme-oriented way as described in the specification:

  Icon Theme Specification, Ver. 0.12
  http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

To accomplish this:

 * Add the two new files `icon_theme.lua` and `index_theme.lua`.

   The former implements an icon lookup algorithm suggested in the URL
   above.  The latter implements a helper object to parse the cache file
   `index.theme` of which data is used by the former.

 * Modify `menu_gen.lua` to use the new algorithm.

   - The implementation of `lookup_category_icons` is changed
     accordingly.
   - The values of the field `all_categories.icon_name` are changed file
     names to icon names, i.e., file extensions which are used to
     indicate image file formats are removed.

 * Add the new file `icon_theme_spec.lua` for a unit test for checking
   if `icon_theme.lua` together with `index_theme.lua` works as
   expected.
2015-09-26 11:45:38 +09:00
Daniel Hahler bf630de74e Merge pull request #438 from blueyed/ewmh-activate-raise-always
ewmh.activate: raise a client always
2015-09-25 10:16:03 +02:00
Daniel Hahler bd39a70b62 Merge pull request #474 from blueyed/ewmh-activate-only-focus-visible
ewmh.activate: only focus visible clients
2015-09-25 10:15:25 +02:00
Daniel Hahler 116c90c8d8 minor: taglist.taglist_label: join if / remove indent 2015-09-25 01:29:00 +02:00
Daniel Hahler f4d6011f23 awful.widget.taglist: handle/display urgent property always
For non-selected tags, display the urgent bg/fg always.
Previously, this was skipped in case the tag had the focused client,
which is possible since a while.

Ref: https://github.com/awesomeWM/awesome/issues/455#issuecomment-143072993
2015-09-25 01:07:51 +02:00
Daniel Hahler b824d00284 ewmh.activate: only focus visible clients
Since focus can be moved to non-visible clients nowadays, this needs to be
checked in the `request::activate` handler.

Fixes https://github.com/awesomeWM/awesome/issues/455.
2015-09-25 00:18:33 +02:00
Daniel Hahler 81e59cdfc8 ewmh.activate: raise a client always
When a client is not visible, this would adjust its stacking order
still.

This also addresses https://github.com/awesomeWM/awesome/issues/472,
because it raises unminimized clients after they got focused.
2015-09-24 23:38:14 +02:00
Daniel Hahler 4e22cf02e6 Merge pull request #384 from blueyed/more-robust-errors
More robust errors: make sure errors are strings

Closes https://github.com/awesomeWM/awesome/pull/384.
2015-09-23 20:59:35 +02:00
Uli Schlachter dfcbf20d81 Add and use wibox.hierarchy:update()
This function updates a hierarchy if the layout of some widgets changed. It does
nothing on the parts that did not change. This should be more efficient than
recomputing the whole hierarchy whenever something changes.

Once again, this has some positive results on the "benchmark test":

Before:
        create wibox: 0.083016   sec/iter ( 13 iters, 1.161 sec for benchmark)
    update textclock: 0.00391091 sec/iter (271 iters, 3.219 sec for benchmark)
  relayout textclock: 0.00273234 sec/iter (397 iters, 1.087 sec for benchmark)
    redraw textclock: 0.0010191  sec/iter (989 iters, 1.745 sec for benchmark)

After:
        create wibox: 0.083146   sec/iter ( 13 iters, 1.163 sec for benchmark)
    update textclock: 0.00170519 sec/iter (647 iters, 2.201 sec for benchmark)
  relayout textclock: 0.000581637 sec/iter (1880 iters, 1.094 sec for benchmark)
    redraw textclock: 0.0010167  sec/iter (997 iters, 1.773 sec for benchmark)

So again no difference for creating wiboxes (100.16% compared to before). This
time we also have no real difference for creating wiboxes (99.76%). Update (44%)
and relayout (21%) are improved a lot.

Closes https://github.com/awesomeWM/awesome/pull/463.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-23 20:57:41 +02:00
Daniel Hahler f7f8420d24 naughty.notify: improve doc for args.run
Closes https://github.com/awesomeWM/awesome/pull/469.
2015-09-23 20:56:17 +02:00
Daniel Hahler 7cbf3e8bee Fix tooltip.set_geometry: provide textbox context
Closes https://github.com/awesomeWM/awesome/pull/467.
2015-09-23 10:35:13 +02:00
actionless f2e554de91 fix(lib: naughty: core): make it work with textbox per-screen dpi
Closes https://github.com/awesomeWM/awesome/pull/464.
2015-09-22 08:56:25 +02:00
Daniel Hahler 28ffdb050e Merge pull request #454 from psychon/remove_gears.debug.assert
Remove gears.debug.assert

Closes https://github.com/awesomeWM/awesome/pull/454.

Conflicts:
	lib/gears/matrix.lua
2015-09-21 21:16:36 +02:00
Uli Schlachter 8d6030819b textbox: Honor per-screen DPI
This makes the textbox' :draw() and :fit() callbacks use the DPI that is
specified in the given drawing context. With this, the textbox now scales
correctly if different screens have different DPI values.

Idea originally from Daniel.

Closes https://github.com/awesomeWM/awesome/pull/457.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-21 21:13:21 +02:00
Daniel Hahler b0d7e6bb6c Merge pull request #458 from psychon/explicit_widget_deps
Explicitly track dependencies between widgets

Closes https://github.com/awesomeWM/awesome/pull/458.
2015-09-21 21:12:39 +02:00
Daniel Hahler 21dbe262fb Merge pull request #462 from psychon/gears.matrix2
Implement full matrix operations in gears.matrix

Closes https://github.com/awesomeWM/awesome/pull/462.
2015-09-21 21:12:10 +02:00
Uli Schlachter b134318f19 Use gears.matrix instead of cairo.Matrix everywhere
This has some positive results on the "benchmark test". Each single number is
the best one out of three runs.

Before:
        create wibox: 0.0826502  sec/iter ( 13 iters, 1.157 sec for benchmark)
    update textclock: 0.0186952  sec/iter ( 57 iters, 2.473 sec for benchmark)
  relayout textclock: 0.0158112  sec/iter ( 64 iters, 1.028 sec for benchmark)
    redraw textclock: 0.0015197  sec/iter (662 iters, 1.861 sec for benchmark)

After:
        create wibox: 0.0825672  sec/iter ( 13 iters, 1.154 sec for benchmark)
    update textclock: 0.00378412 sec/iter (277 iters, 4.216 sec for benchmark)
  relayout textclock: 0.00259056 sec/iter (420 iters, 1.09 sec for benchmark)
    redraw textclock: 0.00105128 sec/iter (958 iters, 1.79 sec for benchmark)

We see no significant change in the creation of wiboxes (99.9% compared to
before). Update (20% of the previous run time), relayout (16%) and redraw (69%)
are all sped up by this change.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-19 13:38:05 +02:00
Uli Schlachter 34927b187d gears.matrix: Implement matrices in Lua
Instead of going through LGI to call cairo, this now implements the various
matrix operations directly in Lua. The plan is to avoid the overhead that we hit
due to LGI.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-19 13:32:12 +02:00
Alastair Robertson b7669161a0 Add optional limit for nmaster/ncol based on number of tiled windows
Closes https://github.com/awesomeWM/awesome/pull/430.
2015-09-19 12:05:28 +02:00
Uli Schlachter 41a8fabf4c Explicitly track dependencies between widgets
Before this, dependencies between widgets where implicitly discovered by
recursive calls to base.fit_widget() and base.layout_widget(). However, it is
too easy to get this wrong (just call one of these functions from outside of a
widget's :fit() / :layout() function) and the resulting mess would be hard to
debug.

Thus, this commit changes the API so that callers have to identify themselves
and we can explicitly record the dependency between the widgets involved.

This also fixes a bug where no dependencies were tracked for widgets after
:set_visible(false). Whoops...

Sorry for breaking the API for adding this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-17 18:17:05 +02:00
Uli Schlachter 14be909206 Remove gears.debug.assert
Lua provides an assert() function already, so let's just use that.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-16 15:01:26 +02:00
Daniel Hahler 42aea011d2 placement.no_offscreen: add optional screen argument
This is used by `tooltip.place` then to tie the tooltip to the screen of
the mouse.  Without this, a tooltip from the tasklist might get moved to
the screen above the tasklist, if it gets considered to be on that
screen given its coordinates.

Closes https://github.com/awesomeWM/awesome/pull/437.
2015-09-16 10:39:12 +02:00
Uli Schlachter 2330040eb5 wibox.drawable: Fix complete repaints
When a complete repaint is scheduled, also do a relayout, because this is also
the case that we go through when the underlying cairo surface is resized. For
example, resizing a client with a titlebar would trigger this.

Also, going through this code path is necessary since this is the only place
where the dirty area is updated so that it includes "everything". Before this
change, nothing was actually redrawn, because the dirty area was empty.

Fixes: https://github.com/awesomeWM/awesome/issues/449

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-15 12:49:20 +02:00
Kazunobu Kuriyama a005ad22b1 Correct indentation of keyboardlayout.lua
Correct the indentation of keyboardlayout.lua, so that it complies with
the vim modeline at the bottom of the file.
2015-09-13 01:35:50 +09:00
Kazunobu Kuriyama 81e667feab keyboardlayout: Extend allowable 'group_names' pattern range
Extend the range of the 'group_names' patterns which is currently
restricted to typical ones like

    pc+us+ru:2+de:3+ba:4+inet

to more general ones such as

    macintosh_vndr/apple(alukbd)+macintosh_vndr/jp(usmac)+macintosh_vndr/jp(mac):2

so that the keyboardlayout widget can handles all possible patterns
returned by awesome.xkb_get_layout_group().
2015-09-13 01:19:00 +09:00
Yauhen Kirylau 475358050a fix(lib: wibox: layout: constraint): s/base_widget/base/
Closes https://github.com/awesomeWM/awesome/pull/446.
2015-09-12 15:23:16 +02:00
Abdo Roig-Maranges 57755b3db2 Add missing hints argument in `awful.movetoscreen`
Closes https://github.com/awesomeWM/awesome/pull/441.
2015-09-11 22:30:47 +02:00
Daniel Hahler 6d8347df90 ewmh.activate: make hints optional
Ref: https://github.com/awesomeWM/awesome/pull/441.

Closes https://github.com/awesomeWM/awesome/pull/444.
2015-09-11 22:30:07 +02:00
Uli Schlachter ca9242da4b Merge branch 'new_widget_system3' 2015-09-11 17:17:06 +02:00
Uli Schlachter 5e577a10ab Fix wibox.hierarchy:draw()
This accidentally called the draw callbacks with a nil argument instead of the
context. This was introduced in some badly done rebase, sorry! :-(

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-11 17:14:03 +02:00