Zend certified PHP/Magento developer

Run a command with Stream Deck on Ubuntu when the user is locked

I have written a simple script on my Ubuntu 23.04 host to switch the input sources of my Dell monitors. This script works fine. But now I want to run this script by the push of a physical button. I am thinking of buying a Stream Deck and call the script from there. One button for each monitor configuration (= each computer that is connected to the screen).

Now my question is this: Can I run a command like path/so/my/switch-script.sh INPUT_CONFIG? The script itself works when I call from a terminal in Ubuntu. But when I switch to another machine, after a few minutes my Ubuntu machine locks and presents me with a password prompt. My question now is: can the Stream Deck still run path/so/my/switch-script.sh INPUT_CONFIG as the user that is logged in but locked? Otherwise I would not gain anything because I would have to login but I would not see the password field because the input sources haven’t switched yet.