mirror of https://github.com/lcpz/lain.git
helpers: async_with_shell added
This commit is contained in:
parent
5f1d675dfa
commit
d99ce8fdba
|
@ -5,7 +5,7 @@ Lain
|
||||||
Layouts, widgets and utilities for Awesome WM 4.x
|
Layouts, widgets and utilities for Awesome WM 4.x
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
:Author: Luca CPZ <dada [at] archlinux [dot] info>
|
:Author: Luca CPZ
|
||||||
:Version: git
|
:Version: git
|
||||||
:License: GNU-GPL2_
|
:License: GNU-GPL2_
|
||||||
:Source: https://github.com/lcpz/lain
|
:Source: https://github.com/lcpz/lain
|
||||||
|
@ -13,7 +13,7 @@ Layouts, widgets and utilities for Awesome WM 4.x
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Successor of awesome-vain_, this module provides alternative layouts, asynchronous widgets and utility functions for Awesome_ WM. Read the wiki_ for all the info.
|
Successor of awesome-vain_, this module provides alternative layouts, asynchronous widgets and utility functions for Awesome_. Read the wiki_ for all the info.
|
||||||
|
|
||||||
Contributions
|
Contributions
|
||||||
-------------
|
-------------
|
||||||
|
|
12
helpers.lua
12
helpers.lua
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local easy_async = require("awful.spawn").easy_async
|
local spawn = require("awful.spawn")
|
||||||
local timer = require("gears.timer")
|
local timer = require("gears.timer")
|
||||||
local debug = require("debug")
|
local debug = require("debug")
|
||||||
local io = { lines = io.lines,
|
local io = { lines = io.lines,
|
||||||
|
@ -110,7 +110,15 @@ end
|
||||||
-- @param callback function to execute on cmd output
|
-- @param callback function to execute on cmd output
|
||||||
-- @return cmd PID
|
-- @return cmd PID
|
||||||
function helpers.async(cmd, callback)
|
function helpers.async(cmd, callback)
|
||||||
return easy_async(cmd,
|
return spawn.easy_async(cmd,
|
||||||
|
function (stdout, stderr, reason, exit_code)
|
||||||
|
callback(stdout)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- like above, but call spawn.easy_async with a shell
|
||||||
|
function helpers.async_with_shell(cmd, callback)
|
||||||
|
return spawn.easy_async_with_shell(cmd,
|
||||||
function (stdout, stderr, reason, exit_code)
|
function (stdout, stderr, reason, exit_code)
|
||||||
callback(stdout)
|
callback(stdout)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -12,7 +12,7 @@ description = {
|
||||||
Optional dependency: curl (for IMAP, MPD and weather widgets).
|
Optional dependency: curl (for IMAP, MPD and weather widgets).
|
||||||
]],
|
]],
|
||||||
homepage = "https://github.com/lcpz/lain",
|
homepage = "https://github.com/lcpz/lain",
|
||||||
license = "GPL v2"
|
license = "GPL-2.0"
|
||||||
}
|
}
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"lua >= 5.1",
|
"lua >= 5.1",
|
||||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
||||||
Subproject commit d9029707520bf9ce8e3f695659d8ceea4fef0f01
|
Subproject commit f395683e491fabd539fa0b5d596dbb5cc451e68e
|
Loading…
Reference in New Issue