Skip to content

Collection of configuration files for Microsoft Windows development.

Notifications You must be signed in to change notification settings

farhanmustar/windows-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windows configuration guide

Make sure all run in admin powershell

Chocolatey Package Manager

Install chocolatey from chocolatey.org.

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Recommended Package to Install

install all other software using chocolatey

choco install `
postman `
free-download-manager `
psutils `
wezterm `
rclone `
vcxsrv `
filezilla dbeaver 7zip `
advanced-ip-scanner wireshark `
libreoffice notepadplusplus `
paint.net inkscape `
vlc `
git `
flameshot `
powertoys `
cpu-z hwmonitor wiztree `
-y

Note on sudo

sudo keyword is available after installing psutils, which is included in the above install command. Users can now install using chocolatey without admin enabled powershell as shown below.

sudo choco install <software_name>

Install scoop

Some application not available in chocolatey, we can use scoop instead.
Install command

iwr -useb get.scoop.sh | iex
scoop bucket add extras

WSL configuration

Install default (ubuntu) distribution

wsl --install

Configure wsl to not add path to host windows bin.

  • start wsl
  • copy file from wsl/wsl.conf to /etc/wsl.conf
  • shutdown wsl to allow it to reload config.
wsl --shutdown

Passthrough host cmd in wsl

sudo ln -sT /mnt/c/Windows/explorer.exe /usr/bin/explorer
sudo ln -sT /mnt/c/Windows/System32/wsl.exe /usr/bin/wsl
sudo ln -sT /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe /usr/bin/powershell
sudo ln -sT /mnt/c/Windows/System32/clip.exe /usr/bin/clip

Execute powershell from wsl bash

Add following to bash_alias.

alias pwsh='powershell -Command'

This allow for executing powershell cmd such as chocolatey install

pwsh sudo choco install ...
pwsh Get-VM
pwsh "iwr -useb get.scoop.sh | iex"  # pipe need to be in quote 

Install build-essential

sudo apt install build-essential

Fix ls color for windows files.

  • copy this into ~/.bashrc.
export LS_COLORS="$(echo $LS_COLORS)ow=01;34:"

Configure Hyper-V

Hyper-V is not turn on by default. Enable it:

  • Search and start "Turn Window features on or off"
  • Tick Hyper-V option.
  • !make sure do not use dynamic or expanding hard disk. it will keep growing without shrinking.

Optional Workflow Note

Configure new virtual switch (default switch need to use dhcp for internet and external network)

  • Open Hyper-V Manager after reboot.
  • Add new virtual switch (Internal) and named is as "192.168.5.1"
  • Search and start "View network connections".
  • Configure new vEthernet(192.168.5.1) with static ip of 192.168.5.1.

When adding new virtual machine

  • Suffix it name with default ip such as 192.168.5.2
  • Add new network adapter and connect to "192.168.5.1" switch.
  • Start virtual machine and configure the adapter to be the assigned ip.

Configure Keyboard Shortcut.

  • Note: if app delay start when pressing shortcut, open menu and search for background apps. Then disable all except used one.

Configure dotfiles inside wsl

Clone dotfiles repo at https://github.com/farhanmustar/dotfiles.git.

git clone https://github.com/farhanmustar/dotfiles.git

Configure Keyboard Mapping

To remap caps_lock key to esc key and scroll_lock key to caps_lock key.

  • Double click keyboard_remap/remap_caps_lock_to_escape_scroll_lock_to_caps_lock.reg and accept importing the register

To restore back the keyboard layout maping to default value

  • Double click keyboard_remap/default_keyboard_remap.reg and accept importing the register

Configure Browser

install extension

  • vimmium c
    • configure search to accept js regex
  • dark reader
    • configure dark reader shortcut to ctrl+shift+d
  • js error notify
  • free download manager for chrome

Install Tiling Window Management (Komorebi)

scoop install komorebi
scoop install autohotkey
  • Set environment variable KOMOREBI_CONFIG_HOME to ~/.config/komorebi (in full windows path)
  • Copy autohotkey script from .config/komorebi into KOMOREBI_CONFIG_HOME path.
  • Create link to following bash script and set Ctrl + Alt + s to execute it.
komorebic.exe start

Alternatively Software

Gimp instead of Paint.net

choco install gimp -y

