This commit is contained in:
max_richter 2023-03-07 18:13:15 +01:00
parent 448a9e186f
commit dc52754d44
6 changed files with 193 additions and 310 deletions

View File

@ -16,7 +16,7 @@
"copilot.lua": { "branch": "master", "commit": "b41d4c9c7d4f5e0272bcf94061b88e244904c56f" }, "copilot.lua": { "branch": "master", "commit": "b41d4c9c7d4f5e0272bcf94061b88e244904c56f" },
"flit.nvim": { "branch": "main", "commit": "4c1739137acd3e7f03e2065a7be8a4dc41c7e461" }, "flit.nvim": { "branch": "main", "commit": "4c1739137acd3e7f03e2065a7be8a4dc41c7e461" },
"friendly-snippets": { "branch": "main", "commit": "009887b76f15d16f69ae1341f86a7862f61cf2a1" }, "friendly-snippets": { "branch": "main", "commit": "009887b76f15d16f69ae1341f86a7862f61cf2a1" },
"git-conflict.nvim": { "branch": "main", "commit": "80bc8931d4ed8c8c4d289a08e1838fcf4741408d" }, "git-conflict.nvim": { "branch": "main", "commit": "2957f747e1a34f1854e4e0efbfbfa59a1db04af5" },
"gitsigns.nvim": { "branch": "main", "commit": "b1f9cf7c5c5639c006c937fc1819e09f358210fc" }, "gitsigns.nvim": { "branch": "main", "commit": "b1f9cf7c5c5639c006c937fc1819e09f358210fc" },
"lazy.nvim": { "branch": "main", "commit": "e89acede13f46a5db229133cf0c87aee74938c56" }, "lazy.nvim": { "branch": "main", "commit": "e89acede13f46a5db229133cf0c87aee74938c56" },
"leap.nvim": { "branch": "main", "commit": "d34680b16af977928228e57c68e5a162f1649e3c" }, "leap.nvim": { "branch": "main", "commit": "d34680b16af977928228e57c68e5a162f1649e3c" },

View File

