-
Hi there, I know that a shell command wezterm.on("update-right-status", function(window, pane)
local date = wezterm.strftime("%a %b %-d %H:%M:%S %Y ");
local bat = ""
local _, sftime, _ = wezterm.run_child_process({"date"});
for _, b in ipairs(wezterm.battery_info()) do
bat = "🔋 " .. string.format("%.0f%%", b.state_of_charge * 100)
end
window:set_right_status(wezterm.format({
{Text=bat .. " Local: "..date.."| US/Pacific: "..sftime},
}));
end) So either how to do that with |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Lua only reports the time of the operating system. The time docs are here: http://www.lua.org/manual/5.2/manual.html#pdf-os.date You could take that time as UTC and add the offset for US/Pacific -7: os.date("!%a %b %d %H:%M:%S %Y ", os.time() - 7 * 60 * 60) But that doesn't adjust for different summer time offsets if any. For a more complete Lua solution you could install a Lua module like: https://github.com/daurnimator/luatz For the wezterm.run_child_process({"/bin/sh", "-c", "TZ=US/Pacific date"}); |
Beta Was this translation helpful? Give feedback.
-
I think it's a reasonable feature request for |
Beta Was this translation helpful? Give feedback.
Lua only reports the time of the operating system. The time docs are here: http://www.lua.org/manual/5.2/manual.html#pdf-os.date
You could take that time as UTC and add the offset for US/Pacific -7:
But that doesn't adjust for different summer time offsets if any. For a more complete Lua solution you could install a Lua module like: https://github.com/daurnimator/luatz
For the
date
command you could try this: