Ubuntu does not seem to recognize input from a Sony DS3 controller as able to prevent screen blanking. The controller itself works, but this problem can be replicated when trying to play games on certain emulators that don't support gnome idle-inhibit, namely the Flatpak versions of Duckstation and PCSX2 (there are no snaps for these).
I found this: https://github.com/foresto/joystickwake
It has a PPA, but not for jammy. I manually went into Software & Updates to change it to impish and installed the software, but it's still not working. I previously built it from source via Setup.py, which I'm not experienced in doing, and ended up uninstalling/manually deleting it's files when I figured I did it wrong. I tried the author's "test mode," which is invoked by:
joystickwake --loglevel debug --interval 2 --command "test command"
and it says it found success with xset s reset
but it's still not preventing the screen from blanking. Previously, it worked, but only when I was running it in test mode, and I have since uninstalled/deleted that version of it. Clearly I don't know what I am doing.
I also found this: https://github.com/nowrep/wljoywake
But I don't think it works because of the idle_inhibit_unstable_v1 protocol requirement. It tells me:
zwp_idle_inhibit_manager_v1 not available!
which does not seem to have support for Mutter (source: https://wayland.app/protocols/idle-inhibit-unstable-v1)
This seems to me like a very simple solution that would fix all of the issues related to screen blanking on Ubuntu when emulating games. It would no longer matter if the software itself allows for preventing gnome screen blanking, as it would be entirely decided on if the user is present at the keyboard, which is the way it should be.