Open reloxx13 opened 11 months ago
If you have an idea how to implement this, feel free to do so. Since the terminal window is opened by the operating system, I don't think you can minimize or hide the terminal window from the Go code. And I briefly tested https://github.com/containerd/console to resize the window, but that didn't work at all (at least on Windows). So I have no idea how to implement this, and since I don't see a useful use case for this feature, I'm not willing to go down that rabbit hole.
Mit PowerShell ein Fenster verstecken.
Als irgendwas.ps1 speichern und mit "powershell.exe -WindowStyle Hidden -command C:\dein\pfad\zur\datei.ps1" laufen lassen.
# Endlosschleife, um das Skript dauerhaft laufen zu lassen
while ($true) {
# Warten für eine Sekunde, um die CPU-Auslastung zu reduzieren
Start-Sleep -Seconds 1
# Verwenden von Add-Type, um die notwendigen Windows-APIs zu laden
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Win32 {
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
}
"@
# Sucht nach einem Fenster, dessen Titel "nzb-monkey-go.exe" enthält
$windows = Get-Process | Where-Object {
$_.MainWindowTitle -like "*nzb-monkey-go.exe*"
}
# Überprüfen, ob das Fenster gefunden wurde
if ($windows) {
foreach ($window in $windows) {
# Fenster verstecken (SW_HIDE = 0)
[Win32]::ShowWindow($window.MainWindowHandle, 0)
}
}
}
Add configuration to support to open the console window minimized or hidden or without focus/background, and/or allow setting console window size.