2009-08-20 16:18:52 +02:00
|
|
|
--- awesome keygrabber API
|
|
|
|
-- @author Julien Danjou <julien@danjou.info>
|
|
|
|
-- @copyright 2008-2009 Julien Danjou
|
2014-05-20 00:22:35 +02:00
|
|
|
-- @module keygrabber
|
2009-08-20 16:18:52 +02:00
|
|
|
|
2012-02-21 15:55:55 +01:00
|
|
|
---
|
2014-08-28 19:45:46 +02:00
|
|
|
-- Grab keyboard input and read pressed keys, calling a callback function at
|
2014-05-20 00:22:35 +02:00
|
|
|
-- each keypress, until `keygrabber.stop` is called.
|
2014-08-28 19:45:46 +02:00
|
|
|
-- The callback function receives three arguments:
|
|
|
|
-- <ul>
|
|
|
|
-- <li>a table containing modifiers keys</li>
|
|
|
|
-- <li>a string with the pressed key</li>
|
|
|
|
-- <li>a string with either "press" or "release" to indicate the event type.</li>
|
|
|
|
-- </ul>
|
2012-02-21 15:55:55 +01:00
|
|
|
-- @param callback A callback function as described above.
|
2014-05-20 00:22:35 +02:00
|
|
|
-- @function run
|
|
|
|
-- @usage The following function can be bound to a key, and will be used to
|
|
|
|
-- resize a client using keyboard.
|
|
|
|
--
|
|
|
|
-- function resize(c)
|
|
|
|
-- keygrabber.run(function(mod, key, event)
|
|
|
|
-- if event == "release" then return end
|
2011-01-16 18:44:59 +01:00
|
|
|
--
|
2014-05-20 00:22:35 +02:00
|
|
|
-- if key == 'Up' then awful.client.moveresize(0, 0, 0, 5, c)
|
|
|
|
-- elseif key == 'Down' then awful.client.moveresize(0, 0, 0, -5, c)
|
|
|
|
-- elseif key == 'Right' then awful.client.moveresize(0, 0, 5, 0, c)
|
|
|
|
-- elseif key == 'Left' then awful.client.moveresize(0, 0, -5, 0, c)
|
|
|
|
-- else keygrabber.stop()
|
|
|
|
-- end
|
|
|
|
-- end)
|
2014-08-28 19:45:46 +02:00
|
|
|
-- end
|
2009-08-20 16:18:52 +02:00
|
|
|
|
|
|
|
--- Stop grabbing the keyboard.
|
2014-05-20 00:22:35 +02:00
|
|
|
-- @function stop
|
2012-08-11 23:55:26 +02:00
|
|
|
|
|
|
|
--- Check if the keygrabber is running.
|
|
|
|
-- @return A boolean value, true if running, false otherwise.
|
2014-05-20 00:22:35 +02:00
|
|
|
-- @function isrunning
|