mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-28 00:54:47 -05:00
Fixes, improvements + Auto Window handling (#2648)
* fixes - change fontsize back to 12 - add correct handling of windows - removed double click handling of winutil * readd double click * fixes - argument passing on elevation & to windev script - remove shell output of log * improve compile -run - added $args param for args that get passed to winutil - improved starting new Shell logic * fix: compile's run logic - removed old logic - fixed command to run in new shell - replaced $args with $arg * fix: logs & border - move log start to after admin elevation - fix color of border on fixed tweaks button. * fix: MicrowinInjectDrivers's Margin - use theme value instead of custom value * change microwin checkbox margin - set cutom microwin checkbox margin due to cut off content * fix layouting of nav bar - replace strange collumndefinition to fix bugs, make sense and look better * rename $arg to $Arguments * change maxresolution from 1380 to 1280
This commit is contained in:
@ -439,6 +439,12 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
}
|
||||
})
|
||||
|
||||
$sync["Form"].Add_Loaded({
|
||||
param($e)
|
||||
$sync["Form"].MaxWidth = [Double]::PositiveInfinity
|
||||
$sync["Form"].MaxHeight = [Double]::PositiveInfinity
|
||||
})
|
||||
|
||||
# Initialize the hashtable
|
||||
$winutildir = @{}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
GitHub : https://github.com/ChrisTitusTech
|
||||
Version : #{replaceme}
|
||||
#>
|
||||
|
||||
param (
|
||||
[switch]$Debug,
|
||||
[string]$Config,
|
||||
@ -27,12 +28,6 @@ if ($Run) {
|
||||
$PARAM_RUN = $true
|
||||
}
|
||||
|
||||
$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||
|
||||
$logdir = "$env:localappdata\winutil\logs"
|
||||
[System.IO.Directory]::CreateDirectory("$logdir")
|
||||
Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append
|
||||
|
||||
# Load DLLs
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
@ -46,8 +41,22 @@ $sync.ProcessRunning = $false
|
||||
|
||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
|
||||
$argList = @()
|
||||
|
||||
$PSBoundParameters.GetEnumerator() | ForEach-Object {
|
||||
$argList += if ($_.Value -is [switch] -and $_.Value) {
|
||||
"-$($_.Key)"
|
||||
} elseif ($_.Value) {
|
||||
"-$($_.Key) `"$($_.Value)`""
|
||||
}
|
||||
}
|
||||
|
||||
$script = if ($MyInvocation.MyCommand.Path) {
|
||||
"& { & '$($MyInvocation.MyCommand.Path)' $argList }"
|
||||
} else {
|
||||
"iex '& { $(irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1) } $argList'"
|
||||
}
|
||||
|
||||
$script = if ($MyInvocation.MyCommand.Path) { "& '" + $MyInvocation.MyCommand.Path + "'" } else { "irm 'https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1' | iex"}
|
||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
||||
|
||||
@ -56,6 +65,12 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
|
||||
break
|
||||
}
|
||||
|
||||
$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||
|
||||
$logdir = "$env:localappdata\winutil\logs"
|
||||
[System.IO.Directory]::CreateDirectory("$logdir") | Out-Null
|
||||
Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-Null
|
||||
|
||||
# Set PowerShell window title
|
||||
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)"
|
||||
clear-host
|
||||
|
Reference in New Issue
Block a user