Skip to content

Add windows OS alerts (!ring, battle start/end) - #1247

Open
tetrisface wants to merge 2 commits into
beyond-all-reason:masterfrom
tetrisface:add-windows-os-alerts-on-ring-etc
Open

Add windows OS alerts (!ring, battle start/end)#1247
tetrisface wants to merge 2 commits into
beyond-all-reason:masterfrom
tetrisface:add-windows-os-alerts-on-ring-etc

Conversation

@tetrisface

@tetrisface tetrisface commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

As I understand the launcher must be rebuilt and released for this chobby change to be usable. It worked with the built release from my fork though.

Only implemented for and tested on windows.

Toast + icon flashing happens when:

  • Ring: Getting !ringed
  • Game start/end: When queueing or being a player and the game starts/ends
  • No engine window (spring/recoil) is focused
  • Having each respective effect enabled which is default on

The api_notifications_handler was dormant/dead. It previously acted at vote starts also. I think it's reasonable to try to limit alerts to the minimal defensible cases above.

Mechanism:

  • Chobby maybe sends an Alert {message, toast, flash} command over the existing launcher bridge
  • The new launcher extension handles that message.
  • Foreground focus check is done inside the powershell snippet and also the app icon flashing
  • Depending on powershell return the launcher will toast via electron Notification
Skarminspelning.2026-08-22.112016-00.00.26.036-00.00.32.241.mp4
Skarminspelning.2026-08-22.112832-00.00.00.000-00.00.18.539-00.00.09.741-00.00.14.223.mp4

Also added a grouped and sorted section for notifications:
before
image

after
image

Test

  • Tested the indentation down to 1400 width resolution. Then it starts to break. But others break before that.

  • Alert logic tested with this notification widget that rings every 10 seconds:

Details
function widget:GetInfo()
	return {
		name    = 'Ring Test',
		desc    = 'Fires a fake OnRing every 10 seconds so the OS alert can be tested solo (alt-tab and wait). Delete before committing.',
		author  = 'tetrisface',
		date    = '2026-08-22',
		license = 'GNU GPL v3',
		layer   = -200000,
		enabled = true,
	}
end

--------------------------------------------------------------------------
--------------------------------------------------------------------------

local RING_DELAY_SECONDS = 10

local function FireFakeRing()
	Spring.Echo('[ring test] firing fake OnRing')
	lobby:_CallListeners('OnRing', 'TestUser')
	WG.Delay(FireFakeRing, RING_DELAY_SECONDS)
end

local function DelayedInitialize()
	Spring.Echo(('[ring test] fake ring every %d seconds, alt-tab and wait'):format(RING_DELAY_SECONDS))
	WG.Delay(FireFakeRing, RING_DELAY_SECONDS)
end

function widget:Initialize()
	CHOBBY_DIR = LUA_DIRNAME .. "widgets/chobby/"
	VFS.Include(LUA_DIRNAME .. "widgets/chobby/headers/exports.lua", nil, VFS.RAW_FIRST)

	WG.Delay(DelayedInitialize, 1)
end

--------------------------------------------------------------------------
--------------------------------------------------------------------------

also tested with built release https://github.com/tetrisface/BYAR-Chobby/releases

AI Disclosure

All code produced as well as some code tested by Claude Fable. Edited, read and expected paths tested by me.

Toast + icon flashing happens when:
* Ring: Getting `!ring`ed. Always happens from Chobby perspective.
* Game start/end: When queueing or being a player and the game starts/ends
* No engine window (spring/recoil) is focused
* Having each respective effect enabled which is default on

The api_notifications_handler was dormant/dead. it previously acted at vote starts also. I think it's reasonable to try to limit alerts to the minimal defensible cases above.

Mechanism:
* Chobby sends Alert command over the existing bridge
* Foreground check and flash toggle is done in powershell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant