-
Notifications
You must be signed in to change notification settings - Fork 64
/
Aero Glass PowerShell.ps1
52 lines (33 loc) · 1.12 KB
/
Aero Glass PowerShell.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#requires -version 2
param([switch]$Disable)
add-type -namespace Hacks -name Aero -memberdefinition @"
[StructLayout(LayoutKind.Sequential)]
public struct MARGINS
{
public int left;
public int right;
public int top;
public int bottom;
}
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern bool DwmIsCompositionEnabled();
"@
if (([Environment]::OSVersion.Version.Major -gt 5) -and
[hacks.aero]::DwmIsCompositionEnabled()) {
$hwnd = (get-process -id $pid).mainwindowhandle
$margin = new-object 'hacks.aero+margins'
$host.ui.RawUI.BackgroundColor = "black"
$host.ui.rawui.foregroundcolor = "white"
if ($Disable) {
$margin.top = 0
$margin.left = 0
} else {
$margin.top = -1
$margin.left = -1
}
[hacks.aero]::DwmExtendFrameIntoClientArea($hwnd, [ref]$margin)
} else {
write-warning "Aero is either not available or not enabled on this workstation."
}