From 6268eab1e5378d63c74d076108c174b699e27240 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 5 Aug 2024 23:22:22 +0200 Subject: [PATCH] Add an option for showing file extensions --- lib/modules/windows.nix | 6 ++++++ scripts/Windows/Software/Windows/Manage.ps1 | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/modules/windows.nix b/lib/modules/windows.nix index 8d2f192c..df1def16 100644 --- a/lib/modules/windows.nix +++ b/lib/modules/windows.nix @@ -19,6 +19,12 @@ }; }; + showFileExt = mkOption { + type = types.bool; + description = "A value indicating whether file extensions should be displayed in Windows Explorer."; + default = true; + }; + legacyIconSpacing = mkEnableOption "legacy icon spacing" // { default = true; }; diff --git a/scripts/Windows/Software/Windows/Manage.ps1 b/scripts/Windows/Software/Windows/Manage.ps1 index 429ba0b7..a90b281a 100644 --- a/scripts/Windows/Software/Windows/Manage.ps1 +++ b/scripts/Windows/Software/Windows/Manage.ps1 @@ -124,6 +124,16 @@ Start-SoftwareInstaller @PSBoundParameters ` $startLayout | ConvertTo-Json -Compress | Set-Content "$env:SystemDrive\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.json"; } + if (Get-WinConfig "showFileExt") { + Edit-DefaultUserKey { + param ( + [RegistryKey] $Key + ) + + Set-ItemProperty "$($Key.PSPath)\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value 0 -Type "DWord"; + }; + } + Pop-Location; Remove-Item -Recurse $dir; };