Quote:
Originally Posted by remlap
Code:
#
## Bluetooth Toggle Menu
menu_item : main : Enable Bluetooth : nickel_bluetooth : toggle
chain_success : cmd_spawn : quiet : sed -i '/^## Bluetooth Toggle Menu/ { n; s/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1Disable Bluetooth \2/ }' /mnt/onboard/.adds/nm/menu
chain_failure : cmd_spawn : quiet : sed -i '/^## Bluetooth Toggle Menu/ { n; s/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1Enable Bluetooth \2/ }' /mnt/onboard/.adds/nm/menu
#
Why wont this work for me
|
Because the bluetooth toggle will always succeed, so it will only ever go down the success chain
You could setup something that greps for "Enable bluetooth", and if it finds it, use nickel_bluetooth: enable, then use sed to change it to Disable Bluetooth.
If grep doesn't find it, use nickel_bluetooth:disable, and use sed to change the "Disable Bluetooth" to "Enable Bluetooth".
Not perfect though, as it still has no way of knowing if bluetooth is currently on or off. But, since you're not using the toggle this way, if the menu says "Disable bluetooth" and bluetooth is already off, clicking on it will just turn it off again.
What you might want to test though is if bluetooth is off, and you use turn it off again with nickelmenu, does it go down the success chain or the failure chain?