Skip to content

Commit

Permalink
Merge pull request #271 from kachick/windows
Browse files Browse the repository at this point in the history
Manage Windows dotfiles and tips
  • Loading branch information
kachick authored Aug 20, 2023
2 parents 95c86c3 + 2bc9740 commit d2481ea
Show file tree
Hide file tree
Showing 7 changed files with 256 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ script = [
dependencies = ['build']
script = [
"git config --local core.hooksPath .githooks",
"git config --local core.whitespace cr-at-eol",
]

[tasks.update]
Expand Down
3 changes: 2 additions & 1 deletion dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
},
"excludes": [
".git",
"**/*-lock.json"
"**/*-lock.json",
"winget*"
],
"plugins": [
"https://plugins.dprint.dev/json-0.17.4.wasm",
Expand Down
8 changes: 8 additions & 0 deletions windows/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

# https://github.com/PowerShell/PowerShell/blob/a46843de2119203dc9c8db258138450d4a847c12/.editorconfig
[*.{cs,ps1,psd1,psm1}]
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = true
134 changes: 134 additions & 0 deletions windows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# FAQ

## Configuration steps after installation packages

1. Change Dropbox storage path from `C:\Users`, default path made problems in System Restore.
\
See https://zmzlz.blogspot.com/2014/10/windows-dropbox.html for detail
1. Enable Bitlocker and backup the restore key

## How to install WSL2?

winget does not support it, run as follows

```powershell
wsl.exe --install
```

## How to export winget list?

```powershell
winget export --output "\\wsl.localhost\Ubuntu\home\kachick\repos\dotfiles\windows\winget-list-$(Get-Date -UFormat '%F')-raw.json"
```

It may be better to remove some packages such as `Mozilla.Firefox.DeveloperEdition`.

## Which programs excluded winget-pkgs are needed?

- https://github.com/karakaram/alt-ime-ahk
- https://github.com/yuru7/PlemolJP
- https://www.realforce.co.jp/support/download/
- https://www.kioxia.com/ja-jp/personal/software/ssd-utility.html

## Why avoiding winget to install Firefox Developer Edition?

No Japanese locale is registered in winget yet, official installer is supporting.

- https://github.com/kachick/times_kachick/issues/235
- https://github.com/microsoft/winget-pkgs/tree/be851349a154acb14af6275812d79b70fadb9ddf/manifests/m/Mozilla/Firefox/DeveloperEdition/117.0b9

## How to open current directory in WSL2 with Windows Explorer?

In WSL shell

```bash
explorer.exe .
```

## How to move on Windows folder from WSL2?

```bash
z "$(wslpath 'G:\GoogleDrive')"
```

## I forgot to backup Bitlocker restore key 😋

https://account.microsoft.com/devices/recoverykey may help

## How to write PowerShell scripts?

- https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines
- https://github.com/MicrosoftDocs/PowerShell-Docs/blob/a5caf0d1104144f66ea0d7b9e8b2980cf9c605e9/reference/docs-conceptual/community/contributing/powershell-style-guide.md
- https://github.com/kachick/learn_PowerShell

## How to run PowerShell scripts in this repo?

If you faced following error, needed to enable the permission from Administrator's PowerShell terminal

```plaintext
.\windows\enable_verbose_context_menu.ps1: File \\wsl.localhost\Ubuntu\home\kachick\repos\dotfiles\windows\enable_verbose_context_menu.ps1 cannot be loaded. The file \\wsl.localhost\Ubuntu\home\kachick\repos\dotfiles\windows\enable_verbose_context_menu.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
```

Executing loccal scrips just requires "RemoteSigned", but in wsl path, it is remote, so needed to relax more.

```powershell
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
```

```console
> Get-ExecutionPolicy -List

Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Unrestricted
LocalMachine Undefined
```

After completed tasks, disable it as follows

```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```

## History in PowerShell does not work...

If PowerShell in WindowsTerminal displaying as below,

```plaintext
PowerShell 7.3.6
Cannot load PSReadline module. Console is running without PSReadline.
```

I have faced this problem when called `Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser`.\
Try to set the permission as `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`

https://github.com/microsoft/terminal/issues/7257#issuecomment-1107700978

## Some PowerShell scripts did not change windows behaviors

https://answers.microsoft.com/en-us/windows/forum/all/windows-registry-changes-is-a-restart-always/e131b560-1d03-4b12-a32c-50df2bf12752

After registry editing, needs to restart windows or the process

## Why are you still using Google Japanese Input? Why don't you prefer Microsoft IME?

Pros for Microsoft IME

- Preinstalled by Windows
- It is having cloud translations now (Called as "予測変換")

Cons for Microsoft IME

- Needed to tab, not in space to get date as "きょう"
- No way to get date with ISO 8601 format

## How to remove Windows Widget?

Remove the noisy news widget as below!

```powershell
winget uninstall --id 9MSSGKG348SP
```
2 changes: 2 additions & 0 deletions windows/enable_verbose_context_menu.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve /f
Write-Output 'Completed, you need to close and restart all "explorer" processes'
83 changes: 83 additions & 0 deletions windows/winget-list-core.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"$schema" : "https://aka.ms/winget-packages.schema.2.0.json",
"CreationDate" : "2023-08-20T15:44:57.913-00:00",
"Sources" :
[
{
"Packages" :
[
{
"PackageIdentifier" : "7zip.7zip"
},
{
"PackageIdentifier" : "Canonical.Ubuntu.2204"
},
{
"PackageIdentifier" : "Docker.DockerDesktop"
},
{
"PackageIdentifier" : "Dropbox.Dropbox"
},
{
"PackageIdentifier" : "Microsoft.Edge"
},
{
"PackageIdentifier" : "Microsoft.EdgeWebView2Runtime"
},
{
"PackageIdentifier" : "Microsoft.WindowsTerminal"
},
{
"PackageIdentifier" : "Microsoft.OneDrive"
},
{
"PackageIdentifier" : "Twilio.Authy"
},
{
"PackageIdentifier" : "TrackerSoftware.PDF-XChangeEditor"
},
{
"PackageIdentifier" : "Kensington.KensingtonWorks"
},
{
"PackageIdentifier" : "Google.JapaneseIME"
},
{
"PackageIdentifier" : "Microsoft.VCRedist.2015+.x64"
},
{
"PackageIdentifier" : "Lapce.Lapce"
},
{
"PackageIdentifier" : "Microsoft.PowerShell"
},
{
"PackageIdentifier" : "Alacritty.Alacritty"
},
{
"PackageIdentifier" : "Google.GoogleDrive"
},
{
"PackageIdentifier" : "Microsoft.VisualStudioCode"
},
{
"PackageIdentifier" : "Google.Chrome"
},
{
"PackageIdentifier" : "Microsoft.PowerToys"
},
{
"PackageIdentifier" : "Google.VPNByGoogleOne"
}
],
"SourceDetails" :
{
"Argument" : "https://cdn.winget.microsoft.com/cache",
"Identifier" : "Microsoft.Winget.Source_8wekyb3d8bbwe",
"Name" : "winget",
"Type" : "Microsoft.PreIndexed.Package"
}
}
],
"WinGetVersion" : "1.5.2201"
}
26 changes: 26 additions & 0 deletions windows/winget-list-entertainment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema" : "https://aka.ms/winget-packages.schema.2.0.json",
"CreationDate" : "2023-08-20T17:20:17.221-00:00",
"Sources" :
[
{
"Packages" :
[
{
"PackageIdentifier" : "Amazon.Music"
},
{
"PackageIdentifier" : "Valve.Steam"
}
],
"SourceDetails" :
{
"Argument" : "https://cdn.winget.microsoft.com/cache",
"Identifier" : "Microsoft.Winget.Source_8wekyb3d8bbwe",
"Name" : "winget",
"Type" : "Microsoft.PreIndexed.Package"
}
}
],
"WinGetVersion" : "1.5.2201"
}

0 comments on commit d2481ea

Please sign in to comment.