feat(wezterm): Make wezterm config more robust

This commit is contained in:
js0ny 2025-01-06 12:44:14 +00:00
parent 9557dcb023
commit 2147f4b960
8 changed files with 300 additions and 126 deletions

View file

@ -5,26 +5,13 @@
### Load Configs ###
$DOTFILES = Join-Path $HOME ".dotfiles"
Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object {. $_}
Get-ChildItem -Path $(Join-Path $DOTFILES "tools" "powershell") -Filter *.ps1 | ForEach-Object { . $_ }
### Aliases ###
# Toggle Theme #
# TODO: Change to `bat` script implementation
# function Set-SystemTheme {
# $regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"
# $currentMode = Get-ItemProperty -Path $regPath -Name "AppsUseLightTheme"
# if ($currentMode.AppsUseLightTheme -eq 1) {
# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 0
# Write-Host "已切换到深色模式"
# }
# else {
# Set-ItemProperty -Path $regPath -Name "AppsUseLightTheme" -Value 1
# Write-Host "已切换到浅色模式"
# }
# }
# Set-Alias "dark-mode" "Set-SystemTheme" # Consistent with macOS (`dark-mode`)
Set-Alias "dark-mode" "$DOTFILES\platforms\win\cmd\dark-mode.bat" # Consistent with macOS (`dark-mode`)
# Miscs #
@ -35,7 +22,7 @@ ${function:qwen} = "ollama run qwen2.5:14b"
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
If (Test-Path "$HOME\miniconda3\Scripts\conda.exe") {
(& "$HOME\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Where-Object{$_} | Invoke-Expression
(& "$HOME\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Where-Object { $_ } | Invoke-Expression
}
#endregion
@ -67,10 +54,10 @@ $Env:VISUAL = "code --wait"
$Env:FILE_MANAGER = "dopus.exe"
${function:wsl2} = {wsl.exe --distribution Ubuntu}
${function:wsl2} = { wsl.exe --distribution kali-linux $args }
${function:wini} = { winget install $args }
${function:winr} = { winget uninstall $args }
${function:wins} = { winget search $args }
${function:winu} = { winget upgrade $args }
${function:killp} = {ps | ? ProcessName -like $args | kill -Force}
${function:pkill} = { ps *$args* | kill -Force }

View file

@ -53,14 +53,14 @@ gaps:
scale_with_dpi: true
# Gap between adjacent windows.
inner_gap: "20px"
inner_gap: "5px"
# Gap between windows and the screen edge.
outer_gap:
top: "60px"
right: "20px"
bottom: "20px"
left: "20px"
top: "50px"
right: "5px"
bottom: "5px"
left: "5px"
window_effects:
# Visual effects to apply to the focused window.
@ -69,7 +69,7 @@ window_effects:
# ** Exclusive to Windows 11 due to API limitations.
border:
enabled: true
color: "#8dbcff"
color: "#f6a7ba"
# Remove the title bar from the window's frame. Note that this can
# cause rendering issues for some applications.
@ -86,10 +86,10 @@ window_effects:
# Visual effects to apply to non-focused windows.
other_windows:
border:
enabled: true
enabled: false
color: "#a1a1a1"
hide_title_bar:
enabled: false
enabled: true
corner_style:
enabled: false
style: "square"
@ -134,6 +134,7 @@ window_rules:
match:
# Ignores any Zebar windows.
- window_process: { equals: "zebar" }
- window_process: { equals: "WindowsTerminal" }
# Ignores picture-in-picture windows for browsers.
- window_title: { regex: "[Pp]icture.in.[Pp]icture" }
@ -249,7 +250,7 @@ keybindings:
# Launch CMD terminal. Alternatively, use `shell-exec wt` or
# `shell-exec %ProgramFiles%/Git/git-bash.exe` to start Windows
# Terminal and Git Bash respectively.
- commands: ["shell-exec wt"]
- commands: ["shell-exec wezterm-gui.exe start"]
bindings: ["lwin+r"]
# Focus the next/previous active workspace defined in `workspaces` config.