mirror of
https://github.com/Baipyrus/ProxySwitcher.git
synced 2024-12-27 05:01:45 +00:00
set icon according to system proxy
This commit is contained in:
parent
6bae350f7e
commit
20e55efc25
9
run.ps1
9
run.ps1
@ -1,3 +1,6 @@
|
|||||||
|
# Get inetcpl proxy settings
|
||||||
|
$settings = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings';
|
||||||
|
|
||||||
# Load required assemblies for Windows Forms
|
# Load required assemblies for Windows Forms
|
||||||
Add-Type -AssemblyName System.Windows.Forms
|
Add-Type -AssemblyName System.Windows.Forms
|
||||||
Add-Type -AssemblyName System.Drawing
|
Add-Type -AssemblyName System.Drawing
|
||||||
@ -5,7 +8,11 @@ Add-Type -AssemblyName System.Drawing
|
|||||||
# Create a new NotifyIcon
|
# Create a new NotifyIcon
|
||||||
$trayIcon = New-Object System.Windows.Forms.NotifyIcon
|
$trayIcon = New-Object System.Windows.Forms.NotifyIcon
|
||||||
# Use a default application icon
|
# Use a default application icon
|
||||||
$trayIcon.Icon = './assets/ICON_Disabled.ico'
|
$trayIcon.Icon = if ($settings.proxyEnable)
|
||||||
|
{ "./assets/ICON_Enabled.ico"
|
||||||
|
} else
|
||||||
|
{ "./assets/ICON_Disabled.ico"
|
||||||
|
}
|
||||||
$trayIcon.Text = 'ProxySwitcher'
|
$trayIcon.Text = 'ProxySwitcher'
|
||||||
$trayIcon.Visible = $true
|
$trayIcon.Visible = $true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user