-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script variables are off by one #7
Comments
I don't understand why you think If the name and battery status appear in the menu, that means $1 and $3 are working properly. |
Because with the default settings, the battery status shows the device ID for me. Additionally, the other options didn't work at all until I replaced each |
That is weird behaviour. I will do some tests and get back to you |
Can you provide me with info about the shell you are using?
and executed
and got the following output
which confirms that at least on my shell (zsh, and previously bash) $0 is the name of the function, $1 is the first argument and so on. |
I'm using zsh. Per #6, shebangs don't seem to make any difference on my system, so I just symlinked Running Running |
In any case, in the test script, $1 is arg1. This same behaviour should be happening in the main script as well. I still have no ideas on why this is happening. I will continue working on it. |
I have modified the script to use |
Hi,
The module didn't work out of the box. The menu would show up, but none of the options did anything. I could still receive pings from my paired device and send pings via shell commands.
I took a look at the code and all the numbered bash variables ($1, $2, etc.) are off by one., e.g. the script uses $2 for the deviceid variable instead of $3. I believe this is because in line 41:
devices+="%{A1:. $DIR/polybar-kdeconnect.sh; show_menu $devicename $deviceid $battery:}$icon%{A}$SEPERATOR"
$DIR/polybar-kdeconnect.sh
is being treated as a variable.I'm not sure why this is, or how to escape it properly. My workaround was to increment all the numbered variables, but I'd be happy to know a better way to fix it.
The text was updated successfully, but these errors were encountered: