Tormak9970 / bash-shortcuts

A Steam Deck plugin for creating custom shortcuts that can be launched from the Quick Access Menu. Uses Bash under the hood.
Other
32 stars 8 forks source link

Cannot run non-app shortcuts #8

Closed adarshmk closed 1 year ago

adarshmk commented 1 year ago

I am currently running v1.2.0 of Bash Shortcuts on my Steam Deck. When I create a shortcut and set the switch for "Does this launch an app?" to OFF, the shortcut fails to run with an Error toast notification which says "Shortcut Failed. Check the command".

I checked the plugin_loader logs with journalctl -u plugin_loader -b0. Initially it showed me an error which said wmctrl: command not found so I just installed wmctrl with pacman -S wmctrl (I disabled Read Only mode before I installed wmctrl). After installing wmctrl, now I see this from the logs

Jan 31 14:36:45 steamdeck PluginLoader[2436]: xwininfo: error: unable to parse display name "" 
Jan 31 14:36:45 steamdeck PluginLoader[2439]: xwininfo: error: unable to parse display name ""
Jan 31 14:36:45 steamdeck PluginLoader[2441]: Cannot open display.

Also, the error xwininfo: error: unable to parse display name "" was present before I installed wmctrl. I restarted my steam deck after I installed wmctrl, which erased the logs prior.

The command I am trying to run is just "ls". The default "konsole" shortcut runs just fine.

Tormak9970 commented 1 year ago

I am currently running v1.2.0 of Bash Shortcuts on my Steam Deck. When I create a shortcut and set the switch for "Does this launch an app?" to OFF, the shortcut fails to run with an Error toast notification which says "Shortcut Failed. Check the command".

I checked the plugin_loader logs with journalctl -u plugin_loader -b0. Initially it showed me an error which said wmctrl: command not found so I just installed wmctrl with pacman -S wmctrl (I disabled Read Only mode before I installed wmctrl). After installing wmctrl, now I see this from the logs

Jan 31 14:36:45 steamdeck PluginLoader[2436]: xwininfo: error: unable to parse display name "" 
Jan 31 14:36:45 steamdeck PluginLoader[2439]: xwininfo: error: unable to parse display name ""
Jan 31 14:36:45 steamdeck PluginLoader[2441]: Cannot open display.

Also, the error xwininfo: error: unable to parse display name "" was present before I installed wmctrl. I restarted my steam deck after I installed wmctrl, which erased the logs prior.

The command I am trying to run is just "ls". The default "konsole" shortcut runs just fine.

I have a theory about the cause, but need some more information.

adarshmk commented 1 year ago

I have a theory about the cause, but need some more information.

* Are you running on a steamdeck?

* Are yoy using an external display?

Yes, I am running on a Steam Deck. And No, I'm not using an external display.

Some additional info, if it's helpful, I had installed the 1.0.0 version of Bash Shortcuts earlier, but uninstalled it because of a bug (#6), which prevented me from editing existing shortcuts. Installed v1.2.0 yesterday.

Happy to provide any other info or logs, if required.

adarshmk commented 1 year ago

I've been trying to debug this and here's what I have found so far:

I added some debug logs to shortcutsRunner.sh, just above the eval command

echo "Running shortcut" | /usr/bin/systemd-cat
echo "$@" | /usr/bin/systemd-cat

This prints 2 lines to the systemd journal, which can be read with journalctl -f. One which just says Running shortcut, and the other should print the command I am trying to run

With this logging, if I invoke the shortcut from the Steam Deck UI, this is what the log shows:

Feb 01 22:18:57 steamdeck unknown[5753]: Running shortcut
Feb 01 22:18:57 steamdeck PluginLoader[5757]: xwininfo: error: unable to parse display name ""
Feb 01 22:18:57 steamdeck PluginLoader[5760]: xwininfo: error: unable to parse display name ""
Feb 01 22:18:57 steamdeck PluginLoader[5762]: Cannot open display.

Curiously only one of the logs I added, shows up.

If I manually invoke shortcutsRunner.sh with /home/deck/homebrew/plugins/bash-shortcuts/shortcutsRunner.sh ls -la, from an SSH session (while still in Game Mode on the Steam Deck):

Feb 01 22:19:50 steamdeck unknown[5772]: Running shortcut
Feb 01 22:19:50 steamdeck cat[5774]: ls -la

The output of ls is shown on the SSH Console along with the errors thrown by the xwininfo and wmctrl calls

drwxr-xr-x  2 deck deck  4096 Jan 16 14:48 Videos
-rw-------  1 deck deck 15672 Feb  1 22:18 .viminfo
-rw-r--r--  1 deck deck   335 Nov 23  2021 .xbindkeysrc
xwininfo: error: unable to parse display name ""
xwininfo: error: unable to parse display name ""
Cannot open display.

When invoked from the Steam deck UI, it seems as if the command (ls in this case), is not passed along to shorcutsRunner.sh.

Tormak9970 commented 1 year ago

It appears there's issues with the non app shortcuts (also had someone else report something similar). I have an update planned to make some additional changes and I'll debug that as a part of it. Idk why I pass it to the runner to begin with, since it doesn't need to be. Can just run it from python

Tormak9970 commented 1 year ago

Working on v2 with s lot of improvements. Non-app shortcuts are working fine. Closing this. Look for an update in the next few weeks