move to backup
This commit is contained in:
parent
294dc66380
commit
a0e3d792a9
182 changed files with 156 additions and 103 deletions
78
bak/modules/wezterm/config/helpers.lua
Normal file
78
bak/modules/wezterm/config/helpers.lua
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
local wezterm = require("wezterm")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.project_dir()
|
||||
return wezterm.home_dir .. "/dev"
|
||||
end
|
||||
|
||||
function M.project_dirs()
|
||||
local projects = { wezterm.home_dir }
|
||||
|
||||
for _, dir in ipairs(wezterm.glob(M.project_dir() .. "/*")) do
|
||||
table.insert(projects, dir)
|
||||
end
|
||||
|
||||
table.insert(projects, wezterm.home_dir .. "/notes")
|
||||
|
||||
return projects
|
||||
end
|
||||
|
||||
function M.get_outdated_packages()
|
||||
local success, stdout, stderr =
|
||||
wezterm.run_child_process({ "sh", "-c", "/opt/homebrew/bin/brew outdated -q | wc -l" })
|
||||
|
||||
if success ~= true then
|
||||
wezterm.log_error(stderr)
|
||||
|
||||
return "X"
|
||||
end
|
||||
|
||||
return stdout:gsub("%s+", "")
|
||||
end
|
||||
|
||||
function M.get_primary_battery_state()
|
||||
local battery_info = wezterm.battery_info()
|
||||
|
||||
return string.format("%.0f%%", battery_info[1].state_of_charge * 100)
|
||||
end
|
||||
|
||||
function M.get_padding(padding, remove_padding_bottom)
|
||||
return {
|
||||
left = padding,
|
||||
right = padding,
|
||||
top = padding,
|
||||
bottom = padding - remove_padding_bottom,
|
||||
}
|
||||
end
|
||||
|
||||
function M.move_pane(key, direction)
|
||||
return {
|
||||
key = key,
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.ActivatePaneDirection(direction),
|
||||
}
|
||||
end
|
||||
|
||||
function M.get_is_zoomed(for_window)
|
||||
local tab = for_window:active_tab()
|
||||
local panes_info = tab:panes_with_info()
|
||||
|
||||
for _, pane_info in ipairs(panes_info) do
|
||||
if pane_info.is_active then
|
||||
return pane_info.is_zoomed
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_zoomed_status(for_window)
|
||||
local is_zoomed = M.get_is_zoomed(for_window)
|
||||
|
||||
if is_zoomed then
|
||||
return "[Z]"
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
return M
|
||||
Loading…
Add table
Add a link
Reference in a new issue