Commit Graph

2181 Commits

Author SHA1 Message Date
Uli Schlachter 426da4f8bb Fix one more luacheck warning in awful.widget.tasklist 2016-02-14 14:43:20 +01:00
Uli Schlachter 798be638d9 Fix this master fill policy stuff
awful.layout.suit.corner does awful.tag.getmfpol(t), but doesn't actually have a
variable t in scope. I just copied the needed stuff from the tile layout.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:43:10 +01:00
Uli Schlachter b4148f5dfa Mark a bug in awful.widget.common as such
No idea what the correct value for this argument is supposed to be, but since
there is no variable "m" in scope, this always uses nil as the value.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:43:04 +01:00
Uli Schlachter c7aed3bd88 Fix wrong variable in awful.widget.taglist
There is no "s" variable. This code wants "screen" instead. The effect of this
typo was that with multiple taglists, only the one that was created last got
updated.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:58 +01:00
Uli Schlachter b01f480431 awful.prompt: Fix with newer Lua
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:53 +01:00
Uli Schlachter ee530a65d6 Fix typo in awful.tag.swap
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:48 +01:00
Uli Schlachter a4e598d444 Fix naughty.reset_timeout
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:40 +01:00
Uli Schlachter 9db539fbf2 Fix wibox.layout.mirror
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:34 +01:00
Uli Schlachter 065dd0d213 Merge branch 'easy-async-spawn' of https://github.com/actionless/awesome 2016-02-14 14:34:37 +01:00
Uli Schlachter 99ef5822b0 Merge branch 'more-luacheck-fixes' of https://github.com/psychon/awesome 2016-02-14 14:33:06 +01:00
Uli Schlachter b73ebabbfa Merge branch 'remove-awful-mouse-finder' of https://github.com/psychon/awesome 2016-02-14 14:32:28 +01:00
Emmanuel Lepage Vallée 0a15ea9131 Merge pull request #691 from psychon/fix-titlebars
Fix missing import from commit 7842f92f08
2016-02-12 21:36:42 -05:00
Uli Schlachter a0d4d729d3 Remove awful.mouse.finder
This module is partly broken since 2009 (the way to use it that is mentioned in
the docs doesn't actually work) because the mousefinder object doesn't have a
find()-method (the line doing "self.find = find" should do "self.finder =
finder.find"). Since no one really noticed, this module is apparently not used
much.

When someone wants to still use this, they are free to copy this to their own
config. It's not much code, but it's enough code that I am annoyed that we ship
something broken to users. Everyone who copies it to their own config will make
sure it works the way they want.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 18:27:40 +01:00
Uli Schlachter 6a4df17e70 Fix missing import from commit 7842f92f08
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 18:19:22 +01:00
Uli Schlachter 2c77f9dcf8 Fix luacheck warnings in lib/naughty
A warning pointing out an actual problem is left.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:16:42 +01:00
Uli Schlachter 15e72fb037 Fix luacheck warnings in lib/wibox
Warnings pointing out actual problems are left.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:15:55 +01:00
Uli Schlachter 8c26e2dab4 Fix all luacheck warnings in lib/gears
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:11:50 +01:00
actionless 2501f128e4 chore(awful: hotkeys: vim): rename key groups 2016-02-12 01:07:04 +01:00
actionless 36e124d894 chore(awful: hotkeys: vim): add `find` and `scroll` categories 2016-02-12 01:05:59 +01:00
actionless 8041078618 chore(awful: hotkeys: vim): small improvements in hotkeys descriptions 2016-02-12 01:03:07 +01:00
Uli Schlachter c75741c578 Fix luacheck warnings for the rest of awful
This fixes *most* luacheck warnings in awful. However, some non-trivial ones
remain for latter.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-11 21:55:32 +01:00
Uli Schlachter 99a4184224 Fix luacheck warnings in lib/awful/widget/
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-11 21:55:32 +01:00
Uli Schlachter c455e1f90e Fix luacheck warnings in half of awful
Boy, awful is huge... Let's better do it in two parts

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-11 21:55:32 +01:00
Uli Schlachter f2cf4a6385 Fix luacheck warnings in beautiful and menubar
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-11 21:55:32 +01:00
Daniel Hahler bb85e10042 Merge pull request #685 from actionless/hotkeys_extended_mathes
feat(awful: hotkeys): extended matching rules
2016-02-11 21:52:22 +01:00
Daniel Hahler 58954f7f08 Merge pull request #675 from psychon/remove-gears.sort
Remove gears.sort
2016-02-11 21:51:44 +01:00
Daniel Hahler 7e57ca30ff Merge pull request #651 from psychon/client-leaks
Client leaks
2016-02-11 21:24:57 +01:00
actionless 901771e51b feat(awful: hotkeys): extended matching rules 2016-02-11 12:33:02 +01:00
Emmanuel Lepage Vallee cb896ca87f wibox.widget: Add method to create declarative widgets directly 2016-02-11 03:58:54 -05:00
Emmanuel Lepage Vallée 4a45db9eb0 Merge pull request #642 from Elv13/upstream_dynamic_p6
Add ratio and stack layouts
2016-02-11 03:44:49 -05:00
actionless 4aaedb0f86 fix(awful: hotkeys): restore continuation symbol 2016-02-11 03:43:13 +01:00
Emmanuel Lepage Vallee 0a39d196c7 wibox.layout: Add the new 'ratio' layout
This layout allow each widgets to take 'r' percent of the total
space, where 'r' is configurable.

It re-implement the 'wfact' system used by `awful.layout.suit.tile`
2016-02-10 21:40:40 -05:00
Emmanuel Lepage Vallee 20030e6f93 wibox.layout: Add new 'stack' layout
This layout display the widgets on top of each other. It can also optionally
display only the first one.

The most common use case is to create a composited widget. Other use case
include the creation of a "paged" stack to only display the most
relevant widget without adding extra complexity to the parent layout.
2016-02-10 21:40:40 -05:00
actionless 333c5cd31c fix(awful: hotkeys): case when description is missing (+prettify) 2016-02-11 03:32:11 +01:00
actionless 3a9f7a1cee fix(awful: hotkeys): compute length of the line correctly 2016-02-11 01:04:54 +01:00
actionless 64bd09d38d fix(awful: hotkeys): fix sorting of hotkeys 2016-02-11 00:54:47 +01:00
Emmanuel Lepage Vallée ff8f2aef27 Merge pull request #678 from Elv13/bgimage
Extend bgimage support
2016-02-10 03:59:06 -05:00
Emmanuel Lepage Vallee b1e69dba8c doc: Move the new widget documentation to a new file
This will help with discoverability
2016-02-10 01:25:41 -05:00
Emmanuel Lepage Vallee 7842f92f08 wibox: Support the declarative container syntax
Also support it for titlebars
2016-02-10 01:25:31 -05:00
Emmanuel Lepage Vallee 6a68173ccb widget: Add a new container declaration syntax
This new syntax is inspired by the Awesome widget 3.2-3.4 API. It
allow cleaner widgets declaration. The produced code is usually much
shorted and easier to read than wibox.widget imperative syntax.
2016-02-10 01:09:50 -05:00
Emmanuel Lepage Vallee e36f23171b wibox.widget: Add `set_children` method
Provide a generic method to set the widget content
2016-02-10 01:09:50 -05:00
Emmanuel Lepage Vallee 4a20f9e533 titlebar: Support bgimage 2016-02-10 00:15:17 -05:00
Emmanuel Lepage Vallee c957b3d5a8 wibox: Support bg_image 2016-02-10 00:15:14 -05:00
Emmanuel Lepage Vallee 7666976538 drawable: Add background image support
Copy what's done in `widget.background`
2016-02-10 00:15:09 -05:00
Emmanuel Lepage Vallee cbea82f1c8 widget.background: Allow function as background image
There is already a hack into `awful.widget.common`. This system aim
to make the hack obselete while preserving the useful part.

I think this is also necessary to properly support SVG (with DPI
and resize).

Finally, Qt handle this using the QBrush concept, where you can have
programmatic patterns. Cairo doesn't have this concept, so there is no
"clean" way to have programmatic brushes.
2016-02-10 00:15:00 -05:00
Uli Schlachter 94e9a030c1 Remove gears.sort
It's unused since commit 0aa4304bda. Before this was a stable sorting
algorithm since table.sort is allowed to be unstable. Apparently we don't need a
stable sorting algorithm anymore.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-07 12:24:35 +01:00
actionless 801d297648 feat(awful: spawn): add 'easy_async' wrapper 2016-02-07 05:19:13 +01:00
Emmanuel Lepage Vallée 720768330c Merge pull request #664 from Elv13/background_border
widget.background: Add shape border support
2016-02-06 03:48:13 -05:00
Emmanuel Lepage Vallee 33c943d9b8 widget.background: Add shape border support 2016-02-06 03:43:42 -05:00
Uli Schlachter 7d32f7b733 tasklist: Unreference client in unmanage
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-04 18:24:53 +01:00
Uli Schlachter 69d96ba34d awful.titlebar: Unreference titlebars in unmanage
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-04 18:24:53 +01:00
Uli Schlachter 791794fa42 awful.titlebar: Fix memory leak with clients
Any awful.titlebar.widget.button widget (e.g. floatingbutton or closebutton)
decides on the currently visible symbol based on several factors. One of them is
"is the client currently focused?" and thus the button has to be updated when
the client is focused/unfocused.

The way the code did this was to use client.connect_signal("focus", f) and
client.connect_signal("unfocus", f). However, these signals are never
disconnected and kept alive forever. The callback function had a strong
reference to the client (as an upvalue) and thus this also prevented the client
from being garbage collected.

Fix this by using c:connect_signal("focus/unfocis", f) instead. These kind of
signals are only kept alive by the client object and don't prevent it from being
garbage collected.

This fixes the new test that the previous commit added.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-04 18:24:52 +01:00
actionless 8a9ae1a073 feat(awful: hotkeys widget): merge hotkeys with the same modifiers and descriptions 2016-02-04 13:14:45 +01:00
Emmanuel Lepage Vallée 19437930a2 Merge pull request #630 from Elv13/upstream_dynamic_p5
Multiple `wibox.layout` enhancements
2016-02-04 03:09:38 -05:00
Emmanuel Lepage Vallee 1f5dae8c18 awful.tag: Fix mistakes from cd0503f55 2016-02-04 00:14:51 -05:00
Emmanuel Lepage Vallee e615173552 layout.fixed: Add methods to manipulate the layout after creation
Until now, this layout was "append only". There was no official
APIs to remove, replace, insert and swap widgets. This is fine
for the usual wibox + sensors widget used by the majority of
users, but lack flexibility necessary to use the layout system
to place dynamic elements such as clients.

The methods introduced by this commit are also recursive. This
allow widgets to be decorated, wrapped and splitted without
having to add boilerplate code everywhere.
2016-02-03 04:01:38 -05:00
Emmanuel Lepage Vallee 330c8d97e1 layout.flex: Base on layout.fixed rather than widget.base
This remove duplicated code and will allow more "collection"
style layouts to be implemented without logic duplication.

This commit also do some small cleanup to remove duplicated
code now present in `awful.util`.

Fixes https://github.com/awesomeWM/awesome/issues/617
2016-02-03 04:00:56 -05:00
Emmanuel Lepage Vallee b2d121aa18 widget.base: Add ':index(w, r)' method
This function is optionally recursive. This allow to manipulate
abstract layouts without really having to care about the exact
hierarchy.
2016-02-03 04:00:56 -05:00
Emmanuel Lepage Vallee 8da5c79bb8 wibox.widget: Add new `get_children(recursive)` method to all widgets 2016-02-03 04:00:42 -05:00
Emmanuel Lepage Vallee 7a7f9f2b64 awful.util: Make 'util.table.merge' return the table
This avoid having to add a temporary variable when returning
from functions. Qt does the same.
2016-02-02 21:32:01 -05:00
Emmanuel Lepage Vallee 4556728b99 util: Add util.table.from_sparse
Go around a limitation of the lua language spec. The return value
of this method guaranteed `ipairs()` correctness.

Please note that both the official Lua and Luajit implementation
provide a sparse table compatible `ipairs()` and __len implementation
by default.
2016-02-02 21:31:56 -05:00
Emmanuel Lepage Vallee 3d2b31bbb9 util: Add awful.util.table.crush
Allow to replace copy pasted code used to apply class heritage in
much of wibox.widget
2016-02-02 21:31:24 -05:00
Emmanuel Lepage Vallee 348cd3a590 gears.shape: Add isosceles_triangle shape 2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee 0bf76dc984 gears.shape: Add powerline shape 2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee 4a44b0dc81 gears.shape: Add hexagon shape 2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee a89b21ba2f gears.shape: Add arrow shape 2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee 1060a3487e gears.shape: Add rectangular_tag shape 2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee a49b259c7f gears.shape: Add infobubble shape 2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee 704c028621 gears.surface: Add a method to create a surface from a shape
Useful for icons
2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee 1d1e487d19 wibox.imagebox: Add a `clip` method based on the `gears.shape` API 2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee 98d8b8a199 gears.shape: Add a transformation mechanism
This allow to take a generic shape and transform it into a more
custom one without bloating the shape code.
2016-02-02 00:21:42 -05:00
Emmanuel Lepage Vallee a3b31089b1 gears.matrix: Add ability to attach a function
It is an internal API and is used by `gears.shape`, `gears.pattern`
and `gears.composition` only.

This commit also add `:rotate_at` and `:copy` methods.
2016-02-02 00:21:18 -05:00
Uli Schlachter ad4c62e639 Fix warnings from ldoc
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-30 10:43:41 +01:00
Emmanuel Lepage Vallee dc432eb7a6 widget.background: Fix error introduced in d01c1d2d6
Fix a copy/paste mistake.
2016-01-21 22:53:21 -05:00
Daniel Hahler cb267e56d5 Merge pull request #637 from psychon/set_markup
Make wibox.widget.textbox:set_markup() throw Lua errors less often
2016-01-20 00:01:09 +01:00
Emmanuel Lepage Vallée 7ffb238ae8 Merge pull request #633 from Elv13/upstream_dynamic_p4
layout: Support layout with a constructor
2016-01-18 22:47:56 -05:00
Emmanuel Lepage Vallée 2736c75e43 Merge pull request #632 from Elv13/upstream_dynamic_p3
awful.layout: Split the layout parameters computation from 'arrange'
2016-01-18 22:46:59 -05:00
Emmanuel Lepage Vallee 67132e904d awful.layout: Split the layout parameters computation from 'arrange'
It is necessary to have it beforehand when creating layout objects
for unselected layouts.

In the current layout system, there is no layout object, but to allow
tabs and dynamic tagging features like ion3, layouts cannot be stateless.
2016-01-18 22:44:22 -05:00
Emmanuel Lepage Vallée 123c3d4114 Merge pull request #631 from Elv13/upstream_dynamic_p2
tag: Refactor awful.tag.setproperty to call setters
2016-01-18 22:41:15 -05:00
Emmanuel Lepage Vallée 72d3065937 Merge pull request #638 from Elv13/upstream_shape_api
Upstream shape api
2016-01-18 17:51:58 -05:00
Emmanuel Lepage Vallée cbd366d1a1 Merge pull request #612 from Elv13/fix_awful.client_idx
awful.client.idx: Avoid error when called with a floating client
2016-01-18 17:39:43 -05:00
Emmanuel Lepage Vallee 81019487f0 awful.client.idx: Avoid error when called with a floating client
Before, it was the caller job to make sure the client wasn't floating.

This limitation is unecessary. awful.client.idx now return nil instead
of an error. awful.rules setting the master width factor are now
foolproof.
2016-01-18 17:35:33 -05:00
Emmanuel Lepage Vallee d01c1d2d6d widget.background: Allow background to have a shape 2016-01-18 17:22:49 -05:00
Emmanuel Lepage Vallee dd93418afb gears.surface: Add an helper to set a shape to drawable 2016-01-18 17:22:44 -05:00
Emmanuel Lepage Vallee fb0c82a798 gears.shape: Add a new module to make it easier to use shapes
This code is imported from Elv13 config and make it very easy
to create shaped objects.

If accepted upstream, other shapes, such as arrow and powerline
will also be added. This commit introsuce the 2 most common
shapes, rounded rectangle and rounded bar.
2016-01-18 17:20:32 -05:00
Emmanuel Lepage Vallée d202c1f1c2 Merge pull request #629 from Elv13/upstream_dynamic_p1
client: Add swapped, raised and lowered signals
2016-01-18 16:40:07 -05:00
Emmanuel Lepage Vallee b74b8ea0cd margin: Add an option to :fit() -> 0,0 when the content is empty
Make it easier to write "optional" widgets, like empty textbox
that can be filled only in certain scenarios.
2016-01-18 03:38:46 -05:00
Emmanuel Lepage Vallee cd0503f552 layout: Support layout with a constructor
This allow the most basic kind of stateful layouts to be created.
It is now possible to have layout instances instead of global
stateless layout arrange functions.
2016-01-18 02:12:19 -05:00
Emmanuel Lepage Vallee 55190646c4 client: Add swapped, raised and lowered signals
This allow layout "arrange" to be called less often and react on
the cause of the change itself rather than it's consequences
(usually, the "focus" signal).

Previously, the layout were re-arranged everytime the focus changed.
Now, with "raised" and "lowered", it require less "arrange".

"swapped" allow smarted layouts. Currently, swapped cause a full
re-arrange. It re-read the "index" list from scratch and create
a "new" layout. With "swapped", incremental layout changes are
possible.

Fixes https://github.com/awesomeWM/awesome/issues/616
2016-01-18 01:29:31 -05:00
Uli Schlachter 23d60b0659 gears.wallpaper: Remove some dead code
gears.surface now returns a fallback image surface that is good enough for what
this code tries to do here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 17:39:52 +01:00
Uli Schlachter de6d9334d8 wibox.drawable: Handle gears.surface's new error handling
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 17:39:32 +01:00
Uli Schlachter 0a21931ffc awful.client.shape: Fix for API change in gears.surface
A nil-value is no longer simply passed through, so this has to do some "special
things" to work properly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 17:34:44 +01:00
Uli Schlachter a2c1106401 gears.surface: Also apply default when called with "nil"
Before this, calling one of the loading functions with a nil argument always
made it return the default 0x0 surface. With this change, the passed-in default
value is now properly applied.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 17:33:39 +01:00
Uli Schlachter e7a8df2920 naughty: Follow textbox API change
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 16:51:07 +01:00
Uli Schlachter b3ab06896d awful.widget.common: Follow :set_markup() API change
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 16:50:03 +01:00
Uli Schlachter 178204449c Textbox:set_markup(): Print errors to stderr
Instead of throwing a Lua error, the code now just prints an error message to
stderr on invalid markup. For callers which want to handle this case specially,
we add :set_markup_silently() which returns error messages.

Fixes: https://github.com/awesomeWM/awesome/issues/546
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 16:47:27 +01:00
Uli Schlachter 62495daa66 Merge branch 'naughty-version' of https://github.com/psychon/awesome 2016-01-17 16:01:18 +01:00
Uli Schlachter 3793c339ce Merge branch 'surface-errors' of https://github.com/psychon/awesome 2016-01-17 16:01:03 +01:00
Uli Schlachter fd8d35cb12 Merge branch 'async-spawn-optional-callbacks' of https://github.com/actionless/awesome 2016-01-17 16:00:39 +01:00
Uli Schlachter ab5f9d3d74 Merge branch 'handle_long_colors' of https://github.com/psychon/awesome 2016-01-17 16:00:19 +01:00
Uli Schlachter 2ab98f5e4a Merge branch 'rgb-xresources' of https://github.com/actionless/awesome 2016-01-17 16:00:11 +01:00
Uli Schlachter 1aed092fea Merge branch 'util-getdir' of https://github.com/psychon/awesome 2016-01-17 15:59:54 +01:00
Uli Schlachter 79d3dc003a gears.color: Add support for named colors
Oh hey, Pango exports an API that allows to query for named colors based on the
famous rgb.txt! Let's use that!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 14:27:29 +01:00
Uli Schlachter 0956aa01d9 Add support for short/long colors
This adds support to gears.color.parse_color to parse things like "#fff" (one
character per color component, without alpha) and "#ffff0000ffff0000" (four
characters per component, with alpha).

This makes sense on its own, but should also help with
https://github.com/awesomeWM/awesome/issues/585.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-17 14:16:40 +01:00
Emmanuel Lepage Vallee ab0e3b6112 tag: Refactor awful.tag.setproperty to call setters
*WARNING* This introduce a minor API break as awful.tag.setscreen
arguments are now swapped for consistency

This allow to introduce logic for each properties and improve
awful.tag.add and execute logic when setting properties.
2016-01-16 03:46:38 -05:00
Daniel Hahler 0d1c98a314 Merge pull request #618 from actionless/titlebar-optional-tooltips
feat(awful: titlebar): make tooltips optional
2016-01-15 21:36:30 +01:00
Uli Schlachter 1367968824 naughty: Don't try to parse our version number
The code here doesn't always work, so it's best to just don't mess with
awesome.version, but return it directly.

Fixes: https://github.com/awesomeWM/awesome/issues/569
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 20:12:19 +01:00
Uli Schlachter 76b1d348a1 imagebox: Remove dead code
Since some commits, surface.load() handles printing an error message for us.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:53:09 +01:00
Uli Schlachter 9d97a98b4d naughty: Remove dead code
Since some commits, surface.load_uncached() handles errors itself and thus we
don't have to print an error message here any more.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:53:09 +01:00
Uli Schlachter 4d562306d2 taglist: Remove dead code
The image "library" is long gone.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:43:56 +01:00
Uli Schlachter 86f2d05382 awful.menu: Remove useless surface() call
The imagebox calls surface() for us.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:43:10 +01:00
Uli Schlachter 58ecd92b8e Add better error handling to gears.surface
Previously, a Lua error was thrown when loading a file failed. Most callers are
not prepared for this and the result is less than optimal.

This commit makes the functions print the errors and return nil instead. For
callers that want to handle errors themselves, "_silent" variants of the
functions are introduced which just return errors to the caller.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:38:51 +01:00
actionless f19b38d45b fix(awful: hotkeys): caching on multiscreen setup 2016-01-14 17:57:55 +01:00
actionless e74eb9775b feat(awful: titlebar): make tooltips optional 2016-01-06 17:09:55 +01:00
actionless 7546c236db feat(spawn, lib: awful: spawn: with_line_callback): make callbacks optional 2016-01-03 15:38:06 +01:00
Uli Schlachter 720cd879f3 Add timestamps to messages on stderr (#602)
Closes https://github.com/awesomeWM/awesome/pull/606.
Fixes https://github.com/awesomeWM/awesome/issues/602.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-31 15:38:17 +01:00
Uli Schlachter 5cbd4402d9 awful.autofocus: Handle sticky clients (#603)
Closes https://github.com/awesomeWM/awesome/pull/610.
Fixes https://github.com/awesomeWM/awesome/issues/603.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-31 15:33:51 +01:00
Emmanuel Lepage Vallee bd8e2d2ca8 typo: replace 'wibox' with 'context' where relevant
Closes https://github.com/awesomeWM/awesome/pull/613.
2015-12-31 15:33:22 +01:00
Uli Schlachter 16994f3b12 Fix API documentation broken in eb8577a424
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-22 18:31:48 +01:00
Daniel Hahler 9031a81396 doc fixes to awful.menu.clients 2015-12-12 20:12:08 +01:00
Dario Gjorgjevski c5ad6069d4 Add an optional filter to `awful.menu.clients` 2015-12-12 20:12:08 +01:00
Daniel Hahler ae5d4b5512 Merge pull request #571 from psychon/scrolling_layout
Add a scroll layout
2015-12-12 20:01:32 +01:00
Daniel Hahler 833b10eb9b Merge pull request #593 from psychon/editorconfig
Vim modelines and editorconfig
2015-12-12 19:13:53 +01:00
Daniel Hahler 981987764e Merge pull request #586 from psychon/widget_funcs
Widgets: set_width / set_height
2015-12-12 19:13:28 +01:00
Daniel Hahler 69da6ee0db Merge pull request #576 from psychon/spawn_exit_code
At exit code support to spawn
2015-12-12 19:10:48 +01:00
Uli Schlachter 63653bed76 Add the right vim modeline to all lua files
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:42:33 +01:00
Uli Schlachter 469433e10a awful.spawn.with_line_callback: Use an arguments table
Having many arguments can easily get confusing and hard to understand. This
commit uses a table instead so that we have names that identify what each
callback does.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-12 17:27:33 +01:00
Uli Schlachter 20c9723c5b awful.util: Add getters for themes and icon paths
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-11 18:24:30 +01:00
Uli Schlachter 8953218e5c Use get_cache_dir() instead of getdir("cache") everywhere
Just because I like that function more. :-)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-11 18:16:26 +01:00
Uli Schlachter 5a34f6f047 Add various functions for getting directories
This adds functions for getting directories according to the XDG base dir
specification. This might be useful in general.

This also adds a function for getting the cache dir, because I like an explicit
function call more than something which "switches" based on a string argument.
Better error messages if you mis-type something. :-)

Finally, this adds a function for getting the directory containing the rc.lua
file. Sadly, awful.util.getdir("config") did not actually do that. See #218.

Fixes: https://github.com/awesomeWM/awesome/issues/218
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-11 18:14:41 +01:00
Daniel Hahler e39504a30f Make textbox widget respect the current theme
Without this fix `wibox.widget.textbox` ignores current theme font
setting and resets it to the initial one.
It becomes handy when the initial theme is tweaked during runtime, ie.
in `rc.lua`. Other AwesomeWM components like `awful` (taglist,
tasklist, menu) are aware and do respect the actual theme settings.

Closes https://github.com/awesomeWM/awesome/pull/89.
2015-12-11 00:55:33 +01:00
Uli Schlachter ce965424c3 gears.object:weak_connect_signal: Use a weak-value table (#520)
Lua will remove objects as values from a weak table before these objects are
finalized, but as values only in the next garbage collection cycle after the
object was finalized. Up to now, gears.object uses a table with weak keys so
that :disconnect_signal() works. This means that a signal can still call methods
which were already considered garbage by the garbage collector and thus can use
userdata from the C side which was already finalized. Crashes and other bugs
result.

This commit changes the code so that the function is also a value in the weak
table. Thus, the GC will remove the entry before the object is finalized.

Special magic is needed for Lua 5.1, because there only userdata has the
behavior that we want while we have a function. We do some magic with function
environments to make this work...

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-10 23:19:52 +01:00
actionless eb8577a424 feat(lib: menubar): dpi support in menubar
Closes https://github.com/awesomeWM/awesome/pull/580.
2015-12-10 23:18:43 +01:00
Barlik f6d08274a6 Use integer size when creating titlebar
Closes https://github.com/awesomeWM/awesome/pull/584.
2015-12-10 23:13:24 +01:00
actionless 2d7fc8bc49 feat(beautiful: xresources): read rgb: and argb: prefixed colors 2015-12-07 09:38:22 +01:00
ShadowKyogre 742cbd7122 Call :set_bg for the mouse finder's wibox
Before this, it was trying to assign it to `.bg`, which isn't how
backgrounds are stored on wiboxes.

Closes https://github.com/awesomeWM/awesome/pull/587.
2015-12-06 19:33:13 +01:00
Uli Schlachter f4077def8e Add :set_{width,height} to widgets (#291)
This adds new functions to all widgets that allow to force a specific
width/height. These values override the result from :fit().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-05 12:31:33 +01:00
Uli Schlachter c2be60fb54 wibox.widget.base: Factor out functions available on all widgets
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-05 12:25:25 +01:00
actionless 0516203610 feat(lib: awful: hotkeys_popup): widget to show awesome and third-party keybindings
Closes https://github.com/awesomeWM/awesome/pull/421.
2015-12-02 01:02:15 +01:00
dyslesiq ecf6b55b55 Added value check of required 'Name' entry in .desktop parsing
Closes https://github.com/awesomeWM/awesome/pull/574.
2015-12-01 20:17:21 +01:00
Uli Schlachter c02969bb0e wibox.widget.systray: Also emit redraw_needed
When emitting layout_changed, the widget is relayouted. If this doesn't actually
change anything, nothing will be redrawn. Thus, this also emits redraw_needed to
force redraws.

This fixes a race condition with some weird tray icons. A new tray icon is
created and the systray is updated. Then this new icon is destroyed immediately
again and at the same time another icon is created. Then, the systray isn't
updated since the number of icons (=the layout) did not actually change.
However, it needs to be updated and so we ended up with broken/missing icons.

Fixes: https://github.com/awesomeWM/awesome/issues/487
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-29 12:33:13 +01:00
Uli Schlachter 44a3e27e81 awful.spawn.with_line_callback: Add exit callback
This adds support for the callback that was added in the previous commit to this
function. We can just pass on the function that the caller gives us.

Fixes: https://github.com/awesomeWM/awesome/issues/185
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-29 11:56:05 +01:00
Uli Schlachter 1c8aa0f5f4 Add a scroll layout
This allows scrolling a widget if there is too few space available. There are
several different modes available for how the scrolling "looks like".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-22 18:19:53 +01:00
Daniel Hahler 58bd21ad79 layout.arrange: fix screen arg in call to tag.getgap
Fixes https://github.com/awesomeWM/awesome/pull/568#issuecomment-158682756.
2015-11-22 00:30:21 +01:00
Daniel Hahler 269bb90e18 Only use useless_gap with multiple tiled clients
Fixes https://github.com/awesomeWM/awesome/issues/564.
Closes https://github.com/awesomeWM/awesome/pull/568.
2015-11-20 17:17:21 +01:00
Uli Schlachter 234100ebdf Fix/silence various ldoc warnings in menubar
Closes https://github.com/awesomeWM/awesome/pull/559.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-19 22:22:23 +01:00
Daniel Hahler c8e078b1bf doc: fix example with awful.prompt.run hooks
It should return `command` for it to be executed.
2015-11-19 22:14:01 +01:00
Uli Schlachter b7d398f339 awful.widget.tasklist: Use pairs instead of ipairs
This is a weak table whose entries might be removed by the garbage collector.
I'm not sure if this will every cause problems, but it's better to be prepared
for tables having "nil holes" (which would mean ipairs ignores some entries).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-19 20:13:37 +01:00
Uli Schlachter 7eed74b814 Fix multiple tasklists on the same screen (#563)
The code already tried to handle this correctly, but at some point it used the
wrong variable as the screen number...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-19 20:11:42 +01:00
Uli Schlachter f7bbcf1263 wibox.drawable: Make screen_getbycoord() local
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-15 19:36:15 +01:00
Daniel Hahler ba0d8e38e5 awful.prompt.run: handle command return value from hooks 2015-11-08 12:33:00 +01:00
Daniel Hahler b3c7efd5e4 Add awful.widget.prompt.spawn_and_handle_error helper
This is meant to avoid boilerplate code when creating prompt hooks.
2015-11-08 12:32:53 +01:00
Emmanuel Lepage Vallee ce2d31cbde prompt: Add the ability to add new shortcuts to awful.prompt
Example:

awful.prompt.run({ prompt = "Run: ", hooks = {
    {{         },"Return",function(command)
         local result = awful.util.spawn(command)
         mypromptbox[mouse.screen].widget:set_text(type(result) == "string" and result or "")
         return true
    end},
    {{"Mod1"   },"Return",function(command)
         local result = awful.util.spawn(command,{sticky=true})
         mypromptbox[mouse.screen].widget:set_text(type(result) == "string" and result or "")
         return true
    end},
    {{"Shift"  },"Return",function(command)
         local result = awful.util.spawn(command,{ontop=true,floating=true})
         mypromptbox[mouse.screen].widget:set_text(type(result) == "string" and result or "")
         return true
    end}
    }
},...)
2015-11-08 12:31:36 +01:00
Daniel Hahler f1598881a4 Merge pull request #537 from psychon/timer-signals
gears.timer: Add start and stop signals (#348)

Closes https://github.com/awesomeWM/awesome/pull/537.
2015-11-05 23:07:31 +01:00
Daniel Hahler 2bca03cb87 doc: fix format for wibox.widget.base.make_widget
Closes https://github.com/awesomeWM/awesome/pull/548.
2015-11-05 23:05:42 +01:00
Daniel Hahler a410326ba6 Improve doc for awful.spawn: module/spawn/with_shell 2015-11-05 01:53:57 +01:00
Uli Schlachter a69d901c64 Add some documentation to gears.timer
It feels weird to document the signals like this, but apparently that is the way
this needs to be done.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-01 17:08:20 +01:00
Daniel Hahler 1222b5b5fd Merge pull request #535 from psychon/textbox_preferred_size
Add functions for querying a textbox's preferred size

Closes https://github.com/awesomeWM/awesome/pull/535.
2015-10-30 20:31:17 +01:00
Daniel Hahler 751db72de6 Merge pull request #523 from blueyed/fix-menubar
Some menubar / icon theme fixes

Closes https://github.com/awesomeWM/awesome/pull/523.
2015-10-29 23:24:19 +01:00
Benjamin Petrenko 0a11cd0c4d Make client.movetotag emit request::activate on client
Closes https://github.com/awesomeWM/awesome/pull/439.
2015-10-26 23:09:08 +01:00
Daniel Hahler 872c321e81 Merge pull request #507 from psychon/closest_screen
Update the definition of "closest screen" to take into account that a
screen is a rectangle and not just the top-left corner.

Closes https://github.com/awesomeWM/awesome/pull/507.
2015-10-26 23:07:43 +01:00
Uli Schlachter 112ce3b419 Set the wallpaper more intelligently
Usually users want a wallpaper on all their screens. With the current code, this
resulted in a loop of upload-wallpaper, {download-wallpaper, add-new-part,
upload-wallpaper}*.

Fix this by being more intelligent: Instead of setting the wallpaper
immediately, this now uses gears.timer.delayed_call() to set the wallpaper. All
following modifications which come in before the delayed call runs will still be
part of the current update. This should mean that during startup, there is just
a single upload of a wallpaper.

(The above is what happens if there is no wallpaper yet. If there is already
one, we use :create_similar() and thus should only upload the part of the
wallpaper that changed, but this doesn't really make a difference.)

As a side-effect, the new code no longer draws to the old wallpaper to modify
it, but always creates a copy of it. This means that:

Fixes https://github.com/awesomeWM/awesome/issues/288.
Closes https://github.com/awesomeWM/awesome/pull/530.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-26 23:06:32 +01:00
Daniel Hahler 57e3927cbd Add awful.util.is_dir
Extracted from https://github.com/awesomeWM/awesome/pull/187.

Closes https://github.com/awesomeWM/awesome/pull/536.
2015-10-26 23:06:08 +01:00
Uli Schlachter 0be33a0707 awful.placement: Add the border to the client's geometry (#540)
Thanks to the way that X11 works, geometries consider the size of the client
without the border width, but the position of the top-left corner of the border.
This commit adds a new function get_area() which returns the area that is
actually covered by a client. Then, all the code is changed to use this new
function (even the part of the code which did get this border thing correct).

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-26 23:05:24 +01:00
Uli Schlachter 3d3570a998 awful.placement: Only set position
None of this code wants to resize clients. Thus, it makes sense to only set the
position of a client and ignore its size.

Also, this sneaks in a fix for no_offscreen which is documented to return the
client's new position, but didn't actually do so.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-26 23:04:59 +01:00
Uli Schlachter b61026310d gears.timer: Add start and stop signals (#348)
This makes the timer emit signals for when it is started and stopped. This does
not add a signal for :again(), because that function just calls the other two
functions and thus already emits start and stop.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-18 15:31:52 +02:00
Uli Schlachter 4577e32a38 naughty: Use :get_height_for_width()
This changes the code in naughty so that it first decides on a width for the
notification and then uses the new function :get_height_for_width() to find a
suitable height.

This makes a difference in the following example where before this change the
text is cut off and afterwards it is shown completely:

  naughty.notify({
      text = string.rep("abcdefghijklmnopqrstuvwxyz\n", 4),
      width = 75
  })

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-17 19:13:26 +02:00
Uli Schlachter fcfed22d8a Remove hacks for querying a textbox' size
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-17 19:13:26 +02:00
Uli Schlachter cdd8d2ed5f Textbox: Add API for queriying preferred size (#466)
This adds :get_preferred_size() and :get_preferred_size_at_dpi() which return
the size (=width, height) that the textbox would need if unlimited space is
available.

This also adds :get_height_for_width() and :get_height_for_width_at_dpi() which
return the height that the textbox would need if the given width is available.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-17 19:13:26 +02:00
Uli Schlachter dc0afe9f59 Add some constructor arguments to some layouts
This adds new constructor arguments to align, fixed and flex which allows adding
widgets directly while creating the layout.

Idea originally by actionless:
https://github.com/awesomeWM/awesome/pull/486#issuecomment-143606301

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-17 14:50:46 +02:00
Daniel Hahler e3253db406 Merge pull request #528 from blueyed/doc-spawn-spawn
Doc fixes: spawn.spawn and long/wrapped lines

Closes https://github.com/awesomeWM/awesome/pull/528.
2015-10-14 16:26:37 +02:00
Daniel Hahler 555ccc15a8 doc: typos/grammar 2015-10-14 16:24:52 +02:00
Daniel Hahler 2932322775 doc: params for request::activate 2015-10-14 16:24:51 +02:00
Daniel Hahler 4bffa7e47e doc: fix unintentional rendering as code due to indent 2015-10-14 00:22:26 +02:00
Daniel Hahler 22f90752f7 doc: improve doc for awful.spawn(.spawn) 2015-10-14 00:22:26 +02:00
Daniel Hahler a648b27af6 menubar.icon_theme: cache index_theme instances
Ref: https://github.com/awesomeWM/awesome/pull/523#commitcomment-13716821
2015-10-13 22:28:34 +02:00
Daniel Hahler 7d9b78c13c menubar.icon_theme.lookup_icon: check for dist in outer loop 2015-10-13 22:28:30 +02:00
Daniel Hahler 75341d9e38 menubar.menu_gen.generate: do not call lookup_icon again
`menubar.utils.lookup_icon` gets called via `menubar.utils.parse`
already.
2015-10-13 22:27:20 +02:00
Daniel Hahler efbddb5875 Add cache for menubar.utils.lookup_icon
I have tried to use `utils.icon_cache =
require("gears.cache").new(utils.lookup_icon_uncached)`, but that
appears to get garbage-collected too much?!
2015-10-13 22:27:20 +02:00
Daniel Hahler 7fa3dc97c8 Optimize menubar.icon_theme.lookup_icon: do not look twice 2015-10-13 22:27:11 +02:00
Daniel Hahler 7afd8e3179 get_icon_lookup_path: only return readable/existing dirs 2015-10-13 22:26:39 +02:00
Kazunobu Kuriyama fbfa6b8995 menubar/icon_theme.lua: Handle scalable icons correctly
This bug was caused by typos.

Closes https://github.com/awesomeWM/awesome/pull/525.
2015-10-13 22:20:43 +02:00
Daniel Hahler 1bd7aa103b Fix signature for recursive find_icon_path_helper
Ref: 81072c0420 (commitcomment-13705007).

This reverts a part of 81072c0.

Closes https://github.com/awesomeWM/awesome/pull/518.
2015-10-13 22:16:01 +02:00
Daniel Hahler 37aad883a6 awful.client: handle focus history through `manage` on startup
After fcccc77 the focus history was not handled correctly any more during
restart.

Closes https://github.com/awesomeWM/awesome/pull/526.
2015-10-13 22:14:24 +02:00
Daniel Hahler 2acc125354 ewmh.activate: document focus handling 2015-10-13 22:14:02 +02:00
Daniel Hahler b092ef82ec doc: clarify 'stacked' argument: top to bottom 2015-10-13 12:20:36 +02:00
Daniel Hahler 3da2508ace client.focus.history.get: use stacking order
This should make it faster in general, and provides a better fallback in
case nothing was found.

Ref: https://github.com/awesomeWM/awesome/pull/526
2015-10-13 12:17:56 +02:00
Daniel Hahler c0fd79a318 Merge pull request #508 from psychon/systray_only_in_wibox
systray: Make sure the widget is only placed in a wibox
2015-10-13 11:34:22 +02:00
Daniel Hahler 71ae967a84 Merge pull request #517 from blueyed/move-is_readable_directory
Move is_readable_directory to awful.util.dir_readable
2015-10-11 18:21:10 +02:00
Uli Schlachter 0060ea9d63 Fix awful.screen.focus
This is broken since 23b2fae6a9.

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-11 17:10:16 +02:00
Uli Schlachter 79e86d409a Fix awful.spawn.spawn
The C code wants a boolean as its argument, so we should give it a boolean.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-11 13:23:57 +02:00
Daniel Hahler 2723399785 Move is_readable_directory to awful.util.dir_readable 2015-10-11 13:17:57 +02:00
Daniel Hahler 765a5f5790 menubar.icon_theme: use GLib.build_filenamev to join paths
This eliminates double slashes from the resulting paths.
`GLib.get_system_data_dirs` might return paths with and without trailing
slashes.
2015-10-11 13:09:33 +02:00
Daniel Hahler e93ce7c2a8 menubar.icon_theme: minor code style fixes
- fix/streamline usage if metatable.__call
2015-10-11 13:09:15 +02:00
Daniel Hahler a140d80d76 icon_theme.find_icon_path: fix typo: s/filaname/filename 2015-10-11 11:53:31 +02:00
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 d03762c322 systray: Make sure the widget is only placed in a wibox
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:30:08 +02:00
Uli Schlachter b1b2852887 awful.screen.getbycoord: Use the same algorithm as in C
We recently changed the C function screen_getbycoord() and this commit makes
awful.screen.getbycoord() use the same algorithm.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:25:26 +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
Daniel Hahler 52154d0f15 Fix client.cycle's screen param handling
Broken since fc950f6.

Closes https://github.com/awesomeWM/awesome/pull/443.
2015-09-10 20:43:52 +02:00
Daniel Hahler fbc72624d7 Activate focused client with `awful.client.movetoscreen`
The default config has this:

    awful.key({ modkey, }, "o", awful.client.movetoscreen                        ),

This moves the client to the next screen and focuses that screen.

But it does not ensure that the client is raised above any existing
windows, e.g. when moving a floating client.

This patch emits the `request::activate` signal if the client is
currently focused, but only if the screen property actually has changed.

Closes https://github.com/awesomeWM/awesome/pull/98.
2015-09-09 13:29:09 +02:00
actionless 7ae58b3208 doc(lib: gears: surface): more verbose docstring
Closes https://github.com/awesomeWM/awesome/pull/436.
2015-09-07 20:29:57 +02:00
Uli Schlachter ee001ce2f0 imagebox: Don't emit signals if same image is set again
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-06 18:57:47 +02:00
Uli Schlachter 6b6b448b56 wibox.hierarchy: Remove _parent member
The parent was needed for :get_matrix_to_device() which recursively walked
parents and multiplied together their transformation matrices. This is now
replaced by calculating all these matrices while constructing the hierarchy.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-06 18:57:41 +02:00
Uli Schlachter dc73a4586a wibox.hierarchy: Stop recording _root
There once was a function :get_root() on hierarchies, but that wasn't needed any
more and thus was removed. This commit also removes the internal code that was
used to record the root element of the hierarchy.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-06 18:57:30 +02:00
Uli Schlachter c62d323d09 wibox.widget.base: Add caches for :layout and :fit
These caches, well, cache the result of the :layout and :fit callbacks on
widgets.

Clearing caches is done by recording dependencies between a widget. When a call
to base.fit_widget() or base.layout_widget() recursively causes another call to
such a function, this means that the earlier widget depends on the later widget.
This dependency is recorded and when the later widget emits
widget::layout_changed, the caches of all the widgets involved are cleared.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-06 18:57:21 +02:00
Uli Schlachter 45323f2801 Remove wibox.hierarchy:get_parent()
It's unused.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-06 18:56:58 +02:00
Uli Schlachter 958603410c flex layout: Test signal emission
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:51:36 +02:00
Uli Schlachter dcd4db69e6 fixed layout: Test signal emission
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:51:36 +02:00
Uli Schlachter 0e7ae1cb25 align layout: Test signal emission
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:51:36 +02:00
Uli Schlachter 7acb30de71 Documentation overhaul for wibox.widget.base
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:51:36 +02:00
Uli Schlachter 26699d5ad7 graph and progressbar: Convert to new system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:51:36 +02:00
Uli Schlachter 0aa4304bda wibox.drawable: Convert to new widget API
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:51:36 +02:00
Uli Schlachter 3338718b93 Merge wibox.layout.base and wibox.widget.base
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:53 +02:00
Uli Schlachter 9b8cbf7539 Convert the textbox to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:53 +02:00
Uli Schlachter 99ac190090 Convert the systray widget to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:53 +02:00
Uli Schlachter 121a5050b1 Convert the imagebox to the new layout system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:53 +02:00
Uli Schlachter 091ca697e6 Convert the background layout to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:53 +02:00
Uli Schlachter b83eaf5915 Conver the rotate layout to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:53 +02:00
Uli Schlachter 85ab3f045b Convert the mirror layout to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:53 +02:00
Uli Schlachter f2b1071875 Convert the margin layout to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:53 +02:00
Uli Schlachter 746cc23402 Convert the constraint layout to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:52 +02:00
Uli Schlachter 496fbde9b4 Convert the flex layout to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:52 +02:00
Uli Schlachter 199b553895 Convert the fixed layout to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:52 +02:00
Uli Schlachter e67e2813e9 Convert the align layout to the new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:52 +02:00
Uli Schlachter 02f67b61b4 Add a widget hierarchy implementation
A widget hierarchy describes the position of widgets. The hierarchy is a
recursive tree of widget hierarchy instances. This functionality depends on a
:layout function that is not yet implemented on widgets, but will be added
later.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:28:52 +02:00
Uli Schlachter 4785b63755 Prepare wibox.widget.base for new widget system
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-05 14:06:29 +02:00
actionless e023fd0640 fix(lib: gears: color): use surface for recolor 2015-09-04 21:09:46 +02:00
actionless 2f340f05ff feat(themes: xresources): recolor layout icons 2015-09-04 21:08:18 +02:00
Daniel Hahler a251331683 awful.rules: factor out `matches`
This factors out `matches` and uses it in `matches_list` (renamed
from `does_match`) to short-circuit the successful case - where not all
rules have to get checked.

Closes https://github.com/awesomeWM/awesome/pull/431.
2015-09-03 22:56:07 +02:00
Daniel Hahler 285f24d234 Fix awful.rules.does_match: use _rules as arg 2015-09-03 22:55:54 +02:00
Uli Schlachter ad9e57d0c1 spawn_with_line_callback: Add missing return
Whoops.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-03 19:57:57 +02:00
Daniel Hahler 2b2c230f43 Merge pull request #323 from actionless/grow-master
Add "master_fill_policy" tag property and its support in "tile" and "corner" layouts

Closes https://github.com/awesomeWM/awesome/pull/323/files.
2015-09-03 08:53:19 +02:00
Daniel Hahler 7c8e97ca31 Merge pull request #406 from psychon/spawn_with_pipes2
Spawn with pipes

Closes https://github.com/awesomeWM/awesome/pull/406.
2015-09-02 22:47:09 +02:00
Uli Schlachter 0e20fef2bd Add awful.util.spawn_with_line_callback
This new function spawns a program, similarly to awful.spawn, but captures its
output. On each line of output on stdout / stderr, a Lua function is called with
this line. There are different callbacks for stdout and stderr. When both stdout
and stderr are closed, another callback function is called. The intention for
this last callback is "the program is done", because most programs should only
close their output when they exit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-02 22:27:32 +02:00
Daniel Hahler c7d375790d awful.widget.common.list_update: expose textbox to label callback
This allows the "label" callback to adjust the textbox itself.
`tasklist_label` is changed to make use of it and supports new style
arguments: `font_focus`, `font_urgent` and `font_minimized`.

Closes https://github.com/awesomeWM/awesome/pull/313.
2015-09-02 22:25:24 +02:00
Daniel Hahler f957d1f96b Merge pull request #408 from psychon/strict-fit
Strict fit

Closes https://github.com/awesomeWM/awesome/pull/408.
2015-09-02 22:12:19 +02:00
Daniel Hahler a0f8948c71 menubar: fix height to be rounded
Fixes https://github.com/awesomeWM/awesome/issues/414.
Closes https://github.com/awesomeWM/awesome/pull/432.
2015-08-31 20:47:22 +02:00
Uli Schlachter bcc1751fca fit_widget(): Sanitize the result of :fit()
After this change, fit_widget() enforces that a widget cannot ask for more space
than was offered to it. This also fixes a rounding issue in the flex layout
where its fit function would return too small numbers.

Thanks to this, lots of "XXX" comments in spec/ disappear.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-23 17:08:44 +02:00
Uli Schlachter 3fbd16d9a3 wibox.layout.align: Correctly size second widget
In expand nodes "none" and "outside", the variable size_remains describes how
much space is available for the first/third widget. Everything else is used by
the second widget. Thus, fitting the second widget to anything involving
size_remains is wrong. Instead, this commit uses the correct value.

This also fixes a messed up argument order for horizontal align layouts.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-23 17:07:45 +02:00
Uli Schlachter 769d6acb64 Merge branch 'add-resize-option' of https://github.com/actionless/awesome 2015-08-23 17:05:30 +02:00
Uli Schlachter 564fae8934 Merge branch 'add_gears_matrix' 2015-08-23 15:36:55 +02:00
Uli Schlachter 56c22cde77 Merge branch 'widget_context' 2015-08-23 15:33:43 +02:00
Uli Schlachter cb34144bf8 Merge branch 'master' of https://github.com/kindlycat/awesome 2015-08-23 15:29:22 +02:00
Uli Schlachter 190beb3e8e Merge branch 'tooltips-replace-on-geometry-changes' of https://github.com/blueyed/awesome 2015-08-23 15:27:10 +02:00
Tim Roes 462055cb36 Add finish callback to awful.mouse.client.move 2015-08-22 14:50:42 +02:00
Daniel Hahler 05da320c28 tooltips: re-place them on width/height changes
If the dimensions of a tooltip change, e.g. after the text has been
changed, they are now placed again.
2015-08-14 15:41:43 +02:00
Daniel Hahler 66c4ff7f2c doc: awful.placement.no_offscreen 2015-08-14 14:28:17 +02:00
Daniel Hahler b600b143b6 tooltip: re-add `no_offscreen` back to `place`
The tooltip might be partly outside of the screen, and especially the
workarea, e.g. for tooltips on the tasklist.

Calling `awful.placement.no_offscreen` makes sure that it is fully
inside, and will even restrict it to the workarea, not only to the screen.

Closes https://github.com/awesomeWM/awesome/pull/409.
2015-08-14 14:28:06 +02:00
Daniel Hahler b33cffd851 doc: textbox:set_markup: link to Pango markup documentation 2015-08-13 16:13:22 +02:00
Grigory Mischenko d2407c3de1 Widget opacity: draw with alpha only if transparent 2015-08-13 12:26:43 +03:00
kindlycat 03663fe778 Add "opacity" property for widgets 2015-08-12 22:31:06 +00:00
Daniel Hahler f8ad2cd152 Merge pull request #320 from blueyed/widget-handle-non-int-geom
Drawin: handle non-integer margins / geometry

Closes https://github.com/awesomeWM/awesome/pull/320.
2015-08-12 16:38:33 +02:00
Daniel Hahler 57ec268b8e tasklist: handle transient_for with skip_taskbar clients
Ref: https://github.com/awesomeWM/awesome/issues/182
2015-08-12 14:31:16 +02:00
Daniel Hahler 1aa1c8052d Add client.get_transient_for_matching and .is_transient_for 2015-08-12 14:31:16 +02:00
Daniel Hahler 11473aa490 Use awful.util.round in beautiful.xresources.apply_dpi 2015-08-12 14:18:57 +02:00
Daniel Hahler fe235b7fb7 awful.wibox: round x/y/width/height wibox arguments
Ref: https://github.com/awesomeWM/awesome/pull/320#issuecomment-130212116
2015-08-12 14:14:14 +02:00
Daniel Hahler f5ed8848e7 Use awful.util.round in wibox.layout.flex 2015-08-12 14:10:10 +02:00
Daniel Hahler 977bd9a60e Add awful.util.round 2015-08-12 14:09:45 +02:00
Daniel Hahler 9cbab8fa08 Merge pull request #388 from blueyed/placement-next-to-mouse
Add placement.next_to_mouse, use it for tooltips.

Closes https://github.com/awesomeWM/awesome/pull/388.
2015-08-12 13:23:31 +02:00
Daniel Hahler 251673f8b2 tooltip: use new next_to_mouse placement
This should take care of not placing the tooltip outside of the screen
already, so the call to `awful.placement.no_offscreen` can be skipped.
2015-08-12 13:22:59 +02:00
Daniel Hahler 9803af1b1f Add awful.placement.next_to_mouse 2015-08-12 13:22:59 +02:00
Uli Schlachter 1ebc34b5e9 Widgets: Also add a context argument to :fit()
Together with the context argument to :draw(), this even allows widgets to have
DPI-dependant size.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 11:19:48 +02:00
Uli Schlachter 88b98789a0 Rename the first argument to :draw to "context"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 11:19:28 +02:00
Uli Schlachter 31b69dbe1a drawable: Use a context table as first argument to :draw()
This table contains the drawable, wibox and titlebar that we are drawing on, but
also includes the screen and the DPI of that screen. This allows widgets to
depend on the DPI in their rendering.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 11:17:48 +02:00
Uli Schlachter e5a9eef157 Widget drawing: Add a traceback on errors
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 11:17:48 +02:00
Uli Schlachter d122b825ee gears.timer: Fix the traceback on errors
With the second argument being 2, the traceback will not include the error
handling function, but instead end at the actual place of the error.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 11:17:48 +02:00
Uli Schlachter 3685077291 rect_to_device_geometry: Use gears.matrix.transform_rectangle
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 10:38:22 +02:00
Uli Schlachter 19b9bfc46e Move wibox.layout.rect_to_device_geometry to wibox.widget
Having two modules named "base" is confusing and "wibox.layout" doesn't contain
much useful stuff. This is a first step for removing wibox.layout by moving a
function which should only ever be used internally in awesome.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 10:38:22 +02:00
Uli Schlachter 16a1ef0f48 Add gears.matrix for working with cairo matrices
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 10:38:22 +02:00
Uli Schlachter 74276b3a11 gears.timer: Add a note about GC'ing timers
Ref: https://github.com/awesomeWM/awesome/issues/216

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:54:58 +02:00
Uli Schlachter 0367af2be9 gears.timer: Add simpler ways to start timers
This adds gears.timer.start(timeout, callback) that creates a timer object and
connects a callback to it, all in one go.

Additionally, this adds gears.timer.weak_start(timeout, callback). The weak
version still allows the callback function to be garbage collected and will then
stop the timer.

This was tested with the following code:

  require("gears.timer").start(0.3, function()
    print("ping")
    if collectgarbage("step", 500) then
      print("collection done")
      error("err")
    end
    return true end)
  require("gears.timer").weak_start(0.1, function()
    io.stdout:write(".")
    return true
  end)

After a full collection cycle, both timers are stopped. The first one is stopped
because of the error() that it generated. The second one is stopped because the
callback function was garbage collected.

Ref: https://github.com/awesomeWM/awesome/issues/216

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-12 09:54:55 +02:00
Uli Schlachter a166f86864 Merge branch 'keyboardlayout_no_layout_entry' of https://github.com/psychon/awesome 2015-08-12 09:40:12 +02:00
actionless b47eabf4f0 feat(lib: awful: layout: suit: tile): add 'resize_jump_to_corner' 2015-08-12 00:12:15 +02:00
Daniel Hahler e47773933c Bump required lgi version to 0.7.1
Ref: https://github.com/pavouk/lgi/issues/41
Ref: https://github.com/awesomeWM/awesome/pull/392
2015-08-11 19:08:35 +02:00
Uli Schlachter 008cae50b2 awful.widget.keyboardlayout: Rename private members
I'm working on something that adds :layout functions to widgets. This clashes
with the keyboardlayout widget's use of an entry with this name. This change
adds an underscore as a prefix to the private data members of the
keyboardlayout.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-11 12:44:48 +02:00
Daniel Hahler 68b0fa243f Add "visible" property for widgets
Widgets with `visible = false` will not be drawn.

Closes https://github.com/awesomeWM/awesome/pull/326.
2015-08-10 23:09:07 +02:00
actionless d5818d0e1a feat(lib: awful: layout: suit: floating): add 'resize_jump_to_corner' 2015-08-07 18:50:08 +02:00
Daniel Hahler b028a0ba1d xresources.apply_dpi: use "round" instead of "ceil"
Given an outcome of e.g. 1.01 its more sane to use 1 than 2, especially
for `border_width`.

This uses the method from `wibox.layout.flex`.

Closes https://github.com/awesomeWM/awesome/pull/389.
2015-08-04 20:48:17 +02:00
Daniel Hahler 9883d3484d titlebar: add tooltips for icon buttons
This uses the button name in the tooltip's text.
2015-08-02 15:36:54 +02:00
Daniel Hahler 14e63fbcd7 awful.tooltip: do not hide when entering its wibox
Because of `placement.under_mouse` (and without
`placement.no_offscreen` fixing it), this will cause the tooltip to hide
immediately again.

There is no need for hooking into this signal, but this adds a click
handler to close the tooltip when clicking into it.
2015-08-02 15:36:54 +02:00
Daniel Hahler a8d224ef5c doc: fix for set_markup 2015-08-02 15:36:54 +02:00
Daniel Hahler 6880835c26 tooltip: delay_show: stop timer, handle (non-)stopped timers
This splits the logic for `delay_show` out of `show`/`hide`, and handles
an already stopped timer.  The timer gets also stopped after the tooltip
has been displayed.

Ref: https://github.com/awesomeWM/awesome/issues/371.
2015-08-02 15:36:54 +02:00
Daniel Hahler 9bcd87c727 awful.tooltip: skip set_geometry if not visible
`set_geometry` will be called in `show`, and is not necessary when the
tooltip is not visible.
2015-08-02 15:36:54 +02:00
Daniel Hahler 5b60bc212a textbox.set_markup: handle `parsed.message` from Pango.parse_markup
Ref: https://github.com/pavouk/lgi/issues/115
Fixes: https://github.com/awesomeWM/awesome/issues/301
2015-08-01 18:25:10 +02:00
Daniel Hahler 0ea2bbb126 awful.menu: use beautiful.xresources.apply_dpi for margins 2015-08-01 17:47:51 +02:00
Daniel Hahler 5c78cf07fc naughty: use beautiful.xresources.apply_dpi for margin and border 2015-08-01 17:47:43 +02:00
Daniel Hahler 4a3589aad4 widget.common.list_update: improve margins (dpi / imagebox)
Use `beautiful.xresources.apply_dpi` for `common.list_update`'s textbox
margins, and add a left margin for the imagebox, too.

The latter is useful/nicer with the default behavior of an inverted
style for the focused tasklist entry.
2015-08-01 17:39:48 +02:00
Daniel Hahler 09dce08fd4 gears.debug: add support for limited depth
This is useful with big tables and might even be necessary to prevent
infinite recursion.

To prevent the latter, the default is 10.

This adds an indicator when `depth` is reached for tables.

    awesome# return require("gears").debug.dump_return(t4, "", 2)
       string " : table: 0x1580130
      1 : table: 0x16951d0
        1 : wibox.widget.base (table) […]
        2 : wibox.widget.base (table) […]
        3 : 4 (number)
        4 : 5 (number)
        5 : foo (string)
      2 : table: 0x16ac790
        1 : table: 0x16951d0 (table) […]
      3 : table: 0x16cc500
        1 : table: 0x16951d0 (table) […]
        2 : table: 0x16ac790 (table) […]"

    awesome# return require("gears").debug.dump_return(t4, "", 1)
       string " : table: 0x1580130
      1 : table: 0x16951d0 (table) […]
      2 : table: 0x16ac790 (table) […]
      3 : table: 0x16cc500 (table) […]"

Closes https://github.com/awesomeWM/awesome/pull/372.
2015-08-01 11:24:35 +02:00
Daniel Hahler 896ab0a286 Merge pull request #376 from blueyed/more-tostring
More tostring metamethods for drawable and wibox
2015-08-01 11:22:04 +02:00
Daniel Hahler d3b682f2b6 wibox: add __tostring metamethod 2015-08-01 11:21:50 +02:00
Daniel Hahler 430e8664be wibox.drawable: add __tostring meta method 2015-08-01 11:21:50 +02:00
Daniel Hahler fa6b7c390f make_widget: keep original "tostring" value in parenthesis
This provides the usual table ID, which can be useful during debugging.
2015-08-01 11:21:50 +02:00
Daniel Hahler 9494f3f0c3 Merge pull request #377 from blueyed/naughty-focused-screen
Naughty: default to focused screen
2015-08-01 11:19:11 +02:00
Daniel Hahler 475b469f96 doc: tooltip: add type/optional information
Closes https://github.com/awesomeWM/awesome/pull/379.
2015-08-01 11:14:06 +02:00
actionless 95743683fe style(lib: awful: tag): fix docs 2015-07-30 09:22:26 +02:00
Abdo Roig-Maranges 3942672d31 Fix missing parenthesis to a call of screen.focused
Closes https://github.com/awesomeWM/awesome/pull/370.
2015-07-29 18:47:34 +02:00
Daniel Hahler 861cfc5915 wibox.widget.textbox: skip setting unchanged layout properties
In case the text, markup or other layout properties have not changed, there's
no need to update the widget.

Based on 5a2a5d03d3/lib/wibox/widget/textbox.lua.
Closes https://github.com/awesomeWM/awesome/pull/335.
2015-07-29 01:20:23 +02:00
Uli Schlachter 0713e2e50d Add a missing "_" in "__newindex"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-07-28 21:29:05 +02:00
Daniel Hahler b08d3caba8 awful.widget.layoutbox: add tooltip with the layout's name
Closes https://github.com/awesomeWM/awesome/pull/322.
2015-07-28 19:31:26 +02:00
Daniel Hahler 355e4696ba Preserve old mousegrabber behavior (additionally)
18f6ab1 changed the behavior when resizing floating clients using the
mouse (via modkey + RMB).

Previously, you could initiate the mousegrabber using e.g. "modkey +
RMB", release the key and button, and resize the window using the left
mouse button.

This restores this behavior by canceling the mousegrabbers only if the
cursor was moved, without _any_ mouse button being pressed.

Fixes https://github.com/awesomeWM/awesome/issues/309.
Closes https://github.com/awesomeWM/awesome/pull/310.
2015-07-28 13:09:50 +02:00
Daniel Hahler 904b7a88ee doc: overhaul naughty documentation 2015-07-27 15:54:47 +02:00