diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 933ca0e7..30a94605 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -24,6 +24,8 @@ ## Issue related to PR [What issue is related to this PR (if any)] - Resolves # +[What discussion is related to this PR (if any)] +- Discussion: # ## Additional Information [Any additional information that reviewers should be aware of.] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..1e853399 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: ci +on: + push: + branches: + - master + - main +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - uses: actions/cache@v2 + with: + key: ${{ github.ref }} + path: .cache + - run: pip install mkdocs-material + - run: pip install pillow cairosvg + - run: mkdocs gh-deploy --force \ No newline at end of file diff --git a/.github/workflows/close-discussion.yml b/.github/workflows/close-discussion.yml new file mode 100644 index 00000000..c320a275 --- /dev/null +++ b/.github/workflows/close-discussion.yml @@ -0,0 +1,30 @@ +name: Close Discussion on PR Merge + +on: + pull_request: + types: [closed] + +jobs: + closeDiscussion: + runs-on: ubuntu-latest + steps: + - name: Check if PR was merged + if: github.event.pull_request.merged == true + run: echo "PR was merged" + + - name: Extract Discussion Number + if: github.event.pull_request.merged == true + id: extract-discussion + run: | + echo "::set-output name=discussion::$(echo "${{ github.event.pull_request.body }}" | grep -oP '(?<=Discussion: #)\d+')" + shell: bash + + - name: Close the discussion + if: github.event.pull_request.merged == true && steps.extract-discussion.outputs.discussion + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DISCUSSION_ID: ${{ steps.extract-discussion.outputs.discussion }} + run: | + curl -X PATCH -H "Authorization: token $GITHUB_TOKEN" \ + -d '{"state": "closed"}' \ + "https://api.github.com/repos/${{ github.repository }}/discussions/${DISCUSSION_ID}" diff --git a/.github/workflows/createchangelog.yml b/.github/workflows/createchangelog.yml new file mode 100644 index 00000000..425d3048 --- /dev/null +++ b/.github/workflows/createchangelog.yml @@ -0,0 +1,17 @@ +name: On release published +on: + release: + types: [published] + +jobs: + changelog: + name: Update changelog + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: main + - uses: rhysd/changelog-from-release/action@v3 + with: + file: /docs/updates.md + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/wiki/Battery.md b/Battery.txt similarity index 100% rename from wiki/Battery.md rename to Battery.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 8496f2f9..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,20 +0,0 @@ -## Issues - -If you encounter any challenges or problems with the script, I kindly request that you submit them via the "Issues" tab on the GitHub repository. By filling out the provided template, you can provide specific details about the issue, allowing me (and others in the community) to promptly address any bugs, or consider feature requests. - -## Contribute Code - -Pull Requests are now handled directly on the **MAIN branch**. This was done since we can now select specific releases to launch via releases in GitHub. - -If you're doing code changes, then you can submit a PR to `main` branch, but I am very selective about these. - -> [!WARNING] -> Do not use a code formatter, massive amounts of line changes, and make multiple feature changes. -> EACH FEATURE CHANGE SHOULD BE IT'S OWN Pull Request! - -When creating pull requests, it is essential to thoroughly document all changes made. This includes, but not limited to, documenting any additions made to the `tweaks` section and corresponding `undo tweak`, so users are able to remove the newly added tweaks if necessary, and comprehensive documentation is required for all code changes, document your changes and briefly explain why you made your changes in your Pull Request Description. Failure to adhere to this format may result in denial of the pull request. Additionally, Any code lacking sufficient documentation may also be denied. - -By following these guidelines, we can maintain a high standard of quality and ensure that the codebase remains organized and well-documented. - -> [!NOTE] -> When creating a function, please include "WPF" or "WinUtil" in the file name so it can be loaded into the runspace. diff --git a/Compile.ps1 b/Compile.ps1 index a8bf570d..e5399475 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -56,12 +56,10 @@ Get-ChildItem .\config | Where-Object {$psitem.extension -eq ".json"} | ForEach- # Replace every XML Special Character so it'll render correctly in final build # Only do so if json files has content to be displayed (for example the applications, tweaks, features json files) - # Some Type Convertion using Casting and Cleaning Up of the convertion result using 'Replace' Method + # Make an Array List containing every name at first level of Json File $jsonAsObject = $json | convertfrom-json - $firstLevelJsonList = ([System.String]$jsonAsObject).split('=;') | ForEach-Object { - $_.Replace('=}','').Replace('@{','').Replace(' ','') - } - + $firstLevelJsonList = [System.Collections.ArrayList]::new() + $jsonAsObject.PSObject.Properties.Name | ForEach-Object {$null = $firstLevelJsonList.Add($_)} # Note: # Avoid using HTML Entity Codes, for example '”' (stands for "Right Double Quotation Mark"), # Use **HTML decimal/hex codes instead**, as using HTML Entity Codes will result in XML parse Error when running the compiled script. diff --git a/wiki/Error-in-Winutil-MicroWin-during-ISO-mounting.md b/Error-in-Winutil-MicroWin-during-ISO-mounting.txt similarity index 100% rename from wiki/Error-in-Winutil-MicroWin-during-ISO-mounting.md rename to Error-in-Winutil-MicroWin-during-ISO-mounting.txt diff --git a/README.md b/README.md index 662119a8..71fd1d31 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,13 @@ [![Version](https://img.shields.io/github/v/release/ChrisTitusTech/winutil?color=7a39fb)](https://github.com/ChrisTitusTech/winutil/releases/latest) ![GitHub Downloads (all assets, latest release)](https://img.shields.io/github/downloads/ChrisTitusTech/winutil/latest/total) - +[![](https://dcbadge.limes.pink/api/server/https://discord.gg/RUbZUZyByQ)](https://discord.gg/RUbZUZyByQ) This utility is a compilation of Windows tasks I perform on each Windows system I use. It is meant to streamline *installs*, debloat with *tweaks*, troubleshoot with *config*, and fix Windows *updates*. I am extremely picky about any contributions to keep this project clean and efficient. -![screen-install](screen-install.png) +![screen-install](./docs/assets/screen-install.png) -## Usage +## 💡 Usage Winutil must be run in Admin mode because it performs system-wide tweaks. To achieve this, open PowerShell or Windows Terminal as an administrator. Here are a few ways to do it: @@ -24,99 +24,39 @@ Winutil must be run in Admin mode because it performs system-wide tweaks. To ach ### Launch Command -#### Simple way +#### Stable Branch ```ps1 irm "https://christitus.com/win" | iex ``` -Courtesy of the issue: [#144](/../../issues/144) +#### Dev Branch -If this site is not reachable from your country, please try running it directly from GitHub. ```ps1 -irm "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1" | iex +irm "https://christitus.com/windev" | iex ``` -If you still have Issues, refer to [Known Issues](https://github.com/ChrisTitusTech/winutil/blob/main/KnownIssues.md). +If you have Issues, refer to [Known Issues](https://christitustech.github.io/winutil/KnownIssues/) +## 🎓 Documenation -#### Automation +### [WinUtil Official Documentation](https://christitustech.github.io/winutil/) -Some features are available through automation. This allows you to save your config file pass it to Winutil walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15 - -1. On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system - ![GetInstalled](/wiki/Get-Installed.png) -2. Click on the Settings cog in the upper right corner and chose Export, chose file file and location, this will export the setting file. - ![SettingsExport](/wiki/Settings-Export.png) -3. Copy this file to a USB or somewhere you can use after Windows installation. -4. Use Microwin tab to create a custom Windows image. -5. Install the Windows image. -6. In the new Windows, Open PowerShell in the admin mode and run command to automatically apply tweaks and install apps from the config file. -```ps1 -iex "& { $(irm christitus.com/win) } -Config [path-to-your-config] -Run" -``` -7. Have a cup of coffee! Come back when it's done. - - - -## Support -- To morally and mentally support the project, make sure to leave a ⭐️! -- EXE Wrapper for $10 @ https://www.cttstore.com/windows-toolbox - -## Tutorial +### YouTube Tutorial [![Watch the video](https://img.youtube.com/vi/6UQZ5oQg8XA/hqdefault.jpg)](https://www.youtube.com/watch?v=6UQZ5oQg8XA) -## Overview - -- Install - - Install Selection: Organize programs by category and facilitate installation by enabling users to select programs and initiate the installation process with a single click. - - - Upgrade All: Upgrade all existing programs to their latest versions, ensuring users have the most up-to-date and feature-rich software. - - - Uninstall Selection: Effortlessly uninstall selected programs, providing users with a streamlined way to remove unwanted software from their system. - - - Get Installed: Retrieve a comprehensive list of installed programs on the system, offering users visibility into the software currently installed on their computer. - - - Import / Export: Enable users to import or export the selection list of programs, allowing them to save their preferred program configurations or share them with others. This feature promotes convenience and flexibility in managing program selections across different systems. - -- Tweaks - - Recommended Selection: Provides pre-defined templates tailored for desktop, laptop, and minimal configurations, allowing users to select recommended settings and optimizations specific to their system type. - - - Essential Tweaks: Offers a collection of essential tweaks aimed at improving system performance, privacy, and resource utilization. These tweaks include creating a system restore point, disabling telemetry, Wi-Fi Sense, setting services to manual, disabling location tracking, and HomeGroup, among others. - - - Advanced Tweaks: Encompasses a range of various advanced power user tweaks to further optimize the system. These tweaks include removing OneDrive and Edge, disabling User Account Control (UAC), notification panel, among others. - - - Toggles: Adds easy to use, one click shortcuts for toggling dark mode, NumLock on startup, file extensions, sticky keys, among others. - - - Additional Tweaks: Introduces various other tweaks such as enabling dark mode, changing DNS settings, adding an Ultimate Performance mode, and creating shortcuts for WinUtil tools. These tweaks provide users with additional customization options to tailor their system to their preferences. - -- Config - - Features: Allows users to easily install various essential components and features to enhance their Windows experience. These features include installing .NET Frameworks, enabling Hyper-V virtualization, enabling legacy media support for Windows Media Player and DirectPlay, enabling NFS (Network File System) for network file sharing, and enabling Windows Subsystem for Linux (WSL) for running Linux applications on Windows. - - - Fixes: Provides a range of helpful fixes to address common issues and improve system stability. This includes setting up autologon for seamless login experiences, resetting Windows updates to resolve update-related problems, performing a system corruption scan to detect and repair corrupted files, and resetting network settings to troubleshoot network connectivity issues. - - - Legacy Windows Panels: Includes access to legacy Windows panels from Windows 7, allowing users to access familiar and powerful tools. These panels include Control Panel for managing system settings, Network Connections for configuring network adapters and connections, Power Panel for adjusting power and sleep settings, Sound Settings for managing audio devices and settings, System Properties for viewing and modifying system information, and User Accounts for managing user profiles and account settings. +### [ChrisTitus.com Article](https://christitus.com/windows-tool/) -- Updates: - - Default (Out of Box) Settings: Provides the default settings that come with Windows for updates. +## 💖 Support +- To morally and mentally support the project, make sure to leave a ⭐️! +- EXE Wrapper for $10 @ https://www.cttstore.com/windows-toolbox - - Security (Recommended) Settings: Offers recommended settings, including a slight delay of feature updates by 2 years and installation of security updates 4 days after release. - - - Disable All Updates (Not Recommended!): Allows users to disable all Windows updates, but it's not recommended due to potential security risks. - - -Video and Written Article walkthrough @ - -## Contributing Guidelines - -If you encounter any challenges or problems with the script, or want to contribute code to the project, please consider reading through our [Contributing Guidelines](./CONTRIBUTING.md) - -## Thanks to all Contributors +## 🏅 Thanks to all Contributors Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻. [![Contributors](https://contrib.rocks/image?repo=ChrisTitusTech/winutil)](https://github.com/ChrisTitusTech/winutil/graphs/contributors) -## GitHub Stats +## 📊 GitHub Stats ![Alt](https://repobeats.axiom.co/api/embed/aad37eec9114c507f109d34ff8d38a59adc9503f.svg "Repobeats analytics image") diff --git a/config/applications.json b/config/applications.json index fe8e3393..a7cf5310 100644 --- a/config/applications.json +++ b/config/applications.json @@ -2639,6 +2639,14 @@ "link": "https://zoom.us/", "winget": "Zoom.Zoom" }, + "zoomit": { + "category": "Utilities", + "choco": "na", + "content": "ZoomIt", + "description": "A screen zoom, annotation, and recording tool for technical presentations and demos", + "link": "https://learn.microsoft.com/en-us/sysinternals/downloads/zoomit", + "winget": "Microsoft.Sysinternals.ZoomIt" + }, "zotero": { "category": "Document", "choco": "zotero", @@ -2894,5 +2902,37 @@ "description": "Lenovo Legion Toolkit (LLT) is a open-source utility created for Lenovo Legion (and similar) series laptops, that allows changing a couple of features that are only available in Lenovo Vantage or Legion Zone. It runs no background services, uses less memory, uses virtually no CPU, and contains no telemetry. Just like Lenovo Vantage, this application is Windows only.", "link": "https://github.com/BartoszCichecki/LenovoLegionToolkit", "winget": "BartoszCichecki.LenovoLegionToolkit" + }, + "Pulsar-Edit": { + "category": "Development", + "choco": "pulsar", + "content": "Pulsar", + "description": "A Community-led Hyper-Hackable Text Editor", + "link": "https://pulsar-edit.dev/", + "winget": "Pulsar-Edit.Pulsar" + }, + "Aegisub": { + "category": "Development", + "choco": "aegisub", + "content": "Aegisub", + "description": "Aegisub is a free, cross-platform open source tool for creating and modifying subtitles. Aegisub makes it quick and easy to time subtitles to audio, and features many powerful tools for styling them, including a built-in real-time video preview.", + "link": "https://github.com/Aegisub/Aegisub", + "winget": "Aegisub.Aegisub" + }, + "SubtitleEdit": { + "category": "Multimedia Tools", + "choco": "na", + "content": "Subtitle Edit", + "description": "Subtitle Edit is a free and open source editor for video subtitles.", + "link": "https://github.com/SubtitleEdit/subtitleedit", + "winget": "Nikse.SubtitleEdit" + }, + "Fork": { + "category": "Development", + "choco": "git-fork", + "content": "Fork", + "description": "Fork - a fast and friendly git client.", + "link": "https://git-fork.com/", + "winget": "Fork.Fork" } } diff --git a/config/tweaks.json b/config/tweaks.json index afae0216..7f833a74 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -2305,8 +2305,8 @@ ] }, "WPFTweaksPowershell7": { - "Content": "Replace Default Powershell 5 to Powershell 7", - "Description": "This will edit the config file of the Windows Terminal Replacing the Powershell 5 to Powershell 7 and install Powershell 7 if necessary", + "Content": "Change Windows Terminal default: PowerShell 5 -> PowerShell 7", + "Description": "This will edit the config file of the Windows Terminal replacing PowerShell 5 with PowerShell 7 and installing PS7 if necessary", "category": "Essential Tweaks", "panel": "1", "Order": "a009_", @@ -3067,12 +3067,20 @@ "Order": "a108_", "Type": "Toggle" }, + "WPFToggleHiddenFiles": { + "Content": "Show Hidden Files", + "Description": "If Enabled then Hidden Files will be shown.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a200_", + "Type": "Toggle" + }, "WPFToggleShowExt": { "Content": "Show File Extensions", "Description": "If enabled then File extensions (e.g., .txt, .jpg) are visible.", "category": "Customize Preferences", "panel": "2", - "Order": "a200_", + "Order": "a201_", "Type": "Toggle" }, "WPFToggleTaskbarSearch": { @@ -3080,7 +3088,7 @@ "Description": "If Enabled Search Button will be on the taskbar.", "category": "Customize Preferences", "panel": "2", - "Order": "a201_", + "Order": "a202_", "Type": "Toggle" }, "WPFToggleTaskView": { @@ -3088,7 +3096,7 @@ "Description": "If Enabled then Task View Button in Taskbar will be shown.", "category": "Customize Preferences", "panel": "2", - "Order": "a202_", + "Order": "a203_", "Type": "Toggle" }, "WPFToggleTaskbarWidgets": { @@ -3096,7 +3104,7 @@ "Description": "If Enabled then Widgets Button in Taskbar will be shown.", "category": "Customize Preferences", "panel": "2", - "Order": "a203_", + "Order": "a204_", "Type": "Toggle" }, "WPFOOSUbutton": { diff --git a/KnownIssues.md b/docs/KnownIssues.md similarity index 100% rename from KnownIssues.md rename to docs/KnownIssues.md diff --git a/docs/assets/CommitGHD.png b/docs/assets/CommitGHD.png new file mode 100644 index 00000000..8ab089b2 Binary files /dev/null and b/docs/assets/CommitGHD.png differ diff --git a/docs/assets/CreateBranch.png b/docs/assets/CreateBranch.png new file mode 100644 index 00000000..8d5eef07 Binary files /dev/null and b/docs/assets/CreateBranch.png differ diff --git a/docs/assets/ForkButton.png b/docs/assets/ForkButton.png new file mode 100644 index 00000000..9632f271 Binary files /dev/null and b/docs/assets/ForkButton.png differ diff --git a/wiki/Get-Installed.png b/docs/assets/Get-Installed.png similarity index 100% rename from wiki/Get-Installed.png rename to docs/assets/Get-Installed.png diff --git a/docs/assets/MicroWinScreen.png b/docs/assets/MicroWinScreen.png new file mode 100644 index 00000000..b815187d Binary files /dev/null and b/docs/assets/MicroWinScreen.png differ diff --git a/docs/assets/ProgramInstall.png b/docs/assets/ProgramInstall.png new file mode 100644 index 00000000..654fcadc Binary files /dev/null and b/docs/assets/ProgramInstall.png differ diff --git a/docs/assets/ProgramInstallButton.png b/docs/assets/ProgramInstallButton.png new file mode 100644 index 00000000..1bfb5cb0 Binary files /dev/null and b/docs/assets/ProgramInstallButton.png differ diff --git a/docs/assets/ProgramUninstall.png b/docs/assets/ProgramUninstall.png new file mode 100644 index 00000000..0f1b8d3d Binary files /dev/null and b/docs/assets/ProgramUninstall.png differ diff --git a/wiki/Settings-Export.png b/docs/assets/Settings-Export.png similarity index 100% rename from wiki/Settings-Export.png rename to docs/assets/Settings-Export.png diff --git a/docs/assets/TweaksScreen.PNG b/docs/assets/TweaksScreen.PNG new file mode 100644 index 00000000..6ed96b0e Binary files /dev/null and b/docs/assets/TweaksScreen.PNG differ diff --git a/docs/assets/favicon.png b/docs/assets/favicon.png new file mode 100644 index 00000000..a4f4bc5d Binary files /dev/null and b/docs/assets/favicon.png differ diff --git a/screen-install.png b/docs/assets/screen-install.png similarity index 100% rename from screen-install.png rename to docs/assets/screen-install.png diff --git a/docs/contribute.md b/docs/contribute.md new file mode 100644 index 00000000..857f425e --- /dev/null +++ b/docs/contribute.md @@ -0,0 +1,57 @@ +# How to Contribute? + +## Issues + +* If you encounter any challenges or problems with the script, I kindly request that you submit them via the "Issues" tab on the GitHub repository. By filling out the provided template, you can provide specific details about the issue, allowing me (and others in the community) to promptly address any bugs, or consider feature requests. + +## Contribute Code + +* Pull Requests are now handled directly on the **MAIN branch**. This was done since we can now select specific releases to launch via releases in GitHub. + +* If you're doing code changes, then you can submit a PR to `main` branch, but I am very selective about these. + +> [!WARNING] +> Do not use a code formatter, massive amounts of line changes, and make multiple feature changes. +> EACH FEATURE CHANGE SHOULD BE IT'S OWN Pull Request! + +* When creating pull requests, it is essential to thoroughly document all changes made. This includes, but not limited to, documenting any additions made to the `tweaks` section and corresponding `undo tweak`, so users are able to remove the newly added tweaks if necessary, and comprehensive documentation is required for all code changes, document your changes and briefly explain why you made your changes in your Pull Request Description. Failure to adhere to this format may result in denial of the pull request. Additionally, Any code lacking sufficient documentation may also be denied. + +* By following these guidelines, we can maintain a high standard of quality and ensure that the codebase remains organized and well-documented. + +> [!NOTE] +> When creating a function, please include "WPF" or "WinUtil" in the file name so it can be loaded into the runspace. + +## Walk through + +### Fork the Repo +* Fork the WinUtil Repository [here](https://github.com/ChrisTitusTech/winutil) to create a copy that will be available in your Repository-list. +![Fork](assets/ForkButton.png) + +### Clone the Fork +* While you can make your changes directly through the Web, we recommend cloning the repo to your device to test your fork easily. +* Using the application GitHub Desktop (available in WinUtil) you can easily manage your repos locally. You can do it using other tools like git-cli (available in WinUtil), we recommend GitHub Desktop for ease of use. +* Install GitHub Desktop if not already installed +* Log in using the same GitHub account u used to fork WinUtil +* Choose the fork under "Your Repositories" and press "clone {repo name}" +* Create a new Branch and name it something relatable to your changes, + +* Now you can modify WinUtil to your liking using your prefered text editor. + + +### Testing your changes +* To test to see if your changes work as intended run following commands in a powershell teminal: + +* Change the directory where you are running the commands to the forked project. +* `cd {path to the folder with the compile.ps1}` +* Run following command to compile and run Winutil +* `.\Compile.ps1 -run` +* After seeing that your changes work properly feel free to commit the changes to the repository and make a PR, for help on that follow the documentation below. + +### Commiting the changes +* Commit your changes once you are fine with the result +* Push the changes to "upload" them to your fork on github.com. + +### Making a PR +* To make a PR on your repo under a new branch linking to the main branch a button will show and say Preview and Create pull request. Click that button and fill in all information that is provided on the template. Once all the information is filled in correctly check your PR to make sure there is not a WinUtil.ps1 file attached to the PR. Once everything is good make the PR and wait for Chris (The Maintainer) to accept or deny your PR. Once it is accepted in by Chris you will be able to see your changes in the /windev build. +* If you do not see your feature in the main /win build that is fine. As all new changes go into the /windev build to make sure everything is working ok before going fully public. +* Congrats you just submitted your first PR. Thank you so much for contributing to WinUtil. \ No newline at end of file diff --git a/docs/faq.md b/docs/faq.md new file mode 100644 index 00000000..e3b3daef --- /dev/null +++ b/docs/faq.md @@ -0,0 +1,4 @@ +# FAQ's + +## How do I uninstall WinUtil? +* You do not have to uninstall WinUtil. As it is a script you run from Powershell it only loads into your RAM. This means as soon as you close WinUtil it will be deleted off your system. \ No newline at end of file diff --git a/docs/img/ProgramInstall.png b/docs/img/ProgramInstall.png new file mode 100644 index 00000000..654fcadc Binary files /dev/null and b/docs/img/ProgramInstall.png differ diff --git a/docs/img/ProgramInstallButton.png b/docs/img/ProgramInstallButton.png new file mode 100644 index 00000000..4a3b181b Binary files /dev/null and b/docs/img/ProgramInstallButton.png differ diff --git a/docs/img/favicon.png b/docs/img/favicon.png new file mode 100644 index 00000000..a4f4bc5d Binary files /dev/null and b/docs/img/favicon.png differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..ace691f3 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,12 @@ +# Welcome to Chris Titus WinUtil Official Documentation! + +[![](https://dcbadge.limes.pink/api/server/https://discord.gg/RUbZUZyByQ)](https://discord.gg/RUbZUZyByQ) + +## Running + +There are 4 ways to run WinUtil. The 4 ways goes as follows: + +* `irm christitus.com/win | iex` - Runs WinUtil from ChrisTitus's website using the latest Full Releases. +* `irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex` - Runs WinUtil from github using the latest Full Release. +* `irm christitus.com/windev | iex` - Runs WinUtil from ChrisTitus website using the latest Pre-Release. +* `irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/windev.ps1 | iex` - Runs WinUtil from github using the latest Pre-Release. \ No newline at end of file diff --git a/docs/updates.md b/docs/updates.md new file mode 100644 index 00000000..758fc4bd --- /dev/null +++ b/docs/updates.md @@ -0,0 +1,3 @@ +# Update Log + +# \ No newline at end of file diff --git a/docs/userguide.md b/docs/userguide.md new file mode 100644 index 00000000..38a1e412 --- /dev/null +++ b/docs/userguide.md @@ -0,0 +1,159 @@ +# User Guide + +## Overview +* short one + + +## Walkthrough + +### Program + +#### Installation & Updates +* To install programs select the programs you wish to install or update like the picture below. +![Program Install](assets/ProgramInstall.png) +* Once you have selected the programs you wish to install click the select Install/Upgrade Selected button as seen below. +![Program Install Button](assets/ProgramInstallButton.png) + +#### Upgrade All +* Press the button to upgrade all installed programs that are supported by WinGet, there is no selection needed. + +#### Uninstall +* To uninstall programs select the programs you wish to uninstall like the picture below. +![Program Uninstall](assets/ProgramInstall.png) +* Once you have selected the programs you wish to uninstall click the select Uninstall Selected button as seen below. +![Program Uninstall Button](assets/ProgramUninstall.png) + +#### Get Installed +* Checks for installed programs that are supported by WinGet and selects them in the Utility. + +#### Clear Selection +* Clears ur current selection so no program is checked. + +### Tweaks + +#### Tweaks Addition +* To enable tweaks on your system select Tweaks at the top next to Install. +* Then you can select what tweaks you want adding to your system. We do have some presets you can select from at the top you can see this in the picture below. +![Tweaks Screen](assets/TweaksScreen.PNG) +* After you have chosen your tweaks click the Run Tweaks button at the bottom of the screen. + +#### Tweaks Removal +* To disable tweaks on your system select Tweaks at the top next to Install. +* Then you can select what tweaks you want removing from your system. +* After you have chosen your tweaks you want to remove click the Undo Selected Tweaks button at the bottom of the screen. + +#### Essential Tweaks +* The Tweaks under the Essential + +#### Advanced Tweaks - CAUTION + +#### O&O Shutup + +#### DNS + +#### Customize Preferences + +#### Performance Plans + +#### Shortcuts + + +![Tweaks Screen](assets/TweaksScreen.PNG) + +### Config + +#### Features +* Install the most used Windows Features by checking the checkbox and clicking "Install Features" to install them + +#### Fixes +* Quick Fixes for your system if you are having Issues. + +* Set Up Autologin +* Reset Windows Update +* Reset Network +* System Corruption Scan +* WinGet Reinstall +* Remove Adobe Creative Cloud + +#### Legacy Windows Panels + +### Updates | Not working rn + +### MicroWin + +**MicroWin** lets you customize your Windows 10 and 11 installation images by debloating them however you want. + +![MicroWin](assets/MicroWinScreen.png) + +#### Basic usage + +1. Specify the source Windows ISO to customize + + * If you don't have a Windows ISO file prepared, you can download it using the Media Creation Tool for the respective Windows version. [Here](https://go.microsoft.com/fwlink/?linkid=2156295) is the Windows 11 version, and [here](https://go.microsoft.com/fwlink/?LinkId=2265055) is the Windows 10 version + +2. Configure the debloat process +3. Specify the target location for the new ISO file +4. Let the magic happen! + +**NOTE:** this feature is still in development and you may encounter some issues with the generated images. If that happens, don't hesitate to report an issue! + +#### Options + +* **Download oscdimg.exe from CTT GitHub repo** will grab a OSCDIMG executable from the GitHub repository instead of a Chocolatey package + + OSCDIMG is the tool that lets the program create ISO images. Typically, you would find this in the [Windows Assessment and Deployment Kit](https://learn.microsoft.com/en-us/windows-hardware/get-started/adk-install) + +* Selecting a scratch directory will copy the contents of the ISO file to the directory you specify instead of an automatically generated folder on the `%TEMP%` directory +* You can select an edition of Windows to debloat (**SKU**) using the convenient drop-down menu + + By default, MicroWin will debloat the Pro edition, but you can choose any edition you want + + +##### Customization options + +* **Keep Provisioned Packages**: leaving this option unticked (default) will try to remove every operating system package + + Some packages may remain after processing. This can happen if the packages in question were permanent ones or had been superseded by newer versions + +* **Keep Appx Packages**: leaving this option unticked (default) will try to remove every Microsoft Store app from the Windows image + + This option will exclude some applications that are essential in the case that you want or need to add a Store app later on + +* **Keep Defender**: leaving this option unticked will try to remove every part of Windows Defender, including the Windows Security app + + Leaving this option unticked is **NOT recommended** unless you plan to use a third-party antivirus solution on your MicroWin installation. On that regard, don't install AVs with bad reputation or rogueware + +* **Keep Edge**: leaving this option unticked will try to remove every part of the Microsoft Edge browser using the best methods available + + Leaving this option unticked is not recommended because it might break some applications that might depend on the `Edge WebView2` runtime. However, if that happens, you can easily [reinstall it](https://developer.microsoft.com/en-us/microsoft-edge/webview2) + + +##### Driver integration options + +* **Inject drivers** will add the drivers in the folder that you specify to the target Windows image +* **Import drivers from current system** will add every third-party driver that is present in your active installation + + This makes the target image have the same hardware compatibility of the active installation. However, this means that you will only be able to install the target Windows image and take full advantage of it on computers with **the same hardware**. To avoid this, you'll need to customize the `install.wim` file of the target ISO in the `sources` folder + + +##### Ventoy options + +* **Copy to Ventoy** will copy the target ISO file to any USB drive with [Ventoy](https://ventoy.net/en/index.html) installed + + Ventoy is a solution that lets you boot to any ISO file stored in a drive. Think of it as having multiple bootable USBs in one. Do note though that your drive needs to have enough free space for the target ISO file + + +## Automation + +* Some features are available through automation. This allows you to save your config file pass it to Winutil walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15 + +* On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system +![GetInstalled](assets/Get-Installed.png) +* Click on the Settings cog in the upper right corner and chose Export, chose file file and location, this will export the setting file. +![SettingsExport](assets/Settings-Export.png) +* Copy this file to a USB or somewhere you can use after Windows installation. +* Use Microwin tab to create a custom Windows image. +* Install the Windows image. +* In the new Windows, Open PowerShell in the admin mode and run command to automatically apply tweaks and install apps from the config file. +* ``` iex "& { $(irm christitus.com/win) } -Config [path-to-your-config] -Run" ``` +* Have a cup of coffee! Come back when it's done. \ No newline at end of file diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index 05db4d43..c7f0a8a9 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -125,6 +125,17 @@ Function Get-WinUtilToggleStatus { return $true } } + + if ($ToggleSwitch -eq "WPFToggleHiddenFiles") { + $HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden + if($HiddenFiles -eq 0){ + return $false + } + else{ + return $true + } + } + if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") { $TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa if($TaskbarWidgets -eq 0) { diff --git a/functions/private/Install-WinUtilProgramChoco.ps1 b/functions/private/Install-WinUtilProgramChoco.ps1 index 115030e8..43e42d79 100644 --- a/functions/private/Install-WinUtilProgramChoco.ps1 +++ b/functions/private/Install-WinUtilProgramChoco.ps1 @@ -85,7 +85,7 @@ function Install-WinUtilProgramChoco { # Cleanup leftovers files if(Test-Path -Path $installOutputFilePath){ Remove-Item -Path $installOutputFilePath } - if(Test-Path -Path $installOutputFilePath){ Remove-Item -Path $uninstallOutputFilePath } + if(Test-Path -Path $uninstallOutputFilePath){ Remove-Item -Path $uninstallOutputFilePath } return; } diff --git a/functions/private/Invoke-WinUtilHiddenFiles.ps1 b/functions/private/Invoke-WinUtilHiddenFiles.ps1 new file mode 100644 index 00000000..81b3d6bb --- /dev/null +++ b/functions/private/Invoke-WinUtilHiddenFiles.ps1 @@ -0,0 +1,34 @@ +function Invoke-WinUtilHiddenFiles { + <# + + .SYNOPSIS + Enable/Disable Hidden Files + + .PARAMETER Enabled + Indicates whether to enable or disable Hidden Files + + #> + Param($Enabled) + Try{ + if ($Enabled -eq $false){ + Write-Host "Enabling Hidden Files" + $value = 1 + } + else { + Write-Host "Disabling Hidden Files" + $value = 0 + } + $Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" + Set-ItemProperty -Path $Path -Name Hidden -Value $value + } + Catch [System.Security.SecurityException] { + Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception" + } + Catch [System.Management.Automation.ItemNotFoundException] { + Write-Warning $psitem.Exception.ErrorRecord + } + Catch{ + Write-Warning "Unable to set $Name due to unhandled exception" + Write-Warning $psitem.Exception.StackTrace + } +} diff --git a/functions/private/Invoke-WinUtilSponsors.ps1 b/functions/private/Invoke-WinUtilSponsors.ps1 new file mode 100644 index 00000000..cf75dc27 --- /dev/null +++ b/functions/private/Invoke-WinUtilSponsors.ps1 @@ -0,0 +1,45 @@ +Function Invoke-WinUtilSponsors { + <# + .SYNOPSIS + Lists Sponsors from ChrisTitusTech + .DESCRIPTION + Lists Sponsors from ChrisTitusTech + .EXAMPLE + Invoke-WinUtilSponsors + .NOTES + This function is used to list sponsors from ChrisTitusTech + #> + try { + # Define the URL and headers + $url = "https://github.com/sponsors/ChrisTitusTech" + $headers = @{ + "User-Agent" = "Chrome/58.0.3029.110" + } + + # Fetch the webpage content + try { + $html = Invoke-RestMethod -Uri $url -Headers $headers + } catch { + Write-Output $_.Exception.Message + exit + } + + # Use regex to extract the content between "Current sponsors" and "Past sponsors" + $currentSponsorsPattern = '(?s)(?<=Current sponsors).*?(?=Past sponsors)' + $currentSponsorsHtml = [regex]::Match($html, $currentSponsorsPattern).Value + + # Use regex to extract the sponsor usernames from the alt attributes in the "Current Sponsors" section + $sponsorPattern = '(?<=alt="@)[^"]+' + $sponsors = [regex]::Matches($currentSponsorsHtml, $sponsorPattern) | ForEach-Object { $_.Value } + + # Exclude "ChrisTitusTech" from the sponsors + $sponsors = $sponsors | Where-Object { $_ -ne "ChrisTitusTech" } + + # Return the sponsors + return $sponsors + } + catch { + Write-Error "An error occurred while fetching or processing the sponsors: $_" + return $null + } +} \ No newline at end of file diff --git a/functions/private/Show-CustomDialog.ps1 b/functions/private/Show-CustomDialog.ps1 index dc6eb0de..236a3d62 100644 --- a/functions/private/Show-CustomDialog.ps1 +++ b/functions/private/Show-CustomDialog.ps1 @@ -24,6 +24,9 @@ function Show-CustomDialog { .PARAMETER IconSize The Size to use for Icon inside the custom dialog window. + .PARAMETER EnableScroll + A flag indicating whether to enable scrolling if the content exceeds the window size. + .EXAMPLE Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200 @@ -34,7 +37,8 @@ function Show-CustomDialog { [int]$Height = 200, [int]$FontSize = 10, [int]$HeaderFontSize = 14, - [int]$IconSize = 25 + [int]$IconSize = 25, + [bool]$EnableScroll = $false ) Add-Type -AssemblyName PresentationFramework @@ -246,11 +250,18 @@ $cttLogoPath = @" $messageTextBlock.Inlines.Add((New-Object Windows.Documents.Run($Message))) } - - # Add the TextBlock to the Grid - $grid.Children.Add($messageTextBlock) - [Windows.Controls.Grid]::SetRow($messageTextBlock, 1) # Set the row to the second row (0-based index) - + # Create a ScrollViewer if EnableScroll is true + if ($EnableScroll) { + $scrollViewer = New-Object System.Windows.Controls.ScrollViewer + $scrollViewer.VerticalScrollBarVisibility = 'Auto' + $scrollViewer.HorizontalScrollBarVisibility = 'Disabled' + $scrollViewer.Content = $messageTextBlock + $grid.Children.Add($scrollViewer) + [Windows.Controls.Grid]::SetRow($scrollViewer, 1) # Set the row to the second row (0-based index) + } else { + $grid.Children.Add($messageTextBlock) + [Windows.Controls.Grid]::SetRow($messageTextBlock, 1) # Set the row to the second row (0-based index) + } # Add OK button $okButton = New-Object Windows.Controls.Button diff --git a/functions/public/Invoke-WPFShortcut.ps1 b/functions/public/Invoke-WPFShortcut.ps1 index 8a26b82a..0c244250 100644 --- a/functions/public/Invoke-WPFShortcut.ps1 +++ b/functions/public/Invoke-WPFShortcut.ps1 @@ -17,14 +17,20 @@ function Invoke-WPFShortcut { [bool]$RunAsAdmin = $false ) - # Preper the Shortcut Fields and add an a Custom Icon if it's available at "$env:TEMP\cttlogo.png", else don't add a Custom Icon. + # add an a Custom Icon if it's available at "$env:TEMP\cttlogo.png", else don't add a Custom Icon. $iconPath = $null Switch ($ShortcutToAdd) { "WinUtil" { - $SourceExe = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" - $IRM = 'irm https://christitus.com/win | iex' - $Powershell = '-ExecutionPolicy Bypass -Command "Start-Process powershell.exe -verb runas -ArgumentList' - $ArgumentsToSourceExe = "$powershell '$IRM'" + # Use Powershell 7 if installed and fallback to PS5 if not + if (Get-Command "pwsh" -ErrorAction SilentlyContinue){ + $shell = "pwsh.exe" + } + else{ + $shell = "powershell.exe" + } + + $shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://christitus.com/win | iex`"`'" + $DestinationName = "WinUtil.lnk" Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile "$env:TEMP\cttlogo.png" @@ -52,9 +58,9 @@ function Invoke-WPFShortcut { # Prepare the Shortcut paramter $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) - $Shortcut.TargetPath = $SourceExe - $Shortcut.Arguments = $ArgumentsToSourceExe - if ($iconPath -ne $null) { + $Shortcut.TargetPath = $shell + $Shortcut.Arguments = $shellArgs + if ($null -ne $iconPath) { $shortcut.IconLocation = $iconPath } diff --git a/functions/public/Invoke-WPFToggle.ps1 b/functions/public/Invoke-WPFToggle.ps1 index 9d923edb..4bb4caa4 100644 --- a/functions/public/Invoke-WPFToggle.ps1 +++ b/functions/public/Invoke-WPFToggle.ps1 @@ -30,5 +30,6 @@ function Invoke-WPFToggle { "WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)} "WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)} "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} + "WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)} } } diff --git a/functions/public/Invoke-WPFTweakPS7.ps1 b/functions/public/Invoke-WPFTweakPS7.ps1 index 85ab9108..209b71ce 100644 --- a/functions/public/Invoke-WPFTweakPS7.ps1 +++ b/functions/public/Invoke-WPFTweakPS7.ps1 @@ -25,22 +25,29 @@ function Invoke-WPFTweakPS7{ $targetTerminalName = "Windows PowerShell" } } - - $settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" - if (Test-Path -Path $settingsPath) { - Write-Host "Settings file found." - $settingsContent = Get-Content -Path $settingsPath | ConvertFrom-Json - $ps7Profile = $settingsContent.profiles.list | Where-Object { $_.name -eq $targetTerminalName } - if ($ps7Profile) { - $settingsContent.defaultProfile = $ps7Profile.guid - $updatedSettings = $settingsContent | ConvertTo-Json -Depth 100 - Set-Content -Path $settingsPath -Value $updatedSettings - Write-Host "Default profile updated to $targetTerminalName using the name attribute." - } else { - Write-Host "No PowerShell 7 profile found in Windows Terminal settings using the name attribute." - } - } else { - Write-Host "Settings file not found at $settingsPath" + # Check if the Windows Terminal is installed and return if not (Prerequisite for the following code) + if (-not (Get-Command "wt" -ErrorAction SilentlyContinue)){ + Write-Host "Windows Terminal not installed. Skipping Terminal preference" + return + } + # Check if the Windows Terminal settings.json file exists and return if not (Prereqisite for the following code) + $settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" + if (-not (Test-Path -Path $settingsPath)){ + Write-Host "Windows Terminal Settings file not found at $settingsPath" + return } -} + Write-Host "Settings file found." + $settingsContent = Get-Content -Path $settingsPath | ConvertFrom-Json + $ps7Profile = $settingsContent.profiles.list | Where-Object { $_.name -eq $targetTerminalName } + if ($ps7Profile) { + $settingsContent.defaultProfile = $ps7Profile.guid + $updatedSettings = $settingsContent | ConvertTo-Json -Depth 100 + Set-Content -Path $settingsPath -Value $updatedSettings + Write-Host "Default profile updated to " -NoNewline + Write-Host "$targetTerminalName " -ForegroundColor White -NoNewline + Write-Host "using the name attribute." + } else { + Write-Host "No PowerShell 7 profile found in Windows Terminal settings using the name attribute." + } +} diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 00000000..afe7ea72 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,42 @@ +site_name: Chris Titus WinUtil Official Documentation +repo_url: https://github.com/ChrisTitusTech/winutil + +nav: + - Introduction: 'index.md' + - User Guide: 'userguide.md' + - Contribute: 'contribute.md' + - Updates: 'updates.md' + - Known Issues: 'KnownIssues.md' + - FAQ: 'faq.md' + +theme: + name: material + custom_dir: 'overrides' + features: + - navigation.tabs + - navigation.sections + - toc.integrate + - navigation.top + - search.suggest + - search.highlight + - content.tabs.link + - content.code.annotation + - content.code.copy + language: en + logo: assets/favicon.png + favicon: assets/favicon.png + palette: + - scheme: default + toggle: + icon: material/toggle-switch-off-outline + name: Switch to dark mode + primary: black + accent: purple + - scheme: slate + toggle: + icon: material/toggle-switch + name: Switch to light mode + primary: teal + accent: lime + markdown_extensions: + - admonition diff --git a/overrides/main.html b/overrides/main.html new file mode 100644 index 00000000..0cebb4ac --- /dev/null +++ b/overrides/main.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% block header %} + {{ super() }} +
+ Announcement: This documentation is still in progress. +
+{% endblock %} + +{% block footer %} + {# Empty block to override the footer #} +{% endblock %} \ No newline at end of file diff --git a/scripts/main.ps1 b/scripts/main.ps1 index e17b7225..0c83c54c 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -505,5 +505,32 @@ Version : Current sponsors for ChrisTitusTech: +"@ + $authorInfo += "`n" + try { + # Call the function to get the sponsors + $sponsors = Invoke-WinUtilSponsors + + # Append the sponsors to the authorInfo + $sponsors | ForEach-Object { $authorInfo += "$_`n" } + } + catch { + $authorInfo += "An error occurred while fetching or processing the sponsors: $_`n" + } + + $FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize + $HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader + $IconSize = $sync.configs.themes.$ctttheme.CustomDialogIconSize + $Width = $sync.configs.themes.$ctttheme.CustomDialogWidth + $Height = $sync.configs.themes.$ctttheme.CustomDialogHeight + Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -IconSize $IconSize -EnableScroll $true +}) $sync["Form"].ShowDialog() | out-null Stop-Transcript diff --git a/winutil.ps1 b/winutil.ps1 index e01443f0..379e80ee 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -8,7 +8,7 @@ Author : Chris Titus @christitustech Runspace Author: @DeveloperDurp GitHub : https://github.com/ChrisTitusTech - Version : 24.07.08 + Version : 24.07.15 #> param ( [switch]$Debug, @@ -45,7 +45,7 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot -$sync.version = "24.07.08" +$sync.version = "24.07.15" $sync.configs = @{} $sync.ProcessRunning = $false @@ -715,6 +715,17 @@ Function Get-WinUtilToggleStatus { return $true } } + + if ($ToggleSwitch -eq "WPFToggleHiddenFiles") { + $HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden + if($HiddenFiles -eq 0){ + return $false + } + else{ + return $true + } + } + if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") { $TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa if($TaskbarWidgets -eq 0) { @@ -953,7 +964,7 @@ function Install-WinUtilProgramChoco { # Cleanup leftovers files if(Test-Path -Path $installOutputFilePath){ Remove-Item -Path $installOutputFilePath } - if(Test-Path -Path $installOutputFilePath){ Remove-Item -Path $uninstallOutputFilePath } + if(Test-Path -Path $uninstallOutputFilePath){ Remove-Item -Path $uninstallOutputFilePath } return; } @@ -2029,6 +2040,40 @@ function Invoke-WinUtilGPU { } return $true } +function Invoke-WinUtilHiddenFiles { + <# + + .SYNOPSIS + Enable/Disable Hidden Files + + .PARAMETER Enabled + Indicates whether to enable or disable Hidden Files + + #> + Param($Enabled) + Try{ + if ($Enabled -eq $false){ + Write-Host "Enabling Hidden Files" + $value = 1 + } + else { + Write-Host "Disabling Hidden Files" + $value = 0 + } + $Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" + Set-ItemProperty -Path $Path -Name Hidden -Value $value + } + Catch [System.Security.SecurityException] { + Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception" + } + Catch [System.Management.Automation.ItemNotFoundException] { + Write-Warning $psitem.Exception.ErrorRecord + } + Catch{ + Write-Warning "Unable to set $Name due to unhandled exception" + Write-Warning $psitem.Exception.StackTrace + } +} Function Invoke-WinUtilMouseAcceleration { <# @@ -2282,6 +2327,51 @@ function Invoke-WinUtilSnapWindow { Write-Warning $psitem.Exception.StackTrace } } +Function Invoke-WinUtilSponsors { + <# + .SYNOPSIS + Lists Sponsors from ChrisTitusTech + .DESCRIPTION + Lists Sponsors from ChrisTitusTech + .EXAMPLE + Invoke-WinUtilSponsors + .NOTES + This function is used to list sponsors from ChrisTitusTech + #> + try { + # Define the URL and headers + $url = "https://github.com/sponsors/ChrisTitusTech" + $headers = @{ + "User-Agent" = "Chrome/58.0.3029.110" + } + + # Fetch the webpage content + try { + $html = Invoke-RestMethod -Uri $url -Headers $headers + } catch { + Write-Output $_.Exception.Message + exit + } + + # Use regex to extract the content between "Current sponsors" and "Past sponsors" + $currentSponsorsPattern = '(?s)(?<=Current sponsors).*?(?=Past sponsors)' + $currentSponsorsHtml = [regex]::Match($html, $currentSponsorsPattern).Value + + # Use regex to extract the sponsor usernames from the alt attributes in the "Current Sponsors" section + $sponsorPattern = '(?<=alt="@)[^"]+' + $sponsors = [regex]::Matches($currentSponsorsHtml, $sponsorPattern) | ForEach-Object { $_.Value } + + # Exclude "ChrisTitusTech" from the sponsors + $sponsors = $sponsors | Where-Object { $_ -ne "ChrisTitusTech" } + + # Return the sponsors + return $sponsors + } + catch { + Write-Error "An error occurred while fetching or processing the sponsors: $_" + return $null + } +} Function Invoke-WinUtilStickyKeys { <# .SYNOPSIS @@ -2828,6 +2918,9 @@ function Show-CustomDialog { .PARAMETER IconSize The Size to use for Icon inside the custom dialog window. + .PARAMETER EnableScroll + A flag indicating whether to enable scrolling if the content exceeds the window size. + .EXAMPLE Show-CustomDialog -Message "This is a custom dialog with a message and an image above." -Width 300 -Height 200 @@ -2838,7 +2931,8 @@ function Show-CustomDialog { [int]$Height = 200, [int]$FontSize = 10, [int]$HeaderFontSize = 14, - [int]$IconSize = 25 + [int]$IconSize = 25, + [bool]$EnableScroll = $false ) Add-Type -AssemblyName PresentationFramework @@ -3050,11 +3144,18 @@ $cttLogoPath = @" $messageTextBlock.Inlines.Add((New-Object Windows.Documents.Run($Message))) } - - # Add the TextBlock to the Grid - $grid.Children.Add($messageTextBlock) - [Windows.Controls.Grid]::SetRow($messageTextBlock, 1) # Set the row to the second row (0-based index) - + # Create a ScrollViewer if EnableScroll is true + if ($EnableScroll) { + $scrollViewer = New-Object System.Windows.Controls.ScrollViewer + $scrollViewer.VerticalScrollBarVisibility = 'Auto' + $scrollViewer.HorizontalScrollBarVisibility = 'Disabled' + $scrollViewer.Content = $messageTextBlock + $grid.Children.Add($scrollViewer) + [Windows.Controls.Grid]::SetRow($scrollViewer, 1) # Set the row to the second row (0-based index) + } else { + $grid.Children.Add($messageTextBlock) + [Windows.Controls.Grid]::SetRow($messageTextBlock, 1) # Set the row to the second row (0-based index) + } # Add OK button $okButton = New-Object Windows.Controls.Button @@ -4869,14 +4970,20 @@ function Invoke-WPFShortcut { [bool]$RunAsAdmin = $false ) - # Preper the Shortcut Fields and add an a Custom Icon if it's available at "$env:TEMP\cttlogo.png", else don't add a Custom Icon. + # add an a Custom Icon if it's available at "$env:TEMP\cttlogo.png", else don't add a Custom Icon. $iconPath = $null Switch ($ShortcutToAdd) { "WinUtil" { - $SourceExe = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" - $IRM = 'irm https://christitus.com/win | iex' - $Powershell = '-ExecutionPolicy Bypass -Command "Start-Process powershell.exe -verb runas -ArgumentList' - $ArgumentsToSourceExe = "$powershell '$IRM'" + # Use Powershell 7 if installed and fallback to PS5 if not + if (Get-Command "pwsh" -ErrorAction SilentlyContinue){ + $shell = "pwsh.exe" + } + else{ + $shell = "powershell.exe" + } + + $shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://christitus.com/win | iex`"`'" + $DestinationName = "WinUtil.lnk" Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile "$env:TEMP\cttlogo.png" @@ -4904,9 +5011,9 @@ function Invoke-WPFShortcut { # Prepare the Shortcut paramter $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName) - $Shortcut.TargetPath = $SourceExe - $Shortcut.Arguments = $ArgumentsToSourceExe - if ($iconPath -ne $null) { + $Shortcut.TargetPath = $shell + $Shortcut.Arguments = $shellArgs + if ($null -ne $iconPath) { $shortcut.IconLocation = $iconPath } @@ -4985,6 +5092,7 @@ function Invoke-WPFToggle { "WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)} "WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)} "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} + "WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)} } } function Invoke-WPFTweakPS7{ @@ -5014,25 +5122,32 @@ function Invoke-WPFTweakPS7{ $targetTerminalName = "Windows PowerShell" } } - - $settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" - if (Test-Path -Path $settingsPath) { - Write-Host "Settings file found." - $settingsContent = Get-Content -Path $settingsPath | ConvertFrom-Json - $ps7Profile = $settingsContent.profiles.list | Where-Object { $_.name -eq $targetTerminalName } - if ($ps7Profile) { - $settingsContent.defaultProfile = $ps7Profile.guid - $updatedSettings = $settingsContent | ConvertTo-Json -Depth 100 - Set-Content -Path $settingsPath -Value $updatedSettings - Write-Host "Default profile updated to $targetTerminalName using the name attribute." - } else { - Write-Host "No PowerShell 7 profile found in Windows Terminal settings using the name attribute." - } - } else { - Write-Host "Settings file not found at $settingsPath" + # Check if the Windows Terminal is installed and return if not (Prerequisite for the following code) + if (-not (Get-Command "wt" -ErrorAction SilentlyContinue)){ + Write-Host "Windows Terminal not installed. Skipping Terminal preference" + return + } + # Check if the Windows Terminal settings.json file exists and return if not (Prereqisite for the following code) + $settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" + if (-not (Test-Path -Path $settingsPath)){ + Write-Host "Windows Terminal Settings file not found at $settingsPath" + return } -} + Write-Host "Settings file found." + $settingsContent = Get-Content -Path $settingsPath | ConvertFrom-Json + $ps7Profile = $settingsContent.profiles.list | Where-Object { $_.name -eq $targetTerminalName } + if ($ps7Profile) { + $settingsContent.defaultProfile = $ps7Profile.guid + $updatedSettings = $settingsContent | ConvertTo-Json -Depth 100 + Set-Content -Path $settingsPath -Value $updatedSettings + Write-Host "Default profile updated to " -NoNewline + Write-Host "$targetTerminalName " -ForegroundColor White -NoNewline + Write-Host "using the name attribute." + } else { + Write-Host "No PowerShell 7 profile found in Windows Terminal settings using the name attribute." + } +} function Invoke-WPFtweaksbutton { <# @@ -8185,6 +8300,14 @@ $sync.configs.applications = '{ "link": "https://zoom.us/", "winget": "Zoom.Zoom" }, + "WPFInstallzoomit": { + "category": "Utilities", + "choco": "na", + "content": "ZoomIt", + "description": "A screen zoom, annotation, and recording tool for technical presentations and demos", + "link": "https://learn.microsoft.com/en-us/sysinternals/downloads/zoomit", + "winget": "Microsoft.Sysinternals.ZoomIt" + }, "WPFInstallzotero": { "category": "Document", "choco": "zotero", @@ -8432,6 +8555,38 @@ $sync.configs.applications = '{ "description": "Shotcut is a free, open source, cross-platform video editor.", "link": "https://shotcut.org/", "winget": "Meltytech.Shotcut" + }, + "WPFInstallPulsar-Edit": { + "category": "Development", + "choco": "pulsar", + "content": "Pulsar", + "description": "A Community-led Hyper-Hackable Text Editor", + "link": "https://pulsar-edit.dev/", + "winget": "Pulsar-Edit.Pulsar" + }, + "WPFInstallAegisub": { + "category": "Development", + "choco": "aegisub", + "content": "Aegisub", + "description": "Aegisub is a free, cross-platform open source tool for creating and modifying subtitles. Aegisub makes it quick and easy to time subtitles to audio, and features many powerful tools for styling them, including a built-in real-time video preview.", + "link": "https://github.com/Aegisub/Aegisub", + "winget": "Aegisub.Aegisub" + }, + "WPFInstallSubtitleEdit": { + "category": "Multimedia Tools", + "choco": "na", + "content": "Subtitle Edit", + "description": "Subtitle Edit is a free and open source editor for video subtitles.", + "link": "https://github.com/SubtitleEdit/subtitleedit", + "winget": "Nikse.SubtitleEdit" + }, + "WPFInstallFork": { + "category": "Development", + "choco": "git-fork", + "content": "Fork", + "description": "Fork - a fast and friendly git client.", + "link": "https://git-fork.com/", + "winget": "Fork.Fork" } }' | convertfrom-json $sync.configs.dns = '{ @@ -11274,8 +11429,8 @@ $sync.configs.tweaks = '{ ] }, "WPFTweaksPowershell7": { - "Content": "Replace Default Powershell 5 to Powershell 7", - "Description": "This will edit the config file of the Windows Terminal Replacing the Powershell 5 to Powershell 7 and install Powershell 7 if necessary", + "Content": "Change Windows Terminal default: PowerShell 5 -> PowerShell 7", + "Description": "This will edit the config file of the Windows Terminal replacing PowerShell 5 with PowerShell 7 and installing PS7 if necessary", "category": "Essential Tweaks", "panel": "1", "Order": "a009_", @@ -12035,12 +12190,20 @@ $sync.configs.tweaks = '{ "Order": "a108_", "Type": "Toggle" }, + "WPFToggleHiddenFiles": { + "Content": "Show Hidden Files", + "Description": "If Enabled then Hidden Files will be shown.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a200_", + "Type": "Toggle" + }, "WPFToggleShowExt": { "Content": "Show File Extensions", "Description": "If enabled then File extensions (e.g., .txt, .jpg) are visible.", "category": "Customize Preferences", "panel": "2", - "Order": "a200_", + "Order": "a201_", "Type": "Toggle" }, "WPFToggleTaskbarSearch": { @@ -12048,7 +12211,7 @@ $sync.configs.tweaks = '{ "Description": "If Enabled Search Button will be on the taskbar.", "category": "Customize Preferences", "panel": "2", - "Order": "a201_", + "Order": "a202_", "Type": "Toggle" }, "WPFToggleTaskView": { @@ -12056,7 +12219,7 @@ $sync.configs.tweaks = '{ "Description": "If Enabled then Task View Button in Taskbar will be shown.", "category": "Customize Preferences", "panel": "2", - "Order": "a202_", + "Order": "a203_", "Type": "Toggle" }, "WPFToggleTaskbarWidgets": { @@ -12064,7 +12227,7 @@ $sync.configs.tweaks = '{ "Description": "If Enabled then Widgets Button in Taskbar will be shown.", "category": "Customize Preferences", "panel": "2", - "Order": "a203_", + "Order": "a204_", "Type": "Toggle" }, "WPFOOSUbutton": { @@ -12820,6 +12983,7 @@ $inputXML = ' + @@ -13031,6 +13195,10 @@ $inputXML = ' + + + + @@ -13055,6 +13223,10 @@ $inputXML = ' + + + + @@ -13152,17 +13324,21 @@ $inputXML = ' - - + + - - + + + + + + @@ -13452,14 +13628,14 @@ $inputXML = ' - - - - + + + + @@ -13707,6 +13883,10 @@ $inputXML = ' + + + + @@ -13754,10 +13934,6 @@ $inputXML = ' - - - - @@ -13766,6 +13942,10 @@ $inputXML = ' + + + + @@ -14049,10 +14229,6 @@ $inputXML = ' - - - - @@ -14069,6 +14245,10 @@ $inputXML = ' + + + + @@ -14349,6 +14529,10 @@ $inputXML = ' + + + + @@ -14394,7 +14578,7 @@ $inputXML = ' - + @@ -14474,6 +14658,10 @@ $inputXML = '