mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Adds Toaster notifications (#19262)
* Adds Toaster notifications for windows * Fixes the icon * Update master.dm * Update initToast.ps1
This commit is contained in:
@@ -273,6 +273,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
"changelog_hash" = GLOB.changelog_hash)
|
||||
webhook_send_roundstatus("lobby", webhookData) //yogs end -webhook support
|
||||
|
||||
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\\ss13_16.png -port [world.port]")
|
||||
|
||||
// Set world options.
|
||||
world.change_fps(CONFIG_GET(number/fps))
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
var/icon/final_icon = finish_preview_icon(obsessed_icon)
|
||||
|
||||
final_icon.Blend(
|
||||
icon('icons/ui_icons/antags/obsessed.dmi', "obsession"),
|
||||
icon('icons/UI_Icons/antags/obsessed.dmi', "obsession"),
|
||||
ICON_OVERLAY,
|
||||
ANTAGONIST_PREVIEW_ICON_SIZE - 30,
|
||||
20,
|
||||
|
||||
@@ -452,3 +452,6 @@ MAX_SHUTTLE_SIZE 300
|
||||
## Enable/disable roundstart station traits
|
||||
#STATION_TRAITS
|
||||
|
||||
## Comment to disable sending a toast notification on the host server when initializations complete.
|
||||
## Even if this is enabled, a notification will only be sent if there are no clients connected.
|
||||
TOAST_NOTIFICATION_ON_INIT
|
||||
|
||||
BIN
icons/UI_Icons/common/ss13_16.png
Normal file
BIN
icons/UI_Icons/common/ss13_16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
32
tools/initToast/initToast.ps1
Normal file
32
tools/initToast/initToast.ps1
Normal file
@@ -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\Yogstation.Yogstation', $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('Yogstation.Yogstation')
|
||||
|
||||
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom, ContentType = WindowsRuntime] > $null
|
||||
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
||||
|
||||
$xml.LoadXml(@"
|
||||
<toast>
|
||||
<visual>
|
||||
<binding template="ToastGeneric">
|
||||
<text>Initialization Complete</text>
|
||||
</binding>
|
||||
</visual>
|
||||
<actions>
|
||||
<action content="Launch Dream Seeker" activationType="protocol" arguments="byond://127.0.0.1:$port"/>
|
||||
</actions>
|
||||
</toast>
|
||||
"@)
|
||||
|
||||
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
|
||||
$toast = New-Object Windows.UI.Notifications.ToastNotification $xml
|
||||
|
||||
$notifier.Show($toast)
|
||||
@@ -1,3 +1,5 @@
|
||||
/datum/config_entry/flag/log_looc
|
||||
|
||||
/datum/config_entry/flag/looc_during_round
|
||||
/datum/config_entry/flag/looc_during_round
|
||||
|
||||
/datum/config_entry/flag/toast_notification_on_init
|
||||
|
||||
Reference in New Issue
Block a user