or gimp with photoshop-like plugin.

choco install photogimp -y

Chrome instead of Edge

choco install googlechrome -y

Virtualbox instead of Hyper-V

choco install virtualbox -y --params "/ExtensionPack"

Extra Note

PlatformIO Development

Need to use pip to install only. Refer to python section to install pip.

pip install platformio

PCB Circuit Design

Download easyeda manually, for now no package on chocolatey.

choco install kicad -y

Build in board should be enough, But if required can try to search at snapeda.com. Maybe add other library:- SparkFun Digi-Key

3D CAD Editing

choco install freecad -y

PC Gaming

choco install origin steam epicgameslauncher ds4windows -y

Latex Editor

Currently not working, need to install manually. Miktex have mpm as its package manager can explore that.

choco install miktex --params '"/Set:essential"' -y

Media Software

Webcam and Screen Recording

choco install obs-studio -y
choco install screentogif -y

Audio Editing

choco install audacity -y

Video Editing

choco install kdenlive -y

On-screen keyboard display

choco install keycastow -y

Hard Disk Health Monitor and Benchmark Tools

choco install crystaldiskmark crystaldiskinfo -y

Iso editing tools

winget install anyburn rufus

VNC client

winget install tigervnc

on ubuntu to run vnc server do this

sudo apt install x11vnc
sudo -u guiuser bash -c "x11vnc -forever -nopw -display :0"

Proxy connection

  • Using tinyproxy installed on ubuntu (wsl)
sudo apt install tinyproxy
  • Tinyproxy default to use port 8888 and listend to all interface so no need to configure.
  • Wsl does not have systemd so we manually run tinyproxy.
sudo tinyproxy -d
  • Port forward the port 8888 to remote server using -R 8888:localhost:8888
  • On the remote server we have to configure env variable to use the proxy.
export http_proxy="http://localhost:8888/"
export ftp_proxy="http://localhost:8888/"
  • For apt, it will not use proxy set by env. Instead add the following config.
  • edit /etc/apt/apt.conf.d/99proxy.conf
Acquire::http::Proxy "http://localhost:8888";
Acquire::https::Proxy "http://localhost:8888";

TODO

Explore Powershell Galery

Powershell got its own build in module manager. Need to explore, as for now the package available is very limited.

https://www.powershellgallery.com/packages

Explore Windows Package Manager

Windows package manager.

https://docs.microsoft.com/en-gb/windows/package-manager/

Abandon Note

Note that are not relevant anymore.

Powershell Core Configuration

Change Powershell tab completion behaviour and set ls alias to get-childitemcolorformatwide

copy ./PowerShell/profile.ps1 to ~/Documents/PowerShell/profile.ps1

set script execution policy to remotesigned

Set-ExecutionPolicy remotesigned

Install Scripts

copy content of ./scripts to /ProgramData/Chocolatey/bin

Recommended Package to Install

install all other software using chocolatey

