buncha things

master
Felix Pankratz 6 months ago
parent 8ca661cd95
commit cc6a54b8f2

@ -1,18 +1,9 @@
-- Pull in the wezterm API
local wezterm = require 'wezterm' local wezterm = require 'wezterm'
-- This will hold the configuration.
local config = wezterm.config_builder() local config = wezterm.config_builder()
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
config.color_scheme = 'Argonaut (Gogh)'
-- keybinds -- keybinds
config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 } config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 }
config.keys = { config.keys = {
-- splitting
{ {
mods = "LEADER|SHIFT", mods = "LEADER|SHIFT",
key = '"', key = '"',
@ -60,6 +51,21 @@ config.keys = {
mods = 'ALT', mods = 'ALT',
action = wezterm.action.ScrollToPrompt(1) action = wezterm.action.ScrollToPrompt(1)
}, },
{
key = 'c',
mods = 'LEADER',
action = wezterm.action.ScrollToPrompt(1)
},
{
key = 'n',
mods = 'LEADER',
action = wezterm.action.SwitchWorkspaceRelative(1)
},
{
key = 'p',
mods = 'LEADER',
action = wezterm.action.SwitchWorkspaceRelative(-1)
},
} }
config.mouse_bindings = { config.mouse_bindings = {
@ -70,16 +76,204 @@ config.mouse_bindings = {
} }
} }
-- stylin'
local color = (function()
local COLOR = require "colors"
local coolors = {
COLOR.VERIDIAN,
COLOR.PAYNE,
COLOR.INDIGO,
COLOR.CAROLINA,
COLOR.FLAME,
COLOR.JET,
COLOR.TAUPE,
COLOR.ECRU,
COLOR.VIOLET,
COLOR.VERDIGRIS
}
return coolors[math.random(#coolors)]
end)()
local color_primary = color
local title_color_bg = color_primary.bg
local title_color_fg = color_primary.fg
local color_off = title_color_bg:lighten(0.4)
local color_on = color_off:lighten(0.4)
wezterm.on('update-right-status', function(window)
local bat = ''
local b = wezterm.battery_info()[1]
bat = wezterm.format {
{ Foreground = {
Color =
b.state_of_charge > 0.2 and color_on or color_off,
} },
{ Text = '' },
{ Foreground = {
Color =
b.state_of_charge > 0.4 and color_on or color_off,
} },
{ Text = '' },
{ Foreground = {
Color =
b.state_of_charge > 0.6 and color_on or color_off,
} },
{ Text = '' },
{ Foreground = {
Color =
b.state_of_charge > 0.8 and color_on or color_off,
} },
{ Text = '' },
{ Background = {
Color =
b.state_of_charge > 0.98 and color_on or color_off,
} },
{ Foreground = {
Color =
b.state == "Charging"
and color_on:lighten(0.3):complement()
or
(b.state_of_charge < 0.2 and wezterm.GLOBAL.count % 2 == 0)
and color_on:lighten(0.1):complement()
or color_off:darken(0.1)
} },
{ Text = '' },
}
local time = wezterm.strftime '%k:%M '
local bg1 = title_color_bg:lighten(0.1)
local bg2 = title_color_bg:lighten(0.2)
window:set_right_status(
wezterm.format {
{ Background = { Color = title_color_bg } },
{ Foreground = { Color = bg1 } },
{ Text = '' },
{ Background = { Color = title_color_bg:lighten(0.1) } },
{ Foreground = { Color = title_color_fg } },
{ Text = ' ' .. window:active_workspace() .. ' ' },
{ Foreground = { Color = bg1 } },
{ Background = { Color = bg2 } },
{ Text = '' },
{ Foreground = { Color = title_color_bg:lighten(0.4) } },
{ Foreground = { Color = title_color_fg } },
{ Text = ' ' .. time .. ' ' .. bat }
}
)
end)
wezterm.on('gui-startup', function(cmd)
local mux = wezterm.mux
local padSize = 80
local screenWidth = 1920
local screenHeight = 1080
local tab, pane, window = mux.spawn_window(cmd or {
workspace = 'main',
})
if window ~= nil then
window:gui_window():set_position(padSize, padSize)
window:gui_window():set_inner_size(screenWidth - (padSize * 2), screenHeight - (padSize * 2) - 48)
end
end)
local TAB_EDGE_LEFT = wezterm.nerdfonts.ple_left_half_circle_thick
local TAB_EDGE_RIGHT = wezterm.nerdfonts.ple_right_half_circle_thick
local function tab_title(tab_info)
local title = tab_info.tab_title
local icon = tab_info.active_pane.user_vars.ICON
if icon then
return icon .. ' ' .. tab_info.active_pane.title:gsub("%.exe", ""):gsub("panki: ", "")
else
return tab_info.active_pane.title:gsub("%.exe", ""):gsub("panki: ", "")
end
end
wezterm.on(
'format-tab-title',
function(tab, _, _, _, hover, max_width)
local edge_background = title_color_bg
local background = title_color_bg:lighten(0.05)
local foreground = title_color_fg
if tab.is_active then
background = background:lighten(0.1)
foreground = foreground:lighten(0.1)
elseif hover then
background = background:lighten(0.2)
foreground = foreground:lighten(0.2)
end
local edge_foreground = background
local title = tab_title(tab)
-- ensure that the titles fit in the available space,
-- and that we have room for the edges.
title = wezterm.truncate_right(title, max_width - 2)
return {
{ Background = { Color = edge_background } },
{ Foreground = { Color = edge_foreground } },
{ Text = TAB_EDGE_LEFT },
{ Background = { Color = background } },
{ Foreground = { Color = foreground } },
{ Text = title },
{ Background = { Color = edge_background } },
{ Foreground = { Color = edge_foreground } },
{ Text = TAB_EDGE_RIGHT },
}
end
)
config.colors = {
tab_bar = {
active_tab = {
bg_color = title_color_bg:lighten(0.03),
fg_color = title_color_fg:lighten(0.8),
intensity = "Bold",
},
inactive_tab = {
bg_color = title_color_bg:lighten(0.01),
fg_color = title_color_fg,
intensity = "Half",
},
inactive_tab_edge = title_color_bg
},
split = title_color_bg:lighten(0.3):desaturate(0.5)
}
config.window_background_opacity = 0.9
config.window_frame = {
active_titlebar_bg = title_color_bg,
inactive_titlebar_bg = title_color_bg,
font_size = 10.0,
}
config.window_decorations = 'RESIZE'
config.win32_system_backdrop = "Disable"
config.show_tab_index_in_tab_bar = false
config.show_new_tab_button_in_tab_bar = false
config.color_scheme = 'Argonaut (Gogh)'
config.font = wezterm.font 'JetBrains Mono' config.font = wezterm.font 'JetBrains Mono'
-- terminal padding
config.window_padding = { config.window_padding = {
left = 0, left = 0,
right = 0, right = 0,
top = 0, top = 0,
bottom = 0, bottom = 0,
} }
config.use_fancy_tab_bar = false config.use_fancy_tab_bar = true
config.hide_tab_bar_if_only_one_tab = true config.hide_tab_bar_if_only_one_tab = false
config.tab_bar_at_bottom = true
config.tab_max_width=24
config.inactive_pane_hsb = { config.inactive_pane_hsb = {
saturation = 0.6, saturation = 0.6,
@ -87,11 +281,11 @@ config.inactive_pane_hsb = {
} }
config.quick_select_alphabet = "asdfqweryxcvjkluiopmghtzbn" config.quick_select_alphabet = "asdfqweryxcvjkluiopmghtzbn"
config.scrollback_lines = 9001
-- WSL -- WSL
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
config.default_domain = 'WSL:Debian' config.default_domain = 'WSL:Debian'
end end
-- and finally, return the configuration to wezterm
return config return config

Loading…
Cancel
Save