move to backup
This commit is contained in:
parent
294dc66380
commit
a0e3d792a9
182 changed files with 156 additions and 103 deletions
21
bak/modules/wezterm/config/appearance.lua
Normal file
21
bak/modules/wezterm/config/appearance.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local wezterm = require("wezterm")
|
||||
local helpers = require("helpers")
|
||||
local theme = require("theme")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.apply_to_config(config)
|
||||
config.color_schemes = {
|
||||
["dnsc"] = theme.colors,
|
||||
}
|
||||
config.color_scheme = "dnsc"
|
||||
config.font = wezterm.font("VictorMono Nerd Font", { weight = "DemiBold", stretch = "Normal", style = "Normal" })
|
||||
config.font_size = 18.5
|
||||
config.window_decorations = "RESIZE"
|
||||
config.window_padding = helpers.get_padding(20, 15)
|
||||
config.window_background_opacity = 0.97
|
||||
config.macos_window_background_blur = 30
|
||||
config.command_palette_font_size = 19
|
||||
end
|
||||
|
||||
return M
|
||||
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
|
||||
77
bak/modules/wezterm/config/keybindings.lua
Normal file
77
bak/modules/wezterm/config/keybindings.lua
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
local wezterm = require("wezterm")
|
||||
local helpers = require("helpers")
|
||||
local projects = require("projects")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.apply_to_config(config)
|
||||
config.leader = { key = "b", mods = "CTRL", timeout_milliseconds = 1000 }
|
||||
|
||||
config.keys = {
|
||||
-- Window/Pane Management
|
||||
{
|
||||
key = "|",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.SplitPane({ direction = "Left", size = { Percent = 40 } }),
|
||||
},
|
||||
{
|
||||
key = "-",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.SplitPane({ direction = "Down", size = { Percent = 30 } }),
|
||||
},
|
||||
{
|
||||
key = "x",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.CloseCurrentPane({ confirm = true }),
|
||||
},
|
||||
{
|
||||
mods = "LEADER",
|
||||
key = "z",
|
||||
action = wezterm.action.TogglePaneZoomState,
|
||||
},
|
||||
{
|
||||
mods = "LEADER",
|
||||
key = "u",
|
||||
action = wezterm.action.PaneSelect({
|
||||
mode = "SwapWithActive",
|
||||
}),
|
||||
},
|
||||
-- Navigation
|
||||
helpers.move_pane("j", "Down"),
|
||||
helpers.move_pane("k", "Up"),
|
||||
helpers.move_pane("h", "Left"),
|
||||
helpers.move_pane("l", "Right"),
|
||||
-- Workspaces
|
||||
{
|
||||
key = "s",
|
||||
mods = "LEADER",
|
||||
action = projects.choose(),
|
||||
},
|
||||
-- Misc
|
||||
{
|
||||
key = " ",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.ActivateCommandPalette,
|
||||
},
|
||||
{
|
||||
key = "v",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.ActivateCopyMode,
|
||||
},
|
||||
{
|
||||
key = "c",
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.SpawnTab("CurrentPaneDomain"),
|
||||
},
|
||||
}
|
||||
|
||||
for i = 1, 8 do
|
||||
table.insert(config.keys, {
|
||||
key = tostring(i),
|
||||
mods = "LEADER",
|
||||
action = wezterm.action.ActivateTab(i - 1),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
23
bak/modules/wezterm/config/overrides.lua
Normal file
23
bak/modules/wezterm/config/overrides.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
local wezterm = require("wezterm")
|
||||
local hn = wezterm.hostname()
|
||||
local helpers = require("helpers")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.apply_to_config(config)
|
||||
if hn == "dnsc-work" then
|
||||
config.window_background_opacity = 0.975
|
||||
config.font_size = 19
|
||||
end
|
||||
|
||||
if hn == "dnsc-machine" then
|
||||
config.font = wezterm.font("VictorMono Nerd Font", { weight = "DemiBold" })
|
||||
config.font_size = 15.5
|
||||
config.window_decorations = "NONE"
|
||||
config.window_padding = helpers.get_padding(18, 6)
|
||||
config.window_background_opacity = 0.94
|
||||
-- config.enable_wayland = false;
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
33
bak/modules/wezterm/config/projects.lua
Normal file
33
bak/modules/wezterm/config/projects.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
local wezterm = require("wezterm")
|
||||
local helpers = require("helpers")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.choose()
|
||||
local choices = {}
|
||||
|
||||
for _, value in ipairs(helpers.project_dirs()) do
|
||||
table.insert(choices, { label = value })
|
||||
end
|
||||
|
||||
return wezterm.action.InputSelector({
|
||||
title = "Projects",
|
||||
choices = choices,
|
||||
fuzzy = true,
|
||||
action = wezterm.action_callback(function(child_window, child_pane, _, label)
|
||||
if not label then
|
||||
return
|
||||
end
|
||||
|
||||
child_window:perform_action(
|
||||
wezterm.action.SwitchToWorkspace({
|
||||
name = label:match("([^/]+)$"),
|
||||
spawn = { cwd = label },
|
||||
}),
|
||||
child_pane
|
||||
)
|
||||
end),
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
28
bak/modules/wezterm/config/startup.lua
Normal file
28
bak/modules/wezterm/config/startup.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
local wezterm = require("wezterm")
|
||||
local mux = wezterm.mux
|
||||
local helpers = require("helpers")
|
||||
|
||||
local M = {}
|
||||
|
||||
wezterm.on("gui-startup", function(cmd)
|
||||
local args = {}
|
||||
if cmd then
|
||||
args = cmd.args
|
||||
end
|
||||
|
||||
-- WORKSPACES
|
||||
-- W: dennis
|
||||
local _, _, _ = mux.spawn_window({
|
||||
workspace = "dennis",
|
||||
cwd = wezterm.home_dir,
|
||||
args = args,
|
||||
})
|
||||
|
||||
mux.set_active_workspace("dennis")
|
||||
end)
|
||||
|
||||
function M.apply_to_config(config)
|
||||
return config
|
||||
end
|
||||
|
||||
return M
|
||||
60
bak/modules/wezterm/config/tab_bar.lua
Normal file
60
bak/modules/wezterm/config/tab_bar.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
local wezterm = require("wezterm")
|
||||
local helpers = require("helpers")
|
||||
local theme = require("theme")
|
||||
|
||||
local M = {}
|
||||
|
||||
local function get_elements(for_window)
|
||||
return {
|
||||
{ Background = { Color = theme.palette.bg } },
|
||||
{ Text = "h:" .. wezterm.hostname() .. " " },
|
||||
{ Text = "u:" .. helpers.get_outdated_packages() .. " " },
|
||||
{ Text = "b:" .. helpers.get_primary_battery_state() .. " " },
|
||||
{ Background = { Color = theme.palette.bg_secondary } },
|
||||
{ Text = " " .. helpers.get_zoomed_status(for_window) .. " " },
|
||||
{ Text = "s:" .. for_window:active_workspace() .. " " },
|
||||
}
|
||||
end
|
||||
|
||||
wezterm.on("update-right-status", function(window, _)
|
||||
window:set_right_status(wezterm.format(get_elements(window)))
|
||||
end)
|
||||
|
||||
function M.apply_to_config(config)
|
||||
config.enable_tab_bar = true
|
||||
config.use_fancy_tab_bar = true
|
||||
config.tab_bar_at_bottom = false
|
||||
|
||||
config.window_frame = {
|
||||
inactive_titlebar_bg = theme.palette.bg,
|
||||
active_titlebar_bg = theme.palette.bg,
|
||||
font = wezterm.font({ family = "Victor Mono", weight = "Bold" }),
|
||||
}
|
||||
|
||||
config.colors = {
|
||||
tab_bar = {
|
||||
active_tab = {
|
||||
bg_color = theme.palette.magenta_subtle_bg,
|
||||
fg_color = theme.palette.fg,
|
||||
},
|
||||
inactive_tab = {
|
||||
bg_color = theme.palette.bg,
|
||||
fg_color = theme.palette.grey,
|
||||
},
|
||||
inactive_tab_hover = {
|
||||
fg_color = theme.palette.fg,
|
||||
bg_color = theme.palette.bg,
|
||||
},
|
||||
new_tab = {
|
||||
bg_color = theme.palette.bg,
|
||||
fg_color = theme.palette.grey,
|
||||
},
|
||||
new_tab_hover = {
|
||||
bg_color = theme.palette.bg,
|
||||
fg_color = theme.palette.fg,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
65
bak/modules/wezterm/config/theme.lua
Normal file
65
bak/modules/wezterm/config/theme.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
local M = {}
|
||||
|
||||
local palette = {
|
||||
fg = "#ffffff",
|
||||
bg = "#0f0b15",
|
||||
bg_secondary = "#1d202f",
|
||||
grey = "#807c9f",
|
||||
grey_bright = "#807c9f",
|
||||
red = "#f47359",
|
||||
red_bright = "#ff6a7a",
|
||||
green = "#29a444",
|
||||
green_bright = "#00a392",
|
||||
yellow = "#b58a52",
|
||||
yellow_bright = "#df9080",
|
||||
blue = "#3f95f6",
|
||||
blue_bright = "#029fff",
|
||||
magenta = "#d369af",
|
||||
magenta_bright = "#af85ea",
|
||||
magenta_subtle_bg = "#572454",
|
||||
cyan = "#4fbaef",
|
||||
cyan_bright = "#35afbf",
|
||||
silver = "#b8c6d5",
|
||||
silver_bright = "#ffffff",
|
||||
}
|
||||
|
||||
M.palette = palette
|
||||
|
||||
M.colors = {
|
||||
foreground = palette.fg,
|
||||
background = palette.bg,
|
||||
|
||||
cursor_bg = palette.magenta,
|
||||
cursor_fg = palette.fg,
|
||||
cursor_border = palette.magenta,
|
||||
|
||||
selection_fg = palette.magenta_bright,
|
||||
selection_bg = palette.magenta_subtle_bg,
|
||||
|
||||
scrollbar_thumb = palette.bg_secondary,
|
||||
split = palette.bg_secondary,
|
||||
|
||||
ansi = {
|
||||
palette.bg,
|
||||
palette.red,
|
||||
palette.green,
|
||||
palette.yellow,
|
||||
palette.blue,
|
||||
palette.magenta,
|
||||
palette.cyan,
|
||||
palette.silver,
|
||||
},
|
||||
|
||||
brights = {
|
||||
palette.grey_bright,
|
||||
palette.red_bright,
|
||||
palette.green_bright,
|
||||
palette.yellow_bright,
|
||||
palette.blue_bright,
|
||||
palette.magenta_bright,
|
||||
palette.cyan_bright,
|
||||
palette.silver_bright,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
21
bak/modules/wezterm/config/wezterm.lua
Normal file
21
bak/modules/wezterm/config/wezterm.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
local wezterm = require("wezterm")
|
||||
local appearance = require("appearance")
|
||||
local tab_bar = require("tab_bar")
|
||||
local startup = require("startup")
|
||||
local keybindings = require("keybindings")
|
||||
local overrides = require("overrides")
|
||||
|
||||
local config = {}
|
||||
|
||||
if wezterm.config_builder then
|
||||
---@diagnostic disable-next-line: lowercase-global
|
||||
config = wezterm.config_builder()
|
||||
end
|
||||
|
||||
appearance.apply_to_config(config)
|
||||
tab_bar.apply_to_config(config)
|
||||
startup.apply_to_config(config)
|
||||
keybindings.apply_to_config(config)
|
||||
overrides.apply_to_config(config)
|
||||
|
||||
return config
|
||||
Loading…
Add table
Add a link
Reference in a new issue