feat(bootstrap): Initialise windows script

This commit is contained in:
js0ny 2025-03-03 11:45:32 +00:00
parent 1cdb00ba50
commit 1025053406
12 changed files with 314 additions and 99 deletions

21
bootstrap/win/Tasks.ps1 Normal file
View file

@ -0,0 +1,21 @@
#Requires -RunAsAdministrator
Write-Output "[INFO] Setting up KMonad Tasks"
# PowerShell Path, use 7 if available
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
$PowerShellPath = (Get-Command "pwsh").Source
}
else {
$PowerShellPath = (Get-Command "powershell").Source
}
$DotStartUpPath = "$Env:DOTFILES\platforms\win\start"
$KMonadRunnerPath = Join-Path $DotStartUpPath "KMonad.ps1"
$Action = New-ScheduledTaskAction -Execute $PowerShellPath -Argument "-NoProfile -ExecutionPolicy Bypass -File $KMonadRunnerPath"
$Trigger = New-ScheduledTaskTrigger -AtLogOn
$Principal = New-ScheduledTaskPrincipal -UserId "$env:USERNAME" -LogonType Interactive -RunLevel Highest
$Settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -DontStopOnIdleEnd -Hidden
Register-ScheduledTask -TaskName "Start Kmonad" -Action $Action -Trigger $Trigger -Principal $Principal -Settings $Settings -TaskPath "\Personal"