From 3fecc04ed069c6b25b354df0b5d4dee8828ce538 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 | 11 +++++++++++ 2 files changed, 17 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 faa2e48d..911d0617 100644 --- a/scripts/Windows/Software/Windows/Manage.ps1 +++ b/scripts/Windows/Software/Windows/Manage.ps1 @@ -124,6 +124,17 @@ 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; };