mirror of
https://git.gay/xqtc/nixos-config
synced 2024-11-25 23:43:54 +01:00
150 lines
3.2 KiB
Lua
150 lines
3.2 KiB
Lua
local wezterm = require 'wezterm'
|
|
|
|
local config = {}
|
|
|
|
function getHostname()
|
|
local handle = io.popen("hostname -s")
|
|
local result = handle:read("*a")
|
|
handle:close()
|
|
return string.gsub(result, "\n$", "")
|
|
end
|
|
|
|
local HOSTNAME = getHostname()
|
|
|
|
config.color_scheme = "Apathy"
|
|
-- config.font = wezterm.font 'Hack Nerd Font Mono'
|
|
config.font = wezterm.font 'ComicShannsMono Nerd Font Mono'
|
|
if getHostname() == "lilith" or getHostname() == "alastor" then
|
|
config.font_size = 15
|
|
else
|
|
config.font_size = 11
|
|
end
|
|
if os.getenv("DESKTOP_SESSION") == "plasma" or os.getenv("DESKTOP_SESSION") == "plasmax11" then
|
|
config.window_background_opacity = 1
|
|
elseif os.getenv("XDG_CURRENT_DESKTOP") == "sway" then
|
|
config.window_background_opacity = .9
|
|
else
|
|
config.window_background_opacity = .8
|
|
end
|
|
config.macos_window_background_blur = 10
|
|
config.keys = {
|
|
{
|
|
key = 't',
|
|
mods = 'CTRL',
|
|
action = wezterm.action.SpawnTab 'DefaultDomain',
|
|
},
|
|
{
|
|
key = 's',
|
|
mods = 'CTRL | SHIFT',
|
|
action = wezterm.action.PaneSelect
|
|
},
|
|
{
|
|
key = "LeftArrow",
|
|
mods = 'CTRL | ALT | SHIFT',
|
|
action = wezterm.action.AdjustPaneSize {
|
|
'Left',
|
|
5
|
|
},
|
|
},
|
|
{
|
|
key = "RightArrow",
|
|
mods = 'CTRL | ALT | SHIFT',
|
|
action = wezterm.action.AdjustPaneSize {
|
|
'Right',
|
|
5
|
|
},
|
|
},
|
|
{
|
|
key = "UpArrow",
|
|
mods = 'CTRL | ALT | SHIFT',
|
|
action = wezterm.action.AdjustPaneSize {
|
|
'Up',
|
|
5
|
|
},
|
|
},
|
|
{
|
|
key = "DownArrow",
|
|
mods = 'CTRL | ALT | SHIFT',
|
|
action = wezterm.action.AdjustPaneSize {
|
|
'Down',
|
|
5
|
|
},
|
|
},
|
|
{
|
|
key = "h",
|
|
mods = 'CTRL | SHIFT',
|
|
action = wezterm.action.SplitPane {
|
|
direction = 'Left',
|
|
},
|
|
},
|
|
{
|
|
key = "l",
|
|
mods = 'CTRL | SHIFT',
|
|
action = wezterm.action.SplitPane {
|
|
direction = 'Right',
|
|
},
|
|
},
|
|
{
|
|
key = "k",
|
|
mods = 'CTRL | SHIFT',
|
|
action = wezterm.action.SplitPane {
|
|
direction = 'Up',
|
|
},
|
|
},
|
|
{
|
|
key = "j",
|
|
mods = 'CTRL | SHIFT',
|
|
action = wezterm.action.SplitPane {
|
|
direction = 'Down',
|
|
},
|
|
},
|
|
}
|
|
|
|
for i = 1, 8 do
|
|
-- CTRL+ALT + number to activate that tab
|
|
table.insert(config.keys, {
|
|
key = tostring(i),
|
|
mods = 'CTRL',
|
|
action = wezterm.action.ActivateTab(i - 1),
|
|
})
|
|
end
|
|
|
|
wezterm.on('update-status', function(window, pane)
|
|
local date = wezterm.strftime '%a %b %-d %H:%M:%S |'
|
|
|
|
local bat = ''
|
|
for _, b in ipairs(wezterm.battery_info()) do
|
|
-- bat = '|🔋 ' .. string.format('%.0f%%', b.state_of_charge * 100) .. ' | '
|
|
bat = '| BAT ' .. string.format('%.0f%%', b.state_of_charge * 100) .. ' | '
|
|
end
|
|
|
|
window:set_right_status(wezterm.format {
|
|
{ Text = bat .. date .. ' 🐱 |' },
|
|
})
|
|
end)
|
|
wezterm.on('update-status', function(window, pane)
|
|
window:set_left_status(wezterm.format {
|
|
{ Text = '| λ |' },
|
|
})
|
|
end)
|
|
|
|
config.front_end = 'WebGpu'
|
|
for _, gpu in ipairs(wezterm.gui.enumerate_gpus()) do
|
|
if gpu.backend == 'Vulkan' and gpu.device_type == 'IntegratedGpu' or gpu.device_type == "DiscreteGpu" then
|
|
config.webgpu_preferred_adapter = gpu
|
|
config.front_end = 'WebGpu'
|
|
break
|
|
end
|
|
end
|
|
|
|
config.hide_tab_bar_if_only_one_tab = false
|
|
config.use_fancy_tab_bar = false
|
|
config.text_background_opacity = 0.3
|
|
config.enable_scroll_bar = false
|
|
config.enable_tab_bar = true
|
|
config.tab_bar_at_bottom = true
|
|
config.hide_mouse_cursor_when_typing = false
|
|
config.enable_wayland = false
|
|
config.warn_about_missing_glyphs = false
|
|
return config
|