Skip to content

Instantly share code, notes, and snippets.

@kwesthaus
Last active October 12, 2023 05:51
Show Gist options
  • Save kwesthaus/44c2e2f6d82596e1570876d66bde2829 to your computer and use it in GitHub Desktop.
Save kwesthaus/44c2e2f6d82596e1570876d66bde2829 to your computer and use it in GitHub Desktop.
windows-setup-notes
# Capsicain.example.ini config file
# This is an example for a capsicain config. It is not useful, it just shows the basic features.
# See the full capsicain.cajhin.ini for a lot more information.
# If you have trouble figuring out how to 'code' your use case, open an issue here: https://github.com/cajhin/capsicain/issues/
# Rename this file to capsicain.ini to make it active.
# Press [ESC] + [R] to reset/reload any changes you make to this file.
GLOBAL IniVersion kyle_ini_v1
# any string, so you can check with [ESC]+[S]tatus if you're running the right config
GLOBAL ActiveConfigOnStartup 1
# The section [CONFIG_1] is active on startup
# Switch configs with [ESC]+[0..9]
# 0=hardcoded = no changes at all to any key events
# 1=Qwerty
# Needed to preserve SC_BREAK for RDP
GLOBAL DontTranslateMessyKeys
[CONFIG_1]
OPTION configName = Kyle-Config_1
# This option switches LALT and LWIN on Apple keyboards
# OPTION FlipAltWinOnAppleKeyboards
# verbose logging. Switch with [ESC]+[D]
# OPTION Debug
# [ MOD12 MOD11 MOD10 MOD9 RALT RWIN RCTRL RSHF LALT LWIN LCTRL LSHF ]
# e.g. the symbol for "and MOD9 down" is [....& .... ....]
# Make LWIN key the virtual modifier MOD9 key
REWIRE LWIN MOD9
# Restore LWIN functionality if needed by holding RALT key. Ignore tap, tap&hold
REWIRE RALT LWIN // //
# LWIN + LALT + vimarrows, do NOT pass through modifiers
COMBO H [^^^& ^^^^ &^^^] > moddedKey (LEFT + .... ....)
COMBO J [^^^& ^^^^ &^^^] > moddedKey (DOWN + .... ....)
COMBO K [^^^& ^^^^ &^^^] > moddedKey (UP + .... ....)
COMBO L [^^^& ^^^^ &^^^] > moddedKey (RIGHT + .... ....)
# Map LWIN + / to the key sequence that breaks out of RDP fullscreen (SC_BREAK with Ctrl and Alt modifiers)
COMBO / [^^^& ^^^^ ^^^^] > moddedKey (SC_BREAK + .... .... &.&.)
# GlazeWM doesn't restore focus to RDP the way it likes, so remap LWIN + . to the normal DWM way to make fullscreen (WIN + UP)
COMBO . [^^^& ^^^^ ^^^^] > moddedKey (UP + .... .... .&..)
# Treat LWIN + ; as LWIN + L
COMBO ; [^^^& ^^^^ ^^^^] > moddedKey (L + .... .... .&..)
# Essentially use F15 as our own modifier
# All the below are processed in GlazeWM
# LWIN + vimarrows, pass through modifiers
COMBO H [^^^& .... ....] > combo(F15+H)
COMBO J [^^^& .... ....] > combo(F15+J)
COMBO K [^^^& .... ....] > combo(F15+K)
COMBO L [^^^& .... ....] > combo(F15+L)
# LWIN + #, pass through modifiers
COMBO 1 [^^^& .... ....] > combo(F15 + 1)
COMBO 2 [^^^& .... ....] > combo(F15 + 2)
COMBO 3 [^^^& .... ....] > combo(F15 + 3)
COMBO 4 [^^^& .... ....] > combo(F15 + 4)
COMBO 5 [^^^& .... ....] > combo(F15 + 5)
COMBO 6 [^^^& .... ....] > combo(F15 + 6)
COMBO 7 [^^^& .... ....] > combo(F15 + 7)
COMBO 8 [^^^& .... ....] > combo(F15 + 8)
COMBO 9 [^^^& .... ....] > combo(F15 + 9)
COMBO 0 [^^^& .... ....] > combo(F15 + 0)
# LWIN + Tab, pass through modifiers
COMBO Tab [^^^& .... ....] > combo(F15 + Tab)
# LWIN + Enter, pass through modifiers
COMBO Ret [^^^& .... ....] > combo(F15 + Ret)
# LWIN + (other letters), pass through modifiers
COMBO Q [^^^& .... ....] > combo(F15 + Q)
COMBO R [^^^& .... ....] > combo(F15 + R)
COMBO E [^^^& .... ....] > combo(F15 + E)
COMBO V [^^^& .... ....] > combo(F15 + V)
COMBO N [^^^& .... ....] > combo(F15 + N)
COMBO Space [^^^& .... ....] > combo(F15 + Space)
general:
# Whether to automatically focus windows underneath the cursor.
focus_follows_cursor: false
# Whether to jump the cursor between windows focused by the WM.
cursor_follow_focus: false
# Whether to switch back and forth between the previously focused workspace
# when focusing the current workspace.
toggle_workspace_on_refocus: true
# Whether to show floating windows as always on top.
show_floating_on_top: false
# Amount to move floating windows by (eg. when using `alt+<hjkl>` on a floating window)
floating_window_move_amount: "5%"
# *Strongly* recommended to set to 'false'. Whether to globally enable/disable
# window transition animations (on minimize, close, etc). Set to 'unchanged'
# to make no setting changes.
window_animations: "false"
gaps:
# Gap between adjacent windows.
inner_gap: "5px"
# Gap between windows and the screen edge.
# outer_gap: "5px 5px 65px"
outer_gap: "5px"
# Highlight active/inactive windows with a colored border.
# ** Exclusive to Windows 11 due to API limitations.
focus_borders:
active:
enabled: true
color: "#0000ff"
inactive:
enabled: false
color: "#ff0000"
bar:
height: "30px"
position: "top"
opacity: 1.0
background: "#20242cc4"
foreground: "#ffffff"
font_family: "Segoe UI"
font_size: "13px"
padding: "4px 6px"
offset_x: "0"
offset_y: "0"
border_radius: "0"
components_left:
- type: "workspaces"
focused_workspace_background: "#ffffff33"
displayed_workspace_background: "#00000033"
default_workspace_background: "transparent"
components_center:
- type: "window title"
components_right:
- type: "system tray"
- type: "tiling direction"
label_horizontal: "⮂"
label_vertical: "⮁"
background: "#ffffff33"
margin: "0 4px"
padding: "0 8px"
- type: "binding mode"
background: "#ffffff33"
margin: "0 4px 0 0"
padding: "0 8px"
- type: "clock"
# Documentation on formatting date/time string:
# https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
time_formatting: "hh:mm tt ddd MMM d"
workspaces:
- name: "1"
bind_to_monitor: 1
- name: "2"
bind_to_monitor: 1
- name: "3"
bind_to_monitor: 1
- name: "4"
bind_to_monitor: 1
- name: "5"
bind_to_monitor: 1
- name: "6"
bind_to_monitor: 2
- name: "7"
bind_to_monitor: 2
- name: "8"
bind_to_monitor: 2
- name: "9"
bind_to_monitor: 2
- name: "0"
bind_to_monitor: 2
window_rules:
# Task Manager requires admin privileges to manage and should be ignored unless running
# the WM as admin.
- command: "ignore"
match_process_name: "/Taskmgr|ScreenClippingHost/"
# Launches system dialogs as floating by default (eg. File Explorer save/open dialog).
- command: "set floating"
match_class_name: "#32770"
# Some applications (eg. Steam) have borders that extend past the normal border size.
- command: "resize borders 0px -7px -7px -7px"
match_process_name: "steam"
binding_modes:
- name: "resize"
keybindings:
# Resize focused window by a percentage or pixel amount.
- command: "resize width -2%"
bindings: ["H", "Left"]
- command: "resize width +2%"
bindings: ["L", "Right"]
- command: "resize height +2%"
bindings: ["K", "Up"]
- command: "resize height -2%"
bindings: ["J", "Down"]
# Press enter/escape to return to default keybindings.
- command: "binding mode none"
bindings: ["Escape", "Enter"]
keybindings:
# Shift focus in a given direction.
- command: "focus left"
bindings: ["F15+H"]
- command: "focus right"
bindings: ["F15+L"]
- command: "focus up"
bindings: ["F15+K"]
- command: "focus down"
bindings: ["F15+J"]
# Move focused window in a given direction.
- command: "move left"
bindings: ["F15+Shift+H"]
- command: "move right"
bindings: ["F15+Shift+L"]
- command: "move up"
bindings: ["F15+Shift+K"]
- command: "move down"
bindings: ["F15+Shift+J"]
# Resize focused window by a percentage or pixel amount.
- command: "resize width -2%"
binding: "Alt+U"
- command: "resize width +2%"
binding: "Alt+P"
- command: "resize height +2%"
binding: "Alt+O"
- command: "resize height -2%"
binding: "Alt+I"
# As an alternative to the resize keybindings above, resize mode enables resizing via
# HJKL or arrow keys. The binding mode is defined above with the name "resize".
- command: "binding mode resize"
binding: "F15+R"
# Change tiling direction. This determines where new tiling windows will be inserted.
- command: "tiling direction vertical"
binding: "F15+V"
- command: "tiling direction horizontal"
binding: "F15+N"
# Change focus between floating / tiling windows.
- command: "focus mode toggle"
binding: "F15+Space"
# Change the focused window to be floating / tiling.
- command: "toggle floating"
binding: "F15+Shift+Space"
# Change the focused window to be maximized / unmaximized.
- command: "toggle maximized"
binding: "Alt+X"
# Minimize focused window.
- command: "set minimized"
binding: "Alt+M"
# Close focused window.
- command: "close"
binding: "F15+Shift+Q"
# Kill GlazeWM process safely.
- command: "exit wm"
binding: "F15+Shift+E"
# Re-evaluate configuration file.
- command: "reload config"
binding: "F15+Shift+R"
# Launch CMD terminal (alternatively `exec wt` or `exec %ProgramFiles%/Git/git-bash.exe`
# to start Windows Terminal and Git Bash respectively.
- command: "exec wt"
binding: "F15+Enter"
# Focus the workspace that last had focus.
- command: "focus workspace recent"
binding: "Alt+Y"
# Focus the next/previous workspace defined in `workspaces` config.
- command: "focus workspace next"
binding: "F15+Tab"
- command: "focus workspace prev"
binding: "F15+Shift+Tab"
# Change focus to a workspace defined in `workspaces` config.
- command: "focus workspace 1"
binding: "F15+1"
- command: "focus workspace 2"
binding: "F15+2"
- command: "focus workspace 3"
binding: "F15+3"
- command: "focus workspace 4"
binding: "F15+4"
- command: "focus workspace 5"
binding: "F15+5"
- command: "focus workspace 6"
binding: "F15+6"
- command: "focus workspace 7"
binding: "F15+7"
- command: "focus workspace 8"
binding: "F15+8"
- command: "focus workspace 9"
binding: "F15+9"
- command: "focus workspace 0"
binding: "F15+0"
# Move focused workspace to a monitor in a given direction.
- command: "move workspace left"
binding: "Alt+A"
- command: "move workspace right"
binding: "Alt+F"
- command: "move workspace up"
binding: "Alt+D"
- command: "move workspace down"
binding: "Alt+S"
# Move focused window to a workspace defined in `workspaces` config.
- commands: ["move to workspace 1", "focus workspace 1"]
binding: "F15+Shift+1"
- commands: ["move to workspace 2", "focus workspace 2"]
binding: "F15+Shift+2"
- commands: ["move to workspace 3", "focus workspace 3"]
binding: "F15+Shift+3"
- commands: ["move to workspace 4", "focus workspace 4"]
binding: "F15+Shift+4"
- commands: ["move to workspace 5", "focus workspace 5"]
binding: "F15+Shift+5"
- commands: ["move to workspace 6", "focus workspace 6"]
binding: "F15+Shift+6"
- commands: ["move to workspace 7", "focus workspace 7"]
binding: "F15+Shift+7"
- commands: ["move to workspace 8", "focus workspace 8"]
binding: "F15+Shift+8"
- commands: ["move to workspace 9", "focus workspace 9"]
bindings: ["F15+Shift+9"]
- commands: ["move to workspace 0", "focus workspace 0"]
bindings: ["F15+Shift+0"]
Set-Alias -Name v -Value 'vim.exe'
function lfcd {
$tmp = [System.IO.Path]::GetTempFileName()
lf -last-dir-path="$tmp" $args
if (Test-Path -PathType Leaf "$tmp") {
$dir = Get-Content "$tmp"
Remove-Item -Force "$tmp"
if (Test-Path -PathType Container "$dir") {
if ("$dir" -ne "$pwd") {
cd "$dir"
}
}
}
}
Set-PSReadLineOption -EditMode Vi
function OnViModeChange {
if ($args[0] -eq 'Command') {
# Set the cursor to a blinking block.
Write-Host -NoNewLine "`e[1 q"
} else {
# Set the cursor to a blinking line.
Write-Host -NoNewLine "`e[5 q"
}
}
Set-PSReadLineOption -ViModeIndicator Script -ViModeChangeHandler $Function:OnViModeChange
Set-PSReadLineKeyHandler -Chord Ctrl+f -ScriptBlock { Invoke-FuzzySetLocation; [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() }
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
Function u([int]$n = 1) {
cd (@('..') * $n -join '/')
}

I'm a heavy Linux user, but sometimes using Windows is a requirement for school or work. Because the computers I use Windows on typically aren't mine, I'm not so interested in scrutinizing every setting for maximum control as I am in reducing the differences between the behavior of Linux and Windows so that I don't lose productivity when switching back and forth. So, I wrote down some of the initial steps I go through on any Windows computer I'm going to be using repeatedly. This is basically a rough approximation of my Arch Linux install notes gist and config-files repo but for Windows.

Install Software

Install winget via App Installer

Winget-installable

winget install Microsoft.WindowsTerminal
winget install Microsoft.PowerShell
winget install vim.vim
winget install gokcehan.lf
winget install BurntSushi.ripgrep.MSVC
winget install junegunn.fzf
winget install sharkdp.bat
# sysinternals
winget install 9P7KNL5RWT25
winget install Microsoft.PowerToys

Powershell-installable

Install-Module -Name PSFzf

In order to obtain Git BASH, with Vim set as the default editor

Customize PowerToys

Customize keyboard shortcuts using PowerToys -> Keyboard Manager

Remap keys

Because I'm a vim user:

  • Caps Lock -> Esc
  • Esc -> Caps Lock

Remap shortcuts

Make moving windows match my i3wm configuration:

  • Win (Left) + Shift (Left) + H -> Win (Left) + Left -> All Apps
  • Win (Left) + Shift (Left) + J -> Win (Left) + Down -> All Apps
  • Win (Left) + Shift (Left) + K -> Win (Left) + Up -> All Apps
  • Win (Left) + Shift (Left) + L -> Win (Left) + Right -> All Apps

Create home row arrow keys (matches my Xkbmap configuration):

  • Win (Left) + Alt (Left) + H -> Left -> All Apps
  • Win (Left) + Alt (Left) + J -> Down -> All Apps
  • Win (Left) + Alt (Left) + K -> Up -> All Apps
  • Win (Left) + Alt (Left) + L -> Right -> All Apps

Make iterating through desktops match my i3wm configuration:

  • Win (Left) + Tab -> Win (Left) + Ctrl (Left) + Right -> All Apps
  • Win (Left) + Shift (Left) + Tab -> Win (Left) + Ctrl (Left) + Left -> All Apps

Fix shortcut for opening taskview, which was covered up by the previous mappings:

  • Win (Left) + T -> Win (Left) + Tab -> All Apps

One thing I DIDN'T do is remap Win + vimarrows (H/J/K/L) since on Windows you can't remap Win + L, which is the shortcut to lock your computer. On Linux with my i3wm configuration these keys move focus between windows in the same desktop, and the lock shortcut is Win + ;. This is the biggest discrepancy between my shortcuts on the different operating systems, but it doesn't bother me too much since the ; key is located close to the L key, accidentally entering Win + ; on Windows isn't harmful (it brings up the emoji picker), and entering Win + L on Linux isn't harmful either.

Set up FancyZones

Learn other keyboard shortcuts

Since the core applications I use change between Linux and Windows, so too do the application-specific shortcuts I use commonly.

Outlook:

  • Ctrl + Y -> Go to Folder
  • Ctrl + Q -> Mark as Read
  • Ctrl + U -> Mark as Unread
  • Alt + H, M, V -> Move to Folder

Teams:

  • Ctrl + . -> Show keyboard shortcuts
  • Ctrl + / -> Show commands
  • Ctrl + G -> Goto
  • Ctrl + E -> Go to Search
  • Ctrl + 1 through Ctrl + 6 -> Open items in left sidebar (Activity, Chat, Teams, Calendar, Calls, and Files, respectively)
  • Ctrl + F -> Search current Chat/Channel messages

Browser add-ons

  • uBlock Origin
  • Vimium

Important settings

Do a quick online search to find the most important settings to change for the current version of Windows and other applications I'm using, e.g. pages like this

Adjust other settings as necessary

Fix other small annoyances as they arise. If I have time, click through the settings of Windows, the browser, and any other applications I commonly use and change anything that sticks out to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment