There is also some filtering for the shortcut, to determine if it was held.It would be wise to make the OSD code reusable, as it was copied from KScreen.
EDIT: A cleaner method to determine held shortcuts could be implemented like in KWin: https://invent.kde.org/plasma/kwin/-/blob/master/src/globalshortcuts.cpp?ref_type=heads#L175
This would be a bit overkill though, as we only want to know if the shortcut is held or only trigger it on button up.