Ubuntu – Use custom keyboard shortcut in lock screen

lock-screenshortcut-keysxinput

I have a keyboard shortcut (Shift+Ctrl+F9, if it matters) that runs the command:

xinput disable "some device name"

I want to be able to activate this shortcut/command even when my computer is locked. Ideally, it should even work if I've just booted and haven't typed in my password yet. Is there a way to do this?

Background: I have a faulty touchscreen, it sometimes goes haywire and registers a bunch of ghost input. I use this key combination to disable it quickly when it does. Without the keyboard shortcut, it's impossible to use the computer while this is happening – the false input overrides any attempted use of the mouse, and it constantly activates random things on the screen making even keyboard navigation impossible.

I do use the touchscreen sometimes so I don't want to disable it forever.