@ -190,7 +190,6 @@ input "1739:24385:Synaptics_TM2438-005" {
# #
corner_radius 4 corner_radius 4
for_window [class="zoom"] floating enable for_window [class="zoom"] floating enable
for_window [class="wezterm"] corner_radius 20
for_window [app_id="com.github.gi_lom.dialect"] floating enable, resize set 800 400, sticky enable for_window [app_id="com.github.gi_lom.dialect"] floating enable, resize set 800 400, sticky enable
for_window [app_id="gnome-calculator"] floating enable for_window [app_id="gnome-calculator"] floating enable
for_window [app_id="qalculate-gtk"] floating enable for_window [app_id="qalculate-gtk"] floating enable

View File

@ -0,0 +1,28 @@
return {
rosewater = "#F4DBD6",
flamingo = "#F0C6C6",
pink = "#F5BDE6",
mauve = "#C6A0F6",
red = "#ED8798",
maroon = "#EE99A0",
peach = "#F5A97F",
yellow = "#EED49F",
green = "#A6DA95",
teal = "#8BD5CA",
sky = "#91D7E3",
sapphire = "#7DC4E4",
blue = "#8AADF4",
lavender = "#B7BDF8",
text = "#CAD3F5",
subtext1 = "white",
subtext0 = "#A5ADCB",
overlay2 = "#939AB7",
overlay1 = "#8087A2",
overlay0 = "#6E738D",
surface2 = "#5B6078",
surface1 = "#494D64",
surface0 = "#363A4F",
base = "#020202",
mantle = "#1E2030",
crust = "#000000",
}

117
configs/wezterm/utils.lua Normal file
View File

@ -0,0 +1,117 @@
local colors = require("colors")
local wezterm = require("wezterm")
local M = {}
M.merge = function(first_table, second_table)
for k, v in pairs(second_table) do first_table[k] = v end
return first_table
end
M.get_process_name = function(tab)
local process_name = tab.active_pane.user_vars.PROG
if process_name == nil then
process_name = string.gsub(tab.active_pane.foreground_process_name, "(.*[/\\])(.*)", "%2")
end
if process_name == "wslhost.exe" then
local pane = tab.active_pane
process_name = pane.title
end
if process_name == "" then
process_name = "zsh"
end
return process_name
end
M.get_process = function(tab)
local process_icons = {
["docker"] = {
{ Foreground = { Color = colors.blue } },
{ Text = wezterm.nerdfonts.linux_docker },
},
["docker-compose"] = {
{ Foreground = { Color = colors.blue } },
{ Text = wezterm.nerdfonts.linux_docker },
},
["nvim"] = {
{ Foreground = { Color = colors.green } },
{ Text = wezterm.nerdfonts.custom_vim },
},
["v"] = {
{ Foreground = { Color = colors.green } },
{ Text = wezterm.nerdfonts.custom_vim },
},
["vim"] = {
{ Foreground = { Color = colors.green } },
{ Text = wezterm.nerdfonts.dev_vim },
},
["node"] = {
{ Foreground = { Color = colors.green } },
{ Text = wezterm.nerdfonts.mdi_hexagon },
},
["zsh"] = {
{ Foreground = { Color = colors.peach } },
{ Text = wezterm.nerdfonts.dev_terminal },
},
["bash"] = {
{ Foreground = { Color = colors.subtext0 } },
{ Text = wezterm.nerdfonts.cod_terminal_bash },
},
["htop"] = {
{ Foreground = { Color = colors.yellow } },
{ Text = wezterm.nerdfonts.mdi_chart_donut_variant },
},
["cargo"] = {
{ Foreground = { Color = colors.peach } },
{ Text = wezterm.nerdfonts.dev_rust },
},
["go"] = {
{ Foreground = { Color = colors.sapphire } },
{ Text = wezterm.nerdfonts.mdi_language_go },
},
["lazydocker"] = {
{ Foreground = { Color = colors.blue } },
{ Text = wezterm.nerdfonts.linux_docker },
},
["git"] = {
{ Foreground = { Color = colors.peach } },
{ Text = wezterm.nerdfonts.dev_git },
},
["lazygit"] = {
{ Foreground = { Color = colors.peach } },
{ Text = wezterm.nerdfonts.dev_git },
},
["lua"] = {
{ Foreground = { Color = colors.blue } },
{ Text = wezterm.nerdfonts.seti_lua },
},
["wget"] = {
{ Foreground = { Color = colors.yellow } },
{ Text = wezterm.nerdfonts.mdi_arrow_down_box },
},
["curl"] = {
{ Foreground = { Color = colors.yellow } },
{ Text = wezterm.nerdfonts.mdi_flattr },
},
["gh"] = {
{ Foreground = { Color = colors.mauve } },
{ Text = wezterm.nerdfonts.dev_github_badge },
},
}
local process_name = M.get_process_name(tab)
return wezterm.format(
process_icons[process_name]
or { { Foreground = { Color = colors.sky } }, { Text = string.format("%s", process_name) } }
)
end
return M;

View File

@ -1,146 +0,0 @@
local wezterm = require 'wezterm'
local act = wezterm.action
local default_prog
local default_cwd
local font_size
local tab_font_size
local initial_rows
local inital_cols
if string.find(wezterm.target_triple, "windows") then
default_prog = { "wsl.exe" };
default_cwd = os.getenv("HOME");
tab_font_size = 9.0;
font_size = 10.7;
initial_rows = 43;
initial_cols = 180;
end
if string.find(wezterm.target_triple, "darwin") then
tab_font_size = 15.0;
font_size = 16;
initial_rows = 38;
initial_cols = 120;
end
local keys = {
-- Keyboard Navigation
--- delete words backwards
{ key = "Backspace", mods = "CTRL", action = { SendKey = { key = "U", mods = "CTRL" } } },
{ key = "Backspace", mods = "CMD", action = { SendKey = { key = "U", mods = "CTRL" } } },
{ key = "Backspace", mods = "ALT", action = { SendKey = { key = "W", mods = "CTRL" } } },
--- home and end
{ key = "LeftArrow", mods = "CTRL", action = { SendKey = { key = "Home" } } },
{ key = "LeftArrow", mods = "CMD", action = { SendKey = { key = "Home" } } },
{ key = "RightArrow", mods = "CTRL", action = { SendKey = { key = "End" } } },
{ key = "RightArrow", mods = "CMD", action = { SendKey = { key = "End" } } },
--- move one word
{ key = "LeftArrow", mods = "ALT", action = { SendKey = { key = "LeftArrow", mods = "CTRL" } } },
{ key = "RightArrow", mods = "ALT", action = { SendKey = { key = "RightArrow", mods = "CTRL" } } },
--- ctrl + jk keyboard navigation
{ key = "k", mods = "ALT", action = { SendKey = { key = "UpArrow" } } },
{ key = "k", mods = "CMD", action = { SendKey = { key = "UpArrow" } } },
{ key = "j", mods = "ALT", action = { SendKey = { key = "DownArrow" } } },
{ key = "j", mods = "CMD", action = { SendKey = { key = "DownArrow" } } },
--- accept completion on ctrl|alt|cmd + .
{ key = ".", mods = "CTRL", action = { SendKey = { key = "RightArrow" } } },
{ key = ".", mods = "ALT", action = { SendKey = { key = "RightArrow" } } },
{ key = ".", mods = "CMD", action = { SendKey = { key = "RightArrow" } } },
-- Fullscreen
{ key = "Enter", mods = "CTRL", action = "ToggleFullScreen" },
{ key = "Enter", mods = "CMD", action = "ToggleFullScreen" },
{ key = "Enter", mods = "ALT", action = "ToggleFullScreen" },
-- Clear Screen
{ key = "l", mods = "CMD", action = { SendKey = { key = "l", mods = "CTRL" } } },
{ key = "l", mods = "ALT", action = { SendKey = { key = "l", mods = "CTRL" } } },
{ key = "k", mods = "CMD", action = { SendKey = { key = "l", mods = "CTRL" } } },
-- Copy/Paste
{ key = "c", mods = "ALT", action = "Copy" },
{ key = "c", mods = "CMD", action = "Copy" },
{ key = "v", mods = "ALT", action = "Paste" },
{ key = "v", mods = "CMD", action = "Paste" },
-- Open New Window
{ key = "t", mods = "CMD", action = { SpawnTab = "CurrentPaneDomain" } },
{ key = "t", mods = "ALT", action = { SpawnTab = "CurrentPaneDomain" } },
{ key = "n", mods = "CMD", action = "SpawnWindow" },
{ key = "n", mods = "ALT", action = "SpawnWindow" },
{ key = "w", mods = "ALT", action = { EmitEvent = "CloseCurrentTab" } },
{ key = "w", mods = "CMD", action = { EmitEvent = "CloseCurrentTab" } },
-- Open the config
{ key = ",", mods = "ALT", action = { SendString = "vim ~/.config/wezterm/wezterm.lua\r\n" } },
{ key = ",", mods = "CMD", action = { SendString = "vim ~/.config/wezterm/wezterm.lua\r\n" } },
};
-- ALT-Tab
for i = 1, 9 do
table.insert(keys, { key = tostring(i), mods = "ALT", action = wezterm.action { ActivateTab = i - 1 } })
table.insert(keys, { key = tostring(i), mods = "CTRL", action = wezterm.action { ActivateTab = i - 1 } });
end
-- Delegate close confirmation to some apps such as VIM, etc.
wezterm.on("CloseCurrentTab", function(window, pane)
function is_vim()
local current_process = pane:get_title():upper()
return current_process:sub(- #"NVIM") == "NVIM" or current_process:sub(1, #"NVIM") == "NVIM" or
current_process:sub(- #"VIM") == "VIM" or current_process:sub(1, #"VIM") == "VIM" or
current_process:sub(- #"VI") == "VI" or current_process:sub(1, #"VI") == "VI"
end
if is_vim() then
window:perform_action(wezterm.action {
SendKey = { key = "Z", mods = "CTRL" }
}, pane)
else
window:perform_action(wezterm.action {
CloseCurrentTab = { confirm = false }
}, pane)
end
end)
-- Colors
local colors = {
-- Tab Bar Ayu Mirage
}
local color_schemes = {
["Ayu"] = {
background = "#0f1419",
}
};
return {
-- General
default_prog = default_prog,
default_cwd = default_cwd,
exit_behavior = "Close",
-- Key Bindings
keys = keys,
-- Window
initial_rows = initial_rows,
initial_cols = initial_cols,
window_padding = { left = 1, right = 1, top = 0, bottom = 0 },
-- Appearance and Colors
color_scheme = "Ayu",
colors = colors,
color_schemes = color_schemes,
window_decorations = "RESIZE",
default_cursor_style = "SteadyBlock",
audible_bell = "Disabled",
font_size = font_size,
harfbuzz_features = { "calt=0", "clig=0", "liga=0" },
window_frame = { font_size = tab_font_size, }
}

View File

@ -1,141 +1,6 @@
local wezterm = require("wezterm") local wezterm = require("wezterm")
local utils = require("utils")
local wsl_domains = wezterm.default_wsl_domains() local colors = require("colors")
for _, dom in ipairs(wsl_domains) do
dom.default_cwd = "/home/max"
end
local colors = {
rosewater = "#F4DBD6",
flamingo = "#F0C6C6",
pink = "#F5BDE6",
mauve = "#C6A0F6",
red = "#ED8798",
maroon = "#EE99A0",
peach = "#F5A97F",
yellow = "#EED49F",
green = "#A6DA95",
teal = "#8BD5CA",
sky = "#91D7E3",
sapphire = "#7DC4E4",
blue = "#8AADF4",
lavender = "#B7BDF8",
text = "#CAD3F5",
subtext1 = "white",
subtext0 = "#A5ADCB",
overlay2 = "#939AB7",
overlay1 = "#8087A2",
overlay0 = "#6E738D",
surface2 = "#5B6078",
surface1 = "#494D64",
surface0 = "#363A4F",
base = "#020202",
mantle = "#1E2030",
crust = "#000000",
}
local function get_process_name(tab)
local process_name = tab.active_pane.user_vars.PROG
if process_name == nil then
process_name = string.gsub(tab.active_pane.foreground_process_name, "(.*[/\\])(.*)", "%2")
end
if process_name == "wslhost.exe" then
local pane = tab.active_pane
process_name = pane.title
end
if process_name == "" then
process_name = "zsh"
end
return process_name
end
local function get_process(tab)
local process_icons = {
["docker"] = {
{ Foreground = { Color = colors.blue } },
{ Text = wezterm.nerdfonts.linux_docker },
},
["docker-compose"] = {
{ Foreground = { Color = colors.blue } },
{ Text = wezterm.nerdfonts.linux_docker },
},
["nvim"] = {
{ Foreground = { Color = colors.green } },
{ Text = wezterm.nerdfonts.custom_vim },
},
["v"] = {
{ Foreground = { Color = colors.green } },
{ Text = wezterm.nerdfonts.custom_vim },
},
["vim"] = {
{ Foreground = { Color = colors.green } },
{ Text = wezterm.nerdfonts.dev_vim },
},
["node"] = {
{ Foreground = { Color = colors.green } },
{ Text = wezterm.nerdfonts.mdi_hexagon },
},
["zsh"] = {
{ Foreground = { Color = colors.peach } },
{ Text = wezterm.nerdfonts.dev_terminal },
},
["bash"] = {
{ Foreground = { Color = colors.subtext0 } },
{ Text = wezterm.nerdfonts.cod_terminal_bash },
},
["htop"] = {
{ Foreground = { Color = colors.yellow } },
{ Text = wezterm.nerdfonts.mdi_chart_donut_variant },
},
["cargo"] = {
{ Foreground = { Color = colors.peach } },
{ Text = wezterm.nerdfonts.dev_rust },
},
["go"] = {
{ Foreground = { Color = colors.sapphire } },
{ Text = wezterm.nerdfonts.mdi_language_go },
},
["lazydocker"] = {
{ Foreground = { Color = colors.blue } },
{ Text = wezterm.nerdfonts.linux_docker },
},
["git"] = {
{ Foreground = { Color = colors.peach } },
{ Text = wezterm.nerdfonts.dev_git },
},
["lazygit"] = {
{ Foreground = { Color = colors.peach } },
{ Text = wezterm.nerdfonts.dev_git },
},
["lua"] = {
{ Foreground = { Color = colors.blue } },
{ Text = wezterm.nerdfonts.seti_lua },
},
["wget"] = {
{ Foreground = { Color = colors.yellow } },
{ Text = wezterm.nerdfonts.mdi_arrow_down_box },
},
["curl"] = {
{ Foreground = { Color = colors.yellow } },
{ Text = wezterm.nerdfonts.mdi_flattr },
},
["gh"] = {
{ Foreground = { Color = colors.mauve } },
{ Text = wezterm.nerdfonts.dev_github_badge },
},
}
local process_name = get_process_name(tab)
return wezterm.format(
process_icons[process_name]
or { { Foreground = { Color = colors.sky } }, { Text = string.format("%s", process_name) } }
)
end
local function get_current_working_dir(tab) local function get_current_working_dir(tab)
local current_dir = tab.active_pane.current_working_dir local current_dir = tab.active_pane.current_working_dir
@ -149,7 +14,7 @@ wezterm.on("format-tab-title", function(tab)
return wezterm.format({ return wezterm.format({
{ Attribute = { Intensity = "Half" } }, { Attribute = { Intensity = "Half" } },
{ Text = tab.is_active and " [" or " " }, { Text = tab.is_active and " [" or " " },
{ Text = get_process(tab) }, { Text = utils.get_process(tab) },
{ Text = " " }, { Text = " " },
{ Text = get_current_working_dir(tab) }, { Text = get_current_working_dir(tab) },
{ Text = tab.is_active and "] " or " " }, { Text = tab.is_active and "] " or " " },
@ -164,16 +29,36 @@ wezterm.on("update-status", function(window)
})) }))
end) end)
return { local os_config = {}
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
local wsl_domains = wezterm.default_wsl_domains()
for _, dom in ipairs(wsl_domains) do
dom.default_cwd = "/home/max"
end
os_config = {
wsl_domains = wsl_domains,
default_domain = "WSL:Debian",
}
else
os_config = {
window_padding = {
left = 20,
right = 20,
top = 20,
bottom = 20,
},
}
end
return utils.merge({
font = wezterm.font_with_fallback({ font = wezterm.font_with_fallback({
"Liga SFMono Nerd Font", "Liga SFMono Nerd Font",
"Apple Color Emoji", "Apple Color Emoji",
}), }),
wsl_domains = wsl_domains,
default_domain = "WSL:Debian",
font_size = 12.1, font_size = 12.1,
max_fps = 120, max_fps = 120,
enable_wayland = false,
pane_focus_follows_mouse = false, pane_focus_follows_mouse = false,
warn_about_missing_glyphs = false, warn_about_missing_glyphs = false,
show_update_window = true, show_update_window = true,
@ -317,4 +202,4 @@ return {
format = "https://example.com/tasks/?t=$1", format = "https://example.com/tasks/?t=$1",
}, },
}, },
} }, os_config)