This commit is contained in:
2026-03-10 19:07:03 +01:00
parent 1ff51226f4
commit f92be81f65
59 changed files with 47351 additions and 0 deletions

View File

@@ -0,0 +1,118 @@
<#
.SYNOPSIS
Set console font to Consolas when script is called from the Wrapper due to it is not loaded by default
.LINK
https://github.com/ReneNyffenegger/ps-modules-console
#>
function Set-ConsoleFont
{
$Signature = @{
Namespace = "WinAPI"
Name = "ConsoleFont"
Language = "CSharp"
MemberDefinition = @"
[StructLayout(LayoutKind.Sequential)]
public struct COORD
{
public short X;
public short Y;
public COORD(short x, short y)
{
X = x;
Y = y;
}
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CONSOLE_FONT_INFOEX
{
public uint cbSize;
public uint n;
public COORD size;
// The four low-order bits of 'family' specify information about the pitch and the technology:
// 1 = TMPF_FIXED_PITCH, 2 = TMPF_VECTOR, 4 = TMPF_TRUETYPE, 8 = TMPF_DEVICE.
// The four high-order bits specifies the fonts family:
// 80 = FF_DECORATIVE, 0 = FF_DONTCARE, 48 = FF_MODERN, 16 = FF_ROMAN, 64 = FF_SCRIPT, 32 = FF_SWISS
// I assume(!) this value is always 48.
// (In fact, it seems that family is is always 54 = TMPF_VECTOR + TMPF_TRUETYPE + FF_MODERN)
public int family;
public int weight;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string name;
}
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetStdHandle(int nStdHandle);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
extern static bool GetCurrentConsoleFontEx(
IntPtr hConsoleOutput,
bool bMaximumWindow,
ref CONSOLE_FONT_INFOEX lpConsoleCurrentFont
);
[DllImport("kernel32.dll", SetLastError = true)]
static extern Int32 SetCurrentConsoleFontEx(
IntPtr ConsoleOutput,
bool MaximumWindow,
ref CONSOLE_FONT_INFOEX lpConsoleCurrentFont
);
public static CONSOLE_FONT_INFOEX GetFont()
{
CONSOLE_FONT_INFOEX ret = new CONSOLE_FONT_INFOEX();
ret.cbSize = (uint) Marshal.SizeOf(ret);
if (GetCurrentConsoleFontEx(GetStdHandle(-11), false, ref ret))
{
return ret;
}
throw new Exception("something went wrong with GetCurrentConsoleFontEx");
}
public static void SetFont(CONSOLE_FONT_INFOEX font)
{
if (SetCurrentConsoleFontEx(GetStdHandle(-11), false, ref font ) == 0)
{
throw new Exception("something went wrong with SetCurrentConsoleFontEx");
}
}
public static void SetSize(short w, short h)
{
CONSOLE_FONT_INFOEX font = GetFont();
font.size.X = w;
font.size.Y = h;
SetFont(font);
}
public static void SetName(string name)
{
CONSOLE_FONT_INFOEX font = GetFont();
font.name = name;
SetFont(font);
}
"@
}
if (-not ("WinAPI.ConsoleFont" -as [type]))
{
Add-Type @Signature
}
[WinAPI.ConsoleFont]::SetName("Consolas")
}
# We need to be sure that the Wrapper generated a powershell.exe process. If that true, we need to set Consolas font, unless a Sophia Script logo in console is distored
$PowerShellParentProcessId = (Get-CimInstance -ClassName CIM_Process | Where-Object -FilterScript {$_.Name -eq "powershell.exe"}).ParentProcessId
$ParrentProcess = Get-Process -Id $PowerShellParentProcessId -ErrorAction Ignore
$WrapperProcess = Get-Process -Name SophiaScriptWrapper -ErrorAction Ignore
if ($ParrentProcess.Id -eq $WrapperProcess.Id)
{
Set-ConsoleFont
}

View File

@@ -0,0 +1,17 @@
[
{
"Id": 100,
"Region": "before",
"Function": ""
},
{
"Id": 101,
"Region": "before",
"Function": ""
},
{
"Id": 200,
"Region": "after",
"Function": "PostActions"
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
[
{
"en": {
"70": {
"HeightAdjustInPixels": "30"
},
"80": {
"HeightAdjustInPixels": "30"
},
"90": {
"HeightAdjustInPixels": "20"
},
"100": {
"HeightAdjustInPixels": "18"
},
"125": {
"HeightAdjustInPixels": "12"
},
"150": {
"HeightAdjustInPixels": "10"
},
"175": {
"HeightAdjustInPixels": "10"
},
"200": {
"HeightAdjustInPixels": "1"
}
},
"de": {
"70": {
"HeightAdjustInPixels": "36"
},
"80": {
"HeightAdjustInPixels": "31"
},
"90": {
"HeightAdjustInPixels": "29"
},
"100": {
"HeightAdjustInPixels": "27"
},
"125": {
"HeightAdjustInPixels": "18"
},
"150": {
"HeightAdjustInPixels": "14"
},
"175": {
"HeightAdjustInPixels": "10"
},
"200": {
"HeightAdjustInPixels": "10"
}
},
"ru": {
"70": {
"HeightAdjustInPixels": "38"
},
"80": {
"HeightAdjustInPixels": "32"
},
"90": {
"HeightAdjustInPixels": "29"
},
"100": {
"HeightAdjustInPixels": "26"
},
"125": {
"HeightAdjustInPixels": "21"
},
"150": {
"HeightAdjustInPixels": "17"
},
"175": {
"HeightAdjustInPixels": "11"
},
"200": {
"HeightAdjustInPixels": "8"
}
}
}
]

View File

@@ -0,0 +1,41 @@
[
{
"psd1Filename": "SophiaScript.psd1",
"folderPsd1Filename": "Manifest",
"psm1Filename": "Sophia.psm1",
"folderPsm1Filename": "Module",
"setConsoleFontPs1Filename": "Set-ConsoleFont.ps1",
"folderSetConsoleFontPs1": "Config",
"functionControlsPerColumn": "100",
"urlSophiaScriptVersionsJson": "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json",
"urlLatestSophiaScriptDownloads": "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest",
"autosaveFilename": "autosave.ps1",
"autosaveIntervalInSeconds": "300",
"startLineRegionInitialActions": "#region Initial Actions",
"endLineRegionInitialActions": "#endregion Initial Actions",
"startLineRegionSystemProtection": "#region Protection",
"endLineRegionSystemProtection": "#endregion Protection",
"startLineRegionPrivacy": "#region Privacy & Telemetry",
"endLineRegionPrivacy": "#endregion Privacy & Telemetry",
"startLineRegionPersonalization": "#region UI & Personalization",
"endLineRegionPersonalization": "#endregion UI & Personalization",
"startLineRegionOneDrive": "#region OneDrive",
"endLineRegionOneDrive": "#endregion OneDrive",
"startLineRegionSystem": "#region System",
"endLineRegionSystem": "#endregion System",
"startLineRegionWSL": "#region WSL",
"endLineRegionWSL": "#endregion WSL",
"startLineRegionUWPApps": "#region UWP apps",
"endLineRegionUWPApps": "#endregion UWP apps",
"startLineRegionGaming": "#region Gaming",
"endLineRegionGaming": "#endregion Gaming",
"startLineRegionScheduledTasks": "#region Scheduled tasks",
"endLineRegionScheduledTasks": "#endregion Scheduled tasks",
"startLineRegionDefenderSecurity": "#region Microsoft Defender & Security",
"endLineRegionDefenderSecurity": "#endregion Microsoft Defender & Security",
"startLineRegionContextMenu": "#region Context menu",
"endLineRegionContextMenu": "#endregion Context menu",
"startLineRegionUpdatePolicies": "#region Update Policies",
"endLineRegionUpdatePolicies": "#endregion Update Policies"
}
]

View File

@@ -0,0 +1,37 @@
[
{
"English": {
"Code": "en",
"Folder": "en-US",
"WidthOfWrapperInPixels": "872",
"HeightOfWrapperInPixels": "650",
"WidthLabelInPixels": "225",
"WidthLabelContextTabInPixels": "243",
"WidthComboBoxInPixels": "155",
"WidthComboBoxSystemTabInPixels": "155",
"WidthComboBoxStartMenuTabInPixels": "230"
},
"German": {
"Code": "de",
"Folder": "de-DE",
"WidthOfWrapperInPixels": "1120",
"HeightOfWrapperInPixels": "650",
"WidthLabelInPixels": "225",
"WidthLabelContextTabInPixels": "243",
"WidthComboBoxInPixels": "150",
"WidthComboBoxSystemTabInPixels": "165",
"WidthComboBoxStartMenuTabInPixels": "250"
},
"Russian": {
"Code": "ru",
"Folder": "ru-RU",
"WidthOfWrapperInPixels": "1155",
"HeightOfWrapperInPixels": "650",
"WidthLabelInPixels": "225",
"WidthLabelContextTabInPixels": "243",
"WidthComboBoxInPixels": "175",
"WidthComboBoxSystemTabInPixels": "235",
"WidthComboBoxStartMenuTabInPixels": "260"
}
}
]