choco install `
psutils get-childitemcolor `
powershell-core `
microsoft-windows-terminal `
neovim universal-ctags git rclone `
ripgrep grep less which wget rsync watchexec fd tac findutils `
putty.install vcxsrv `
--install-arguments='"ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1"' `
--params "/NoGuiHereIntegration /NoShellHereIntegration" `
--ignore-checksums -y

Note on watchexec

For now there is no watch replacement in windows. watchexec is almost similar to watch, but only execute command if got file change. Exemple: execute node index.js if file change in current directory.

watchexec -- node .\index.js

TIPS: for nodejs use console.clear() inside index.js to clear console log before print new stuff.

Configure NeoVim

To ensure consistent configuration path with linux,

  • set XDG_CONFIG_HOME to C:\Users\<username>\.config in user env variable.

To use Nightly NeoVim.

choco update neovim --pre

Share clipboard with remote server through ssh with putty

  • On server, install xclip. For example, in ubuntu:
apt install xclip
  • Run the vcxsrv on host machine.
  • Set DISPLAY environment variable to localhost:10.0
export DISPLAY=localhost:10.0
  • Test xserver forwarding working by using xclock
xclock

Configure Keyboard Shortcut.

Configure putty shortcut to be ctrl + alt + r

Configure windows terminal shortcut to be ctrl + alt + t

  • open run window + r
  • run this shell:AppsFolder
  • create shortcut for windows terminal at C:\ProgramData\Microsoft\Windows\Start Menu\Programs
  • right click properties and add keyboard shortcut.

Configure Putty

putty use register to store settings. Double click on ./putty/putty.reg then accept importing the register.

configure shortcut for pagent to pass private key,
just add path of the key in quote after the pagent url.

configure Xlaunch. then save the config to document folder. (xserver.xlaunch)

Configure Vim

Clone dotfiles repo at https://github.com/farhanmustar/dotfiles.git. Run vim and run :PlugInstall to install all plugins.

git clone https://github.com/farhanmustar/dotfiles.git

Configure Windows Terminal

copy paste settings from ./windows-terminal/settings.json to terminal settings.

Openssl Tools

choco install openssl openssl-wizard -y

Android Development

choco install androidstudio -y

Add set ANDROID_HOME path to the sdk path. Add set JAVA_HOME path to C:\Program Files\Android\Android Studio\jre Add C:\Program Files\Android\Android Studio\jre\bin to Path env variable. Add sdk/tools, sdk/tools/bin and sdk/platform-tools to Path env variable.

Nodejs Development

choco install nodejs -y

basic tools used to build pkg manually.

sudo npm install -g windows-build-tools

Python 2.x Development

choco install python2 -y

Remove python alias. windows did that to auto start windows store when use python keyword.why!!!

  • Go to start menu and search manage app execution aliases
  • Disable alias for python and python 3.

PHP Development

choco install composer -y

Arduino Development

choco install arduino arduino-cli -y

Use pageant for powershell openssh ssh-agent.

Install wsl-ssh-pageant to allow use of pageant as ssh auth. (required scoop package manager)

scoop install wsl-ssh-pageant

copy ssh-pageant.bat script and added to path. copy script from ./scripts/ssh-pageant.bat to /ProgramData/Chocolatey/bin set env variable SSH_AUTH_SOCK to ssh-pageant.

SSH_AUTH_SOCK=\\.\pipe\ssh-pageant

How to use.

  • start Pageant.
  • run ssh-pageant command from terminal.
  • use ssh command as usual.

Use pageant for git ssh auth

configure git to use ssh key from putty. (git use windows credential manager for http/s)

note that thare is bug to add new server to known host in terminal. need to manually ssh using putty and accept in gui.

Set env variable GIT_SSH to plink.exe path. hint: use which plink to display its path.

GIT_SSH=C:\ProgramData\chocolatey\bin\PLINK.EXE

Use pass pagent as ssh-agent to wsl from windows host.

Follow similar step to use pagent in powershell ssh-agent. Then in wsl add environment variable in .bashrc

export SSH_AUTH_SOCK=/mnt/c/ssh-agent.sock

Experimental (winget)

  • Microsoft added winget which is a build in package manager preloaded with windows.
  • Noticed this is more like semi auto as the permission popup still require user input.
winget install wez.wezterm `
famatech.advancedipscanner `
microsoft.powertoys `
logitech.options `
7zip.7zip `
flameshot.flameshot `
notepad++ `
chocolatey `
libreoffice `
videolan.vlc `
inkscape.inkscape `
mozilla.firefox `
nickemanarin.screentogif `
dotpdnllc.paintdotnet `
AntibodySoftware.WizTree `
kde.kdenlive `
obsproject.obsstudio `
techpowerup.gpu-z `
techpowerup.gpu-z `
lars-berger.GlazeWM `
CPUID.HWMonitor `
--disable-interactivity 

Extra

winget install `
postman.postman `
handbrake.handbrake `
mulaRahul.Keyviz `
--disable-interactivity 

TODO:

pencil project ui design gravit designer

Hyper-V for Windows Home

https://github.com/proviq/AccountManagement/releases https://www.makeuseof.com/install-hyper-v-windows-11-home/

pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
pause

GlazeWM Note

  • currently using patched version. Need to compile manually.

setup waktu solat using script to run every minute

  • run in powershell
cp ./PowerShell/waktusolat.ps1 $HOME/Documents
cd $HOME/Documents
sudo schtasks /create /tn waktusolatTask /tr "powershell -NoLogo -WindowStyle hidden -file C:\waktusolat.ps1" /sc minute /mo 1 /ru System