Commit Graph

6784 Commits

Author SHA1 Message Date
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 aec751f0ea Merge pull request #483 from blueyed/Elv13-prompt_hook_v2
Prompt hook v2
2015-11-08 15:13:49 +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
Uli Schlachter 6f2424e901 Enable detectable autorepeat (#550)
Imagine the following snippet is run:

    keygrabber.run(function(mod, key, event)
      gears.debug.dump{mod, key, event}
    end)

The above starts a keygrabber and prints the events that are received.
Currently, when a key is pressed and held down, this prints a series of press
and release, because that's what the X11 server sends us.

This commit enables detectable autorepeat. This means that the X11 server only
sends us a series of press events for autorepeat and a single release when the
key really is released.

Testing this is a bit hard, because detectable autorepeat does not seem to work
with Xephyr. Instead, a "real" Xorg instance is needed.

We do not check the response to the PerClientFlags request, because it doesn't
really tell us anything useful. If the server does not support detectable
autorepeat, we could print a warning, but so what? As I just said, this does not
work in Xephyr and yet Xephyr announced to support this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-07 12:45:04 +01:00
Uli Schlachter e279d68670 xkb.c: Remove trailing whitespace
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-07 12:27:35 +01:00
Uli Schlachter 10daa6b09e xkb: Don't use _checked() requests
In XCB, each request has a checked and an unchecked version. The checked version
can be used to check if the request caused any errors. Since the code here
doesn't do this check, it shouldn't use the checked versions of the requests.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-07 12:24:21 +01:00
Daniel Hahler bef7dfad47 Merge pull request #544 from blueyed/client-snid-should-be-nil-without-snid
c.startup_id should be nil when launched without startup notification support
2015-11-05 23:24:54 +01:00
Daniel Hahler 83ed65212d Merge pull request #531 from psychon/property_geometry
Property geometry

Closes https://github.com/awesomeWM/awesome/pull/531.
2015-11-05 23:08:02 +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 339e2b0ecc Add failing test: c.startup_id should be nil when snid is disabled
When using `spawn` without startup notification support, the
`startup_id` property on the client should be nil.

This adds rxvt-unicode to the Travis build, because it supports startup
notifications, but xterm does not.  We should replace xterm with it in
the existing tests then later.
2015-11-05 23:03:59 +01:00
Uli Schlachter 9afb2578f8 Spawn: Improve handling of startup notification
The ID for startup notification is transmitted to the spawned process via the
DESKTOP_STARTUP_ID environment variable. Before this commit, we set this
variable in the main process. This meant that if we started something "without"
a startup id, then it might get the ID that was used by the last spawn and which
was still saved in our env. Fix this by setting the environment variable only
after fork().

Small anecdote: The above wasn't enough to make Daniel's test case succeed and
at first I couldn't figure out why.

Turns out that rxvt-unicode doesn't unset the DESKTOP_STARTUP_ID environment
variable (I think it should, according to some spec), even though it supports
startup notification. So awesome was already started with DESKTOP_STARTUP_ID set
and thus all spawned processes used this ID.

Fix this by explicitly unsetting DESKTOP_STARTUP_ID if we don't set any new
value (even though this breaks encapsulation; we shouldn't have to care about
this "implementation detail" of libstartup-notification).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-05 23:02:20 +01:00
Daniel Hahler c4d21d5f12 Travis: use dist=trusty
http://blog.travis-ci.com/2015-10-14-opening-up-ubuntu-trusty-beta/

 - Use apt-get install -y, and not -qq.
 - Fix LUAROCKS_ARGS for Trusty.
 - Installing libxcb-cursor-dev, libxcb-xkb-dev, libxkbcommon-x11-dev
   and libxkbcommon-dev via apt-get.
 - Use before_install to set LUAINCLUDE
 - Cleanup the apt-get install block.
 - Use travis_retry with 'luarocks install' and 'wget'.

Ref: https://github.com/travis-infrastructure/packer-templates/issues/42.
Closes: https://github.com/awesomeWM/awesome/pull/533.
2015-11-05 23:01:17 +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 9b3558899b travis-apidoc: swap 'relevant' and 'boilerplate' commits 2015-10-30 00:02:19 +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
Daniel Hahler b655b74cb9 travis-apidoc.sh: fix diff -I pattern for h2
`diff -I` appears to match the parentheses as-is.

It should not have been triggered for
https://travis-ci.org/awesomeWM/awesome/jobs/87792709#L3334.
2015-10-28 01:23:25 +01:00
Emmanuel Lepage Vallée 48a57055dc Merge pull request #542 from awesomeWM/actionless_keybindings
feat(awesomerc): add descriptions for some keybindings
2015-10-27 20:08:05 -04:00
actionless b9db1d032a feat(awesomerc): add descriptions for some keybindings 2015-10-27 19:52:39 -04: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
Kazunobu Kuriyama 4db998fdf2 Accept keysym/unicode symbols on keys
This is an enhancement to make non-ASCII symbol keys usable for
implementation and configuration of Awesome.

The enhancement was proposed and had been developed under the
initiative of Daniel Hahler.  Thanks to his sharing of his results with our
community, we gradually deepened our understanding on the issue.  This
commit is the fruit his enthusiasm spawned.

Closes https://github.com/awesomeWM/awesome/pull/538.
2015-10-26 23:00:15 +01:00
Daniel Hahler 035e905836 awesomerc.lua: remove trailing whitespace 2015-10-22 23:57:47 +02: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
Uli Schlachter 532ec0cd90 Grab client keys on the client window (#496)
Before this, we grabbed the keys on the frame window. That meant we only got key
events for things that nothing else grabbed directly on the key window.

After this, we grab directly on the client window itself and so we "fight" with
everything else which wants to grab keys. I don't actually know how the winner
is decided... First come, first serve, the rest gets an error?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-16 17:30:46 +02:00
Uli Schlachter 085bc00a24 Emit property::geometry only if something changed
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-14 19:40:18 +02:00
Uli Schlachter 438a10973b Add property::geometry to drawin/drawable [#411]
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-14 19:39:27 +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 60c21bfb4e Merge pull request #529 from blueyed/doc-fixes
Some more doc fixes

Closes https://github.com/awesomeWM/awesome/pull/529.
2015-10-14 16:25:01 +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 e7663e1ebd Some doc fixes 2015-10-14 13:57:38 +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