mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
sync from windows
This commit is contained in:
parent
2147f4b960
commit
bc3834188d
12 changed files with 219 additions and 31 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -49,3 +49,5 @@ common/fzfrc
|
||||||
platforms/win/komorebi/applications.json
|
platforms/win/komorebi/applications.json
|
||||||
|
|
||||||
gitconfig
|
gitconfig
|
||||||
|
|
||||||
|
*.exe
|
||||||
BIN
_assets/windows-1.png
Normal file
BIN
_assets/windows-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
|
|
@ -35,8 +35,8 @@ if ($currentPath -notlike "*%PATH_EXT%*") {
|
||||||
# Simulate XDG Base Directory Specification
|
# Simulate XDG Base Directory Specification
|
||||||
$Env:XDG_CONFIG_HOME = "$Env:AppData"
|
$Env:XDG_CONFIG_HOME = "$Env:AppData"
|
||||||
$Env:XDG_DATA_HOME = "$Env:LocalAppData"
|
$Env:XDG_DATA_HOME = "$Env:LocalAppData"
|
||||||
$Env:XDG_CACHE_HOME = "$Env:LocalAppData\cache"
|
$Env:XDG_CACHE_HOME = "$Env:LocalAppData\Cache"
|
||||||
$Env:XDG_STATE_HOME = "$Env:LocalAppData\state"
|
$Env:XDG_STATE_HOME = "$Env:LocalAppData\State"
|
||||||
[System.Environment]::SetEnvironmentVariable("XDG_CONFIG_HOME", "$Env:XDG_CONFIG_HOME", "User")
|
[System.Environment]::SetEnvironmentVariable("XDG_CONFIG_HOME", "$Env:XDG_CONFIG_HOME", "User")
|
||||||
[System.Environment]::SetEnvironmentVariable("XDG_DATA_HOME", "$Env:XDG_DATA_HOME", "User")
|
[System.Environment]::SetEnvironmentVariable("XDG_DATA_HOME", "$Env:XDG_DATA_HOME", "User")
|
||||||
New-Item -ItemType Directory -Path "$Env:LocalAppData\cache" -Force
|
New-Item -ItemType Directory -Path "$Env:LocalAppData\cache" -Force
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@ Set-MpPreference -ControlledFolderAccessProtectedFolders $protected
|
||||||
$apps = (Get-MpPreference).ControlledFolderAccessAllowedApplications
|
$apps = (Get-MpPreference).ControlledFolderAccessAllowedApplications
|
||||||
$apps += "$Env:Windir\System32\OpenSSH\ssh.exe"
|
$apps += "$Env:Windir\System32\OpenSSH\ssh.exe"
|
||||||
$apps += "$Env:ProgramFiles\GPSoftware\Directory Opus\DOpus.exe"
|
$apps += "$Env:ProgramFiles\GPSoftware\Directory Opus\DOpus.exe"
|
||||||
$apps += "$Env:UserProfile\scoop\apps\pwsh\current\pwsh.exe"
|
$apps += (Get-Command -Name code).Source.Replace("bin\code.cmd", "Code.exe")
|
||||||
|
$apps += (Get-Command -Name pwsh).Source
|
||||||
|
$apps += (Get-Command -Name git).Source
|
||||||
Set-MpPreference -ControlledFolderAccessAllowedApplications $apps
|
Set-MpPreference -ControlledFolderAccessAllowedApplications $apps
|
||||||
|
|
||||||
$exclusion = (Get-MpPreference).ExclusionPath
|
$exclusion = (Get-MpPreference).ExclusionPath
|
||||||
|
|
|
||||||
114
platforms/win/ahk/Caps.ahk
Normal file
114
platforms/win/ahk/Caps.ahk
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
#Requires AutoHotkey v2.0
|
||||||
|
#SingleInstance Force
|
||||||
|
|
||||||
|
; 全局变量声明
|
||||||
|
global g_LastCtrlKeyDownTime := 0
|
||||||
|
global g_AbortSendEsc := false
|
||||||
|
global g_ControlRepeatDetected := false
|
||||||
|
|
||||||
|
*CapsLock:: {
|
||||||
|
global g_ControlRepeatDetected
|
||||||
|
global g_LastCtrlKeyDownTime
|
||||||
|
global g_AbortSendEsc
|
||||||
|
|
||||||
|
if (g_ControlRepeatDetected) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Send "{Ctrl down}"
|
||||||
|
g_LastCtrlKeyDownTime := A_TickCount
|
||||||
|
g_AbortSendEsc := false
|
||||||
|
g_ControlRepeatDetected := true
|
||||||
|
}
|
||||||
|
|
||||||
|
*CapsLock Up:: {
|
||||||
|
global g_ControlRepeatDetected
|
||||||
|
global g_LastCtrlKeyDownTime
|
||||||
|
global g_AbortSendEsc
|
||||||
|
|
||||||
|
Send "{Ctrl up}"
|
||||||
|
g_ControlRepeatDetected := false
|
||||||
|
if (g_AbortSendEsc) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
current_time := A_TickCount
|
||||||
|
time_elapsed := current_time - g_LastCtrlKeyDownTime
|
||||||
|
if (time_elapsed <= 250) {
|
||||||
|
SendInput "{Esc}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
; 组合所有 Ctrl 快捷键
|
||||||
|
#HotIf
|
||||||
|
~*^a::
|
||||||
|
~*^b::
|
||||||
|
~*^c::
|
||||||
|
~*^d::
|
||||||
|
~*^e::
|
||||||
|
~*^f::
|
||||||
|
~*^g::
|
||||||
|
~*^h::
|
||||||
|
~*^i::
|
||||||
|
~*^j::
|
||||||
|
~*^k::
|
||||||
|
~*^l::
|
||||||
|
~*^m::
|
||||||
|
~*^n::
|
||||||
|
~*^o::
|
||||||
|
~*^p::
|
||||||
|
~*^q::
|
||||||
|
~*^r::
|
||||||
|
~*^s::
|
||||||
|
~*^t::
|
||||||
|
~*^u::
|
||||||
|
~*^v::
|
||||||
|
~*^w::
|
||||||
|
~*^x::
|
||||||
|
~*^y::
|
||||||
|
~*^z::
|
||||||
|
~*^1::
|
||||||
|
~*^2::
|
||||||
|
~*^3::
|
||||||
|
~*^4::
|
||||||
|
~*^5::
|
||||||
|
~*^6::
|
||||||
|
~*^7::
|
||||||
|
~*^8::
|
||||||
|
~*^9::
|
||||||
|
~*^0::
|
||||||
|
~*^Space::
|
||||||
|
~*^Backspace::
|
||||||
|
~*^Delete::
|
||||||
|
~*^Insert::
|
||||||
|
~*^Home::
|
||||||
|
~*^End::
|
||||||
|
~*^PgUp::
|
||||||
|
~*^PgDn::
|
||||||
|
~*^Tab::
|
||||||
|
~*^Enter::
|
||||||
|
~*^,::
|
||||||
|
~*^.::
|
||||||
|
~*^/::
|
||||||
|
~*^;::
|
||||||
|
~*^'::
|
||||||
|
~*^[::
|
||||||
|
~*^]::
|
||||||
|
~*^\::
|
||||||
|
~*^-::
|
||||||
|
~*^=::
|
||||||
|
~*^`::
|
||||||
|
~*^F1::
|
||||||
|
~*^F2::
|
||||||
|
~*^F3::
|
||||||
|
~*^F4::
|
||||||
|
~*^F5::
|
||||||
|
~*^F6::
|
||||||
|
~*^F7::
|
||||||
|
~*^F8::
|
||||||
|
~*^F9::
|
||||||
|
~*^F10::
|
||||||
|
~*^F11::
|
||||||
|
~*^F12:: {
|
||||||
|
global g_AbortSendEsc
|
||||||
|
g_AbortSendEsc := true
|
||||||
|
}
|
||||||
29
platforms/win/ahk/colemak.ahk
Normal file
29
platforms/win/ahk/colemak.ahk
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#Requires AutoHotkey v2.0
|
||||||
|
|
||||||
|
q::q
|
||||||
|
w::w
|
||||||
|
e::f
|
||||||
|
r::p
|
||||||
|
t::g
|
||||||
|
y::j
|
||||||
|
u::l
|
||||||
|
i::u
|
||||||
|
o::y
|
||||||
|
p::;
|
||||||
|
a::a
|
||||||
|
s::r
|
||||||
|
d::s
|
||||||
|
f::t
|
||||||
|
g::d
|
||||||
|
h::h
|
||||||
|
j::n
|
||||||
|
k::e
|
||||||
|
l::i
|
||||||
|
`;::o
|
||||||
|
z::z
|
||||||
|
x::x
|
||||||
|
c::c
|
||||||
|
v::v
|
||||||
|
b::b
|
||||||
|
n::k
|
||||||
|
m::m
|
||||||
|
|
@ -54,7 +54,6 @@
|
||||||
"memory",
|
"memory",
|
||||||
"swap",
|
"swap",
|
||||||
"disk",
|
"disk",
|
||||||
"localip",
|
|
||||||
"battery",
|
"battery",
|
||||||
"poweradapter",
|
"poweradapter",
|
||||||
"locale"
|
"locale"
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,9 @@ keybindings:
|
||||||
bindings: ["lwin+t"]
|
bindings: ["lwin+t"]
|
||||||
|
|
||||||
# Change the focused window to be fullscreen.
|
# Change the focused window to be fullscreen.
|
||||||
- commands: ["toggle-fullscreen"]
|
# - commands: ["toggle-fullscreen"]
|
||||||
|
# bindings: ["lwin+f"]
|
||||||
|
- commands: ["shell-exec dopus.exe"]
|
||||||
bindings: ["lwin+f"]
|
bindings: ["lwin+f"]
|
||||||
|
|
||||||
# Minimize focused window.
|
# Minimize focused window.
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,20 @@ New-Item -ItemType SymbolicLink -Path $Env:UserProfile\.glzr -Target $DOTFILES\p
|
||||||
|
|
||||||
The Zebar config should be downloaded from [this repository](https://github.com/js0ny/neobrutal-zebar) and extracted to the `glzr\zebar` directory.
|
The Zebar config should be downloaded from [this repository](https://github.com/js0ny/neobrutal-zebar) and extracted to the `glzr\zebar` directory.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/js0ny/neobrutal-zebar/releases/download/2/neobrutal.zip" -OutFile "$Env:UserProfile\.glzr\zebar\neobrutal.zip"
|
||||||
|
Expand-Archive -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip" -DestinationPath "$Env:UserProfile\.glzr\zebar"
|
||||||
|
Remove-Item -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip"
|
||||||
|
```
|
||||||
|
|
||||||
|
If `just` and `pwsh` are installed, you can build the config by running `just build-zebar`.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
git clone https://github.com/js0ny/neobrutal-zebar.git --depth 1
|
||||||
|
just init
|
||||||
|
just build
|
||||||
|
```
|
||||||
|
|
||||||
Or use the minimal setup, by changing `glzr\zebar\settings.json`: `startupConfigs.path` to `minimal/bar.zebar.json`.
|
Or use the minimal setup, by changing `glzr\zebar\settings.json`: `startupConfigs.path` to `minimal/bar.zebar.json`.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
|
@ -21,9 +35,3 @@ Or use the minimal setup, by changing `glzr\zebar\settings.json`: `startupConfig
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell
|
|
||||||
Invoke-WebRequest -Uri "https://github.com/js0ny/neobrutal-zebar/releases/download/2/neobrutal.zip" -OutFile "$Env:UserProfile\.glzr\zebar\neobrutal.zip"
|
|
||||||
Expand-Archive -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip" -DestinationPath "$Env:UserProfile\.glzr\zebar"
|
|
||||||
Remove-Item -Path "$Env:UserProfile\.glzr\zebar\neobrutal.zip"
|
|
||||||
```
|
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,82 @@
|
||||||
# Windows dotfiles
|
# Windows dotfiles
|
||||||
|
|
||||||
By following the Windows Directory Standard, assign the following directories corresponding to `$XDG_CONFIG` in Unix:
|

|
||||||
|
|
||||||
- `%APPDATA%` - `$XDG_CONFIG_HOME` (default: `%USERPROFILE%\AppData\Roaming`)
|
- Terminal Emulator: [WezTerm](../../tools/wezterm/)
|
||||||
|
- Tiling Window Manager: [GlazeWM](./glzr/glazewm/config.yaml)
|
||||||
|
- Status Bar: [Zebar](./glzr/zebar/settings.json)
|
||||||
|
- Quake Terminal: [Windows Terminal](./WindowsTerminal.json)
|
||||||
|
- Shell: [PowerShell Core](../../tools/powershell/readme.md)
|
||||||
|
- WSL1: [Arch Linux](https://github.com/yuk7/ArchWSL)
|
||||||
|
- WSL2: kali-linux
|
||||||
|
|
||||||
|
By following the Windows Directory Standard, assign the following directories corresponding to `$XDG_CONFIG` in Unix, some of the software(like `wezterm`) will use these directories as the default configuration path:
|
||||||
|
|
||||||
|
| Windows Path | XDG-Equivalent | Default |
|
||||||
|
|------------|----------|----------|
|
||||||
|
| `%APPDATA%` | `$XDG_CONFIG_HOME` | `%USERPROFILE%\AppData\Roaming` |
|
||||||
|
| `%LOCALAPPDATA%` | `$XDG_DATA_HOME` | `%USERPROFILE%\AppData\Local` |
|
||||||
|
| `%LOCALAPPDATA%\Cache` | `$XDG_CACHE_HOME` | `%USERPROFILE%\AppData\Local\Cache` |
|
||||||
|
| `%LOCALAPPDATA%\State` | `$XDG_STATE_HOME` | `%USERPROFILE%\AppData\Local\State` |
|
||||||
|
|
||||||
|
An example bootstrap script is provided in [bootstrap/Windows.ps1](../../bootstrap/Windows.ps1), which will create necessary directories and link the files.
|
||||||
|
|
||||||
## PowerShell Profile
|
## PowerShell Profile
|
||||||
|
|
||||||
This is the *[PowerShell Core](https://github.com/PowerShell/PowerShell)* profile, not the legacy *Windows PowerShell* profile.
|
This is the *[PowerShell Core](https://github.com/PowerShell/PowerShell)* profile, not the legacy *Windows PowerShell* profile, which is faster(`powershell` vs `pwsh`, `pwsh` types 6 letters less lol), cross-platform and compatible with Unix.
|
||||||
|
|
||||||
By default, PowerShell profile is stored in `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`.
|
By default, PowerShell profile is stored in `%UserProfile%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`.
|
||||||
|
|
||||||
It is convenient to use `$PROFILE` to locate the profile file.
|
It is convenient to use `$PROFILE` to locate the profile file.
|
||||||
|
|
||||||
```pwsh
|
```powershell
|
||||||
Test-Path $PROFILE
|
Test-Path $PROFILE
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Just like Unix Shell, there are configs work for different sessions. To locate them, use `select *` followed by `$PROFILE`.
|
||||||
|
|
||||||
|
If you want to change the `AllUsers` scoped profile, do not install `pwsh` via `winget`, use `scoop` instead, since `winget` will install `pwsh` to `%ProgramFiles%\PowerShell\7\pwsh.exe`, which is read-only even with Administrator privileges.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
PS > $PROFILE | Select *
|
||||||
|
AllUsersAllHosts : C:\Users\jsony\scoop\apps\pwsh\current\profile.ps1
|
||||||
|
AllUsersCurrentHost : C:\Users\jsony\scoop\apps\pwsh\current\Microsoft.PowerShell_profile.ps1
|
||||||
|
CurrentUserAllHosts : C:\Users\jsony\Documents\PowerShell\profile.ps1
|
||||||
|
CurrentUserCurrentHost : C:\Users\jsony\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
|
||||||
|
Length : 68
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the variable `$PROFILE.*` are constants, the only way to change it is to compile your own `pwsh`
|
||||||
|
|
||||||
To link the profile file:
|
To link the profile file:
|
||||||
|
|
||||||
```pwsh
|
```powershell
|
||||||
New-Item -ItemType SymbolicLink -Path $PROFILE -Target "$DOTFILES\win\Microsoft.PowerShell_profile.ps1" -Force
|
New-Item -ItemType SymbolicLink -Path $PROFILE -Target "$DOTFILES\win\Microsoft.PowerShell_profile.ps1" -Force
|
||||||
```
|
```
|
||||||
|
|
||||||
I use [starship](https://starship.rs/) to customize the prompt, which is located in [`.dotfiles/.config/starship/starship_pwsh.toml`](../.config/starship/starship_pwsh.toml). This prompt config is cross-platform for powershell core, since I use the promp to identify the shell.
|
I use [starship](https://starship.rs/) to customize the prompt, which is located in [`tools/starship/starship_pwsh.toml`](../../tools/starship/starship_pwsh.toml). This prompt config is cross-platform for powershell core, since I use the prompt to identify the shell.
|
||||||
|
|
||||||
## `.wslconfig` - WSL Configuration
|
## `.wslconfig` - WSL2 Configuration
|
||||||
|
|
||||||
`.wslconfig` only supports `~/.wslconfig` as the configuration path
|
`.wslconfig` only supports `%UserProfile%\.wslconfig` as the configuration path
|
||||||
|
|
||||||
```pwsh
|
```powershell
|
||||||
New-Item -ItemType SymbolicLink -Path "~\.wslconfig" -Target "$DOTFILES\win\.wslconfig" -Force
|
New-Item -ItemType SymbolicLink -Path "$Env:UserProfile\.wslconfig" -Target "$DOTFILES\win\.wslconfig" -Force
|
||||||
```
|
```
|
||||||
|
<!--
|
||||||
## Windows Terminal
|
## Windows Terminal
|
||||||
|
|
||||||
Use Hard Link to sync Windows Terminal Settings since it doesn't support symlink.
|
Use Hard Link to sync Windows Terminal Settings since it doesn't support symlink.
|
||||||
|
|
||||||
```pwsh
|
```powershell
|
||||||
New-Item -ItemType HardLink -Path "$Env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" -Target "$DOTFILES\win\WindowsTerminal.json" -Force
|
New-Item -ItemType HardLink -Path "$Env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" -Target "$DOTFILES\win\WindowsTerminal.json" -Force
|
||||||
```
|
```
|
||||||
|
-->
|
||||||
|
|
||||||
## Neovide
|
## Neovide
|
||||||
|
|
||||||
Neovide configuration is (only) stored in `%APPDATA%\neovide\config.toml`
|
Neovide configuration is (only) stored in `%APPDATA%\neovide\config.toml`
|
||||||
|
|
||||||
```pwsh
|
```powershell
|
||||||
New-Item -ItemType SymbolicLink -Path "$Env:AppData\neovide\config.toml" -Target "$DOTFILES\win\neovide.toml" -Force
|
New-Item -ItemType SymbolicLink -Path "$Env:AppData\neovide\config.toml" -Target "$DOTFILES\win\neovide.toml" -Force
|
||||||
```
|
```
|
||||||
|
|
@ -81,11 +81,11 @@ end
|
||||||
config.hide_tab_bar_if_only_one_tab = true
|
config.hide_tab_bar_if_only_one_tab = true
|
||||||
config.tab_bar_at_bottom = true
|
config.tab_bar_at_bottom = true
|
||||||
-- Cursor
|
-- Cursor
|
||||||
config.animation_fps = 120
|
-- config.animation_fps = 120
|
||||||
config.cursor_blink_ease_in = 'EaseOut'
|
-- config.cursor_blink_ease_in = 'EaseOut'
|
||||||
config.cursor_blink_ease_out = 'EaseOut'
|
-- config.cursor_blink_ease_out = 'EaseOut'
|
||||||
config.default_cursor_style = 'BlinkingBlock'
|
-- config.default_cursor_style = 'BlinkingBlock'
|
||||||
config.cursor_blink_rate = 650
|
-- config.cursor_blink_rate = 650
|
||||||
-- Visual Bell
|
-- Visual Bell
|
||||||
config.visual_bell = {
|
config.visual_bell = {
|
||||||
fade_in_function = 'EaseIn',
|
fade_in_function = 'EaseIn',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue