mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-04 12:13:51 -05:00
Compare commits
1 Commits
24.06.25
...
c607bae8e2
Author | SHA1 | Date | |
---|---|---|---|
c607bae8e2 |
@ -3141,5 +3141,13 @@
|
|||||||
"panel": "2",
|
"panel": "2",
|
||||||
"Order": "a082_",
|
"Order": "a082_",
|
||||||
"Type": "300"
|
"Type": "300"
|
||||||
|
},
|
||||||
|
"WPFToggleTaskView": {
|
||||||
|
"Content": "Task View",
|
||||||
|
"Description": "If Enabled then Task View Icon in Taskbar will be shown.",
|
||||||
|
"category": "Customize Preferences",
|
||||||
|
"panel": "2",
|
||||||
|
"Order": "a069_",
|
||||||
|
"Type": "Toggle"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,15 @@ Function Get-WinUtilToggleStatus {
|
|||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($ToggleSwitch -eq "WPFToggleTaskView") {
|
||||||
|
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
|
||||||
|
if($TaskView -eq 0){
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return $true
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
|
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
|
||||||
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
||||||
if($TaskbarWidgets -eq 0) {
|
if($TaskbarWidgets -eq 0) {
|
||||||
|
34
functions/private/Invoke-WinUtilTaskView.ps1
Normal file
34
functions/private/Invoke-WinUtilTaskView.ps1
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
function Invoke-WinUtilTaskView {
|
||||||
|
<#
|
||||||
|
|
||||||
|
.SYNOPSIS
|
||||||
|
Enable/Disable Task View
|
||||||
|
|
||||||
|
.PARAMETER Enabled
|
||||||
|
Indicates whether to enable or disable Task View
|
||||||
|
|
||||||
|
#>
|
||||||
|
Param($Enabled)
|
||||||
|
Try{
|
||||||
|
if ($Enabled -eq $false){
|
||||||
|
Write-Host "Enabling Task View"
|
||||||
|
$value = 1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Disabling Task View"
|
||||||
|
$value = 0
|
||||||
|
}
|
||||||
|
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||||
|
Set-ItemProperty -Path $Path -Name ShowTaskViewButton -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
|
||||||
|
}
|
||||||
|
}
|
@ -178,67 +178,17 @@ $cttLogoPath = @"
|
|||||||
$winutilTextBlock.Foreground = $foregroundColor
|
$winutilTextBlock.Foreground = $foregroundColor
|
||||||
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block
|
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block
|
||||||
$stackPanel.Children.Add($winutilTextBlock)
|
$stackPanel.Children.Add($winutilTextBlock)
|
||||||
|
|
||||||
# Add TextBlock for information with text wrapping and margins
|
# Add TextBlock for information with text wrapping and margins
|
||||||
$messageTextBlock = New-Object Windows.Controls.TextBlock
|
$messageTextBlock = New-Object Windows.Controls.TextBlock
|
||||||
|
$messageTextBlock.Text = $Message
|
||||||
$messageTextBlock.TextWrapping = [Windows.TextWrapping]::Wrap # Enable text wrapping
|
$messageTextBlock.TextWrapping = [Windows.TextWrapping]::Wrap # Enable text wrapping
|
||||||
$messageTextBlock.HorizontalAlignment = [Windows.HorizontalAlignment]::Left
|
$messageTextBlock.HorizontalAlignment = [Windows.HorizontalAlignment]::Left
|
||||||
$messageTextBlock.VerticalAlignment = [Windows.VerticalAlignment]::Top
|
$messageTextBlock.VerticalAlignment = [Windows.VerticalAlignment]::Top
|
||||||
$messageTextBlock.Margin = New-Object Windows.Thickness(10) # Add margins around the text block
|
$messageTextBlock.Margin = New-Object Windows.Thickness(10) # Add margins around the text block
|
||||||
|
|
||||||
# Define the Regex to find hyperlinks formatted as HTML <a> tags
|
|
||||||
$regex = [regex]::new('<a href="([^"]+)">([^<]+)</a>')
|
|
||||||
$lastPos = 0
|
|
||||||
|
|
||||||
# Iterate through each match and add regular text and hyperlinks
|
|
||||||
foreach ($match in $regex.Matches($Message)) {
|
|
||||||
# Add the text before the hyperlink, if any
|
|
||||||
$textBefore = $Message.Substring($lastPos, $match.Index - $lastPos)
|
|
||||||
if ($textBefore.Length -gt 0) {
|
|
||||||
$messageTextBlock.Inlines.Add((New-Object Windows.Documents.Run($textBefore)))
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create and add the hyperlink
|
|
||||||
$hyperlink = New-Object Windows.Documents.Hyperlink
|
|
||||||
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
|
|
||||||
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
|
||||||
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
|
||||||
$hyperlink.Foreground = $foregroundColor
|
|
||||||
$hyperlink.Add_Click({
|
|
||||||
param($sender, $args)
|
|
||||||
Start-Process $sender.NavigateUri.AbsoluteUri
|
|
||||||
})
|
|
||||||
$hyperlink.Add_MouseEnter({
|
|
||||||
param($sender, $args)
|
|
||||||
$sender.Foreground = [Windows.Media.Brushes]::LightGray
|
|
||||||
})
|
|
||||||
$hyperlink.Add_MouseLeave({
|
|
||||||
param($sender, $args)
|
|
||||||
$sender.Foreground = $foregroundColor
|
|
||||||
})
|
|
||||||
|
|
||||||
$messageTextBlock.Inlines.Add($hyperlink)
|
|
||||||
|
|
||||||
# Update the last position
|
|
||||||
$lastPos = $match.Index + $match.Length
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add any remaining text after the last hyperlink
|
|
||||||
if ($lastPos -lt $Message.Length) {
|
|
||||||
$textAfter = $Message.Substring($lastPos)
|
|
||||||
$messageTextBlock.Inlines.Add((New-Object Windows.Documents.Run($textAfter)))
|
|
||||||
}
|
|
||||||
|
|
||||||
# If no matches, add the entire message as a run
|
|
||||||
if ($regex.Matches($Message).Count -eq 0) {
|
|
||||||
$messageTextBlock.Inlines.Add((New-Object Windows.Documents.Run($Message)))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Add the TextBlock to the Grid
|
|
||||||
$grid.Children.Add($messageTextBlock)
|
$grid.Children.Add($messageTextBlock)
|
||||||
[Windows.Controls.Grid]::SetRow($messageTextBlock, 1) # Set the row to the second row (0-based index)
|
[Windows.Controls.Grid]::SetRow($messageTextBlock, 1) # Set the row to the second row (0-based index)
|
||||||
|
|
||||||
|
|
||||||
# Add OK button
|
# Add OK button
|
||||||
$okButton = New-Object Windows.Controls.Button
|
$okButton = New-Object Windows.Controls.Button
|
||||||
$okButton.Content = "OK"
|
$okButton.Content = "OK"
|
||||||
|
@ -28,5 +28,6 @@ function Invoke-WPFToggle {
|
|||||||
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
|
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
|
||||||
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
|
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
|
||||||
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
|
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
|
||||||
|
"WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -467,13 +467,14 @@ $sync["AboutMenuItem"].Add_Click({
|
|||||||
# Handle Export menu item click
|
# Handle Export menu item click
|
||||||
Write-Debug "About clicked"
|
Write-Debug "About clicked"
|
||||||
$sync["SettingsPopup"].IsOpen = $false
|
$sync["SettingsPopup"].IsOpen = $false
|
||||||
|
# Example usage
|
||||||
$authorInfo = @"
|
$authorInfo = @"
|
||||||
Author : <a href="https://github.com/ChrisTitusTech">@christitustech</a>
|
Author : @christitustech
|
||||||
Runspace : <a href="https://github.com/DeveloperDurp">@DeveloperDurp</a>
|
Runspace : @DeveloperDurp
|
||||||
GUI : <a href="https://github.com/KonTy">@KonTy</a>
|
GUI : @KonTy
|
||||||
MicroWin : <a href="https://github.com/KonTy">@KonTy</a>
|
MicroWin : @KonTy
|
||||||
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
|
GitHub : https://github.com/ChrisTitusTech/winutil
|
||||||
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
|
Version : $($sync.version)
|
||||||
"@
|
"@
|
||||||
Show-CustomDialog -Message $authorInfo -Width 400
|
Show-CustomDialog -Message $authorInfo -Width 400
|
||||||
})
|
})
|
||||||
|
71
winutil.ps1
71
winutil.ps1
@ -8,7 +8,7 @@
|
|||||||
Author : Chris Titus @christitustech
|
Author : Chris Titus @christitustech
|
||||||
Runspace Author: @DeveloperDurp
|
Runspace Author: @DeveloperDurp
|
||||||
GitHub : https://github.com/ChrisTitusTech
|
GitHub : https://github.com/ChrisTitusTech
|
||||||
Version : 24.06.25
|
Version : 24.06.20
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
[switch]$Debug,
|
[switch]$Debug,
|
||||||
@ -45,7 +45,7 @@ Add-Type -AssemblyName System.Windows.Forms
|
|||||||
# Variable to sync between runspaces
|
# Variable to sync between runspaces
|
||||||
$sync = [Hashtable]::Synchronized(@{})
|
$sync = [Hashtable]::Synchronized(@{})
|
||||||
$sync.PSScriptRoot = $PSScriptRoot
|
$sync.PSScriptRoot = $PSScriptRoot
|
||||||
$sync.version = "24.06.25"
|
$sync.version = "24.06.20"
|
||||||
$sync.configs = @{}
|
$sync.configs = @{}
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
|
||||||
@ -2810,67 +2810,17 @@ $cttLogoPath = @"
|
|||||||
$winutilTextBlock.Foreground = $foregroundColor
|
$winutilTextBlock.Foreground = $foregroundColor
|
||||||
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block
|
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block
|
||||||
$stackPanel.Children.Add($winutilTextBlock)
|
$stackPanel.Children.Add($winutilTextBlock)
|
||||||
|
|
||||||
# Add TextBlock for information with text wrapping and margins
|
# Add TextBlock for information with text wrapping and margins
|
||||||
$messageTextBlock = New-Object Windows.Controls.TextBlock
|
$messageTextBlock = New-Object Windows.Controls.TextBlock
|
||||||
|
$messageTextBlock.Text = $Message
|
||||||
$messageTextBlock.TextWrapping = [Windows.TextWrapping]::Wrap # Enable text wrapping
|
$messageTextBlock.TextWrapping = [Windows.TextWrapping]::Wrap # Enable text wrapping
|
||||||
$messageTextBlock.HorizontalAlignment = [Windows.HorizontalAlignment]::Left
|
$messageTextBlock.HorizontalAlignment = [Windows.HorizontalAlignment]::Left
|
||||||
$messageTextBlock.VerticalAlignment = [Windows.VerticalAlignment]::Top
|
$messageTextBlock.VerticalAlignment = [Windows.VerticalAlignment]::Top
|
||||||
$messageTextBlock.Margin = New-Object Windows.Thickness(10) # Add margins around the text block
|
$messageTextBlock.Margin = New-Object Windows.Thickness(10) # Add margins around the text block
|
||||||
|
|
||||||
# Define the Regex to find hyperlinks formatted as HTML <a> tags
|
|
||||||
$regex = [regex]::new('<a href="([^"]+)">([^<]+)</a>')
|
|
||||||
$lastPos = 0
|
|
||||||
|
|
||||||
# Iterate through each match and add regular text and hyperlinks
|
|
||||||
foreach ($match in $regex.Matches($Message)) {
|
|
||||||
# Add the text before the hyperlink, if any
|
|
||||||
$textBefore = $Message.Substring($lastPos, $match.Index - $lastPos)
|
|
||||||
if ($textBefore.Length -gt 0) {
|
|
||||||
$messageTextBlock.Inlines.Add((New-Object Windows.Documents.Run($textBefore)))
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create and add the hyperlink
|
|
||||||
$hyperlink = New-Object Windows.Documents.Hyperlink
|
|
||||||
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
|
|
||||||
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
|
||||||
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
|
||||||
$hyperlink.Foreground = $foregroundColor
|
|
||||||
$hyperlink.Add_Click({
|
|
||||||
param($sender, $args)
|
|
||||||
Start-Process $sender.NavigateUri.AbsoluteUri
|
|
||||||
})
|
|
||||||
$hyperlink.Add_MouseEnter({
|
|
||||||
param($sender, $args)
|
|
||||||
$sender.Foreground = [Windows.Media.Brushes]::LightGray
|
|
||||||
})
|
|
||||||
$hyperlink.Add_MouseLeave({
|
|
||||||
param($sender, $args)
|
|
||||||
$sender.Foreground = $foregroundColor
|
|
||||||
})
|
|
||||||
|
|
||||||
$messageTextBlock.Inlines.Add($hyperlink)
|
|
||||||
|
|
||||||
# Update the last position
|
|
||||||
$lastPos = $match.Index + $match.Length
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add any remaining text after the last hyperlink
|
|
||||||
if ($lastPos -lt $Message.Length) {
|
|
||||||
$textAfter = $Message.Substring($lastPos)
|
|
||||||
$messageTextBlock.Inlines.Add((New-Object Windows.Documents.Run($textAfter)))
|
|
||||||
}
|
|
||||||
|
|
||||||
# If no matches, add the entire message as a run
|
|
||||||
if ($regex.Matches($Message).Count -eq 0) {
|
|
||||||
$messageTextBlock.Inlines.Add((New-Object Windows.Documents.Run($Message)))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Add the TextBlock to the Grid
|
|
||||||
$grid.Children.Add($messageTextBlock)
|
$grid.Children.Add($messageTextBlock)
|
||||||
[Windows.Controls.Grid]::SetRow($messageTextBlock, 1) # Set the row to the second row (0-based index)
|
[Windows.Controls.Grid]::SetRow($messageTextBlock, 1) # Set the row to the second row (0-based index)
|
||||||
|
|
||||||
|
|
||||||
# Add OK button
|
# Add OK button
|
||||||
$okButton = New-Object Windows.Controls.Button
|
$okButton = New-Object Windows.Controls.Button
|
||||||
$okButton.Content = "OK"
|
$okButton.Content = "OK"
|
||||||
@ -15396,13 +15346,14 @@ $sync["AboutMenuItem"].Add_Click({
|
|||||||
# Handle Export menu item click
|
# Handle Export menu item click
|
||||||
Write-Debug "About clicked"
|
Write-Debug "About clicked"
|
||||||
$sync["SettingsPopup"].IsOpen = $false
|
$sync["SettingsPopup"].IsOpen = $false
|
||||||
|
# Example usage
|
||||||
$authorInfo = @"
|
$authorInfo = @"
|
||||||
Author : <a href="https://github.com/ChrisTitusTech">@christitustech</a>
|
Author : @christitustech
|
||||||
Runspace : <a href="https://github.com/DeveloperDurp">@DeveloperDurp</a>
|
Runspace : @DeveloperDurp
|
||||||
GUI : <a href="https://github.com/KonTy">@KonTy</a>
|
GUI : @KonTy
|
||||||
MicroWin : <a href="https://github.com/KonTy">@KonTy</a>
|
MicroWin : @KonTy
|
||||||
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
|
GitHub : https://github.com/ChrisTitusTech/winutil
|
||||||
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
|
Version : $($sync.version)
|
||||||
"@
|
"@
|
||||||
Show-CustomDialog -Message $authorInfo -Width 400
|
Show-CustomDialog -Message $authorInfo -Width 400
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user