diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-05-29 23:55:31 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-05-29 23:55:31 +0200 |
| commit | cf8f7722e0d931683e02a6e9cffc4d54f65bccab (patch) | |
| tree | 18957d9287039d7f91203cb03677a11fb69ea91d | |
| parent | 07a593902598888f3dc89fbb2eb4481eb2382812 (diff) | |
| download | dotfiles-cf8f7722e0d931683e02a6e9cffc4d54f65bccab.tar.gz dotfiles-cf8f7722e0d931683e02a6e9cffc4d54f65bccab.zip | |
Testing
| -rw-r--r-- | .config/powershell/bootstrap.ps1 | 176 |
1 files changed, 87 insertions, 89 deletions
diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1 index ed10928..cc6e4fd 100644 --- a/.config/powershell/bootstrap.ps1 +++ b/.config/powershell/bootstrap.ps1 @@ -87,8 +87,6 @@ Add-Content -Path "$HOME\.gitignore" -Value ".cfg" Add-Content -Path "$HOME\.gitignore" -Value "install.bat" Add-Content -Path "$HOME\.gitignore" -Value ".config/powershell/bootstrap.ps1" -Set-ExecutionPolicy RemoteSigned - # Check if the profile exists, otherwise create it if (!(Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force @@ -115,7 +113,7 @@ function install_dotfiles { if ($std_err_output -match "following untracked working tree files would be overwritten") { if (-not $update) { - config checkout -- /dev/null | Out-Null + config checkout | Out-Null } } config config status.showUntrackedFiles no @@ -138,89 +136,89 @@ function install_dotfiles { install_dotfiles -# WSL -Write-Host "Configuring WSL" -wsl --install -d Ubuntu - -# Function to install SSH -function install_ssh { - Write-Host "Setting Up SSH" - Start-Service ssh-agent - Start-Service sshd - Set-Service -Name ssh-agent -StartupType 'Automatic' - Set-Service -Name sshd -StartupType 'Automatic' - - # Generate SSH key if not exists - if (-not (Test-Path -Path "$env:USERPROFILE\.ssh\id_rsa.pub")) { - ssh-keygen -t rsa -b 4096 -C "$env:USERNAME@$(hostname)" -f "$env:USERPROFILE\.ssh\id_rsa" -N "" - } - - # Start ssh-agent and add key - eval $(ssh-agent -s) - ssh-add "$env:USERPROFILE\.ssh\id_rsa" - - # Display the SSH key - $sshKey = Get-Content "$env:USERPROFILE\.ssh\id_rsa.pub" - Write-Host "Add the following SSH key to your GitHub account:" - Write-Host $sshKey -} - -install_ssh - -# Configure Neovim -Write-Host "Configuring Neovim" -Write-Host "----------------------------------------" -New-Item -ItemType Junction -Force ` - -Path "$home\AppData\Local\nvim" ` - -Target "$home\.config\nvim" - -# Install Windows Terminal, and configure -Write-Host "Install Windows Terminal, and configure" -Write-Host "----------------------------------------" -Move-Item -Force "$home\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" "$home\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json.old" -New-Item -ItemType HardLink -Force ` - -Path "$home\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" ` - -Target "$home\.config\terminal\settings.json" - -# Registry Tweaks -Write-Host "Registry Tweaks" -Write-Host "----------------------------------------" - -# Show hidden files -Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name Hidden -Value 1 - -# Show file extensions for known file types -Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name HideFileExt -Value 0 - -# Never Combine taskbar buttons when the taskbar is full -Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name TaskbarGlomLevel -Value 2 - -# Taskbar small icons -Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name TaskbarSmallIcons -Value 1 - -# Set Windows to use UTC time instead of local time for system clock -Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name RealTimeIsUniversal -Value 1 - -# Function to disable the Windows key -function Disable-WindowsKey { - $scancodeMap = @( - 0x00000000, 0x00000000, 0x00000003, 0xE05B0000, 0xE05C0000, 0x00000000 - ) - - $binaryValue = New-Object byte[] ($scancodeMap.Length * 4) - [System.Buffer]::BlockCopy($scancodeMap, 0, $binaryValue, 0, $binaryValue.Length) - - Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout" -Name "Scancode Map" -Value $binaryValue - - Write-Output "Windows key has been disabled. Please restart your computer for the changes to take effect." -} - -# Check if running as Administrator and call the function -if (Test-IsAdmin) { - Disable-WindowsKey -} else { - Write-Output "You need to run this script as Administrator to disable the Windows key." -} -# Restart to apply changes -Write-Host "Restarting system to apply changes..." -Restart-Computer -Force +## WSL +#Write-Host "Configuring WSL" +#wsl --install -d Ubuntu +# +## Function to install SSH +#function install_ssh { +# Write-Host "Setting Up SSH" +# Start-Service ssh-agent +# Start-Service sshd +# Set-Service -Name ssh-agent -StartupType 'Automatic' +# Set-Service -Name sshd -StartupType 'Automatic' +# +# # Generate SSH key if not exists +# if (-not (Test-Path -Path "$env:USERPROFILE\.ssh\id_rsa.pub")) { +# ssh-keygen -t rsa -b 4096 -C "$env:USERNAME@$(hostname)" -f "$env:USERPROFILE\.ssh\id_rsa" -N "" +# } +# +# # Start ssh-agent and add key +# eval $(ssh-agent -s) +# ssh-add "$env:USERPROFILE\.ssh\id_rsa" +# +# # Display the SSH key +# $sshKey = Get-Content "$env:USERPROFILE\.ssh\id_rsa.pub" +# Write-Host "Add the following SSH key to your GitHub account:" +# Write-Host $sshKey +#} +# +#install_ssh +# +## Configure Neovim +#Write-Host "Configuring Neovim" +#Write-Host "----------------------------------------" +#New-Item -ItemType Junction -Force ` +# -Path "$home\AppData\Local\nvim" ` +# -Target "$home\.config\nvim" +# +## Install Windows Terminal, and configure +#Write-Host "Install Windows Terminal, and configure" +#Write-Host "----------------------------------------" +#Move-Item -Force "$home\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" "$home\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json.old" +#New-Item -ItemType HardLink -Force ` +# -Path "$home\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" ` +# -Target "$home\.config\terminal\settings.json" +# +## Registry Tweaks +#Write-Host "Registry Tweaks" +#Write-Host "----------------------------------------" +# +## Show hidden files +#Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name Hidden -Value 1 +# +## Show file extensions for known file types +#Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name HideFileExt -Value 0 +# +## Never Combine taskbar buttons when the taskbar is full +#Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name TaskbarGlomLevel -Value 2 +# +## Taskbar small icons +#Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name TaskbarSmallIcons -Value 1 +# +## Set Windows to use UTC time instead of local time for system clock +#Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name RealTimeIsUniversal -Value 1 +# +## Function to disable the Windows key +#function Disable-WindowsKey { +# $scancodeMap = @( +# 0x00000000, 0x00000000, 0x00000003, 0xE05B0000, 0xE05C0000, 0x00000000 +# ) +# +# $binaryValue = New-Object byte[] ($scancodeMap.Length * 4) +# [System.Buffer]::BlockCopy($scancodeMap, 0, $binaryValue, 0, $binaryValue.Length) +# +# Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout" -Name "Scancode Map" -Value $binaryValue +# +# Write-Output "Windows key has been disabled. Please restart your computer for the changes to take effect." +#} +# +## Check if running as Administrator and call the function +#if (Test-IsAdmin) { +# Disable-WindowsKey +#} else { +# Write-Output "You need to run this script as Administrator to disable the Windows key." +#} +## Restart to apply changes +#Write-Host "Restarting system to apply changes..." +#Restart-Computer -Force |
