2021-09-20 17:46:38 +06:00
|
|
|
-- Copyright (c) 2020-2021 shadmansaleh
|
|
|
|
-- MIT license, see LICENSE for more details.
|
2021-09-25 23:15:42 +06:00
|
|
|
local M = require('lualine.component'):extend()
|
2021-04-11 14:20:41 +06:00
|
|
|
|
2021-09-25 23:15:42 +06:00
|
|
|
M.update_status = function(self, is_focused)
|
2021-04-13 23:09:01 +06:00
|
|
|
-- 1st element in options table is the function provided by config
|
2021-09-03 18:19:00 +06:00
|
|
|
local ok, retval
|
|
|
|
ok, retval = pcall(self.options[1], self, is_focused)
|
2021-09-04 00:28:20 +06:00
|
|
|
if not ok then
|
|
|
|
return ''
|
|
|
|
end
|
2021-09-03 18:19:00 +06:00
|
|
|
if type(retval) ~= 'string' then
|
|
|
|
ok, retval = pcall(tostring, retval)
|
2021-09-04 00:28:20 +06:00
|
|
|
if not ok then
|
|
|
|
return ''
|
|
|
|
end
|
2021-09-03 18:19:00 +06:00
|
|
|
end
|
|
|
|
return retval
|
2021-04-11 14:20:41 +06:00
|
|
|
end
|
|
|
|
|
2021-09-25 23:15:42 +06:00
|
|
|
return M
|