diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index f7c864a89f..64be4216ff 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -347,3 +347,5 @@ /datum/config_entry/str_list/randomizing_station_name_message default = list() + +/datum/config_entry/flag/toast_notification_on_init diff --git a/code/controllers/master.dm b/code/controllers/master.dm index de94b27e77..b6fb14a695 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -223,6 +223,10 @@ GLOBAL_REAL(Master, /datum/controller/master) = new // Sort subsystems by display setting for easy access. sortTim(subsystems, GLOBAL_PROC_REF(cmp_subsystem_display)) + + if(world.system_type == MS_WINDOWS && CONFIG_GET(flag/toast_notification_on_init) && !length(GLOB.clients)) + world.shelleo("start /min powershell -ExecutionPolicy Bypass -File tools/initToast/initToast.ps1 -name \"[world.name]\" -icon %CD%\\icons\\ui_icons\\common\\tg_16.png -port [world.port]") + // Set world options. world.change_fps(CONFIG_GET(number/fps)) var/initialized_tod = REALTIMEOFDAY diff --git a/icons/ui_icons/common/tg_16.png b/icons/ui_icons/common/tg_16.png new file mode 100644 index 0000000000..2b08bdd29c Binary files /dev/null and b/icons/ui_icons/common/tg_16.png differ diff --git a/tools/initToast/initToast.ps1 b/tools/initToast/initToast.ps1 new file mode 100644 index 0000000000..9b7714f3a2 --- /dev/null +++ b/tools/initToast/initToast.ps1 @@ -0,0 +1,32 @@ +param([string]$name, [string]$icon, [Int32]$port=80) + +$hkcu = [Microsoft.Win32.RegistryKey]::OpenBaseKey('CurrentUser','default') + +$amuid_hkey = $hkcu.CreateSubKey('SOFTWARE\Classes\AppUserModelId\Tgstation.Tgstation', $true, [Microsoft.Win32.RegistryOptions]::Volatile) + +if ($name) { $amuid_hkey.SetValue('DisplayName', $name) } +if ($icon) { $amuid_hkey.SetValue('IconUri', $icon) } + +[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null +$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Tgstation.Tgstation') + +[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom, ContentType = WindowsRuntime] > $null +$xml = New-Object Windows.Data.Xml.Dom.XmlDocument + +$xml.LoadXml(@" + + + + Initialization Complete + + + + + + +"@) + +[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null +$toast = New-Object Windows.UI.Notifications.ToastNotification $xml + +$notifier.Show($toast)