We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
return-type
Make sure not to make this mistake in your custom modules. Let's say this is your module:
"custom/battery": { "exec": "~/.config/waybar/scripts/battery.sh", "interval": 60, "tooltip": false, "signal": 7, "return-type": "json" },
"custom/battery": {
"exec": "~/.config/waybar/scripts/battery.sh",
"interval": 60,
"tooltip": false,
"signal": 7,
"return-type": "json"
},
This script will work:
#!/bin/bash capacity=$(<"/sys/class/power_supply/macsmc-battery/capacity") if [ "$(<"/sys/class/power_supply/macsmc-battery/status")" = "Charging" ]; then unbuffer echo "{\"text\":\"$capacity%\",\"class\":\"charging\"}" else unbuffer echo "{\"text\":\"$capacity%\"}" fi
#!/bin/bash
capacity=$(<"/sys/class/power_supply/macsmc-battery/capacity")
if [ "$(<"/sys/class/power_supply/macsmc-battery/status")" = "Charging" ]; then
unbuffer echo "{\"text\":\"$capacity%\",\"class\":\"charging\"}"
else
unbuffer echo "{\"text\":\"$capacity%\"}"
fi
This script will not work:
#!/bin/bash capacity=$(<"/sys/class/power_supply/macsmc-battery/capacity") unbuffer echo "{\"text\":\"$capacity%\"}" if [ "$(<"/sys/class/power_supply/macsmc-battery/status")" = "Charging" ]; then unbuffer echo "{\"text\":\"$capacity%\",\"class\":\"charging\"}" fi
Always put the json with more variables to be displayed first, because otherwise it will be overshadowed by the other one.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Make sure not to make this mistake in your custom modules. Let's say this is your module:
"custom/battery": {
"exec": "~/.config/waybar/scripts/battery.sh",
"interval": 60,
"tooltip": false,
"signal": 7,
"return-type": "json"
},
This script will work:
#!/bin/bash
capacity=$(<"/sys/class/power_supply/macsmc-battery/capacity")
if [ "$(<"/sys/class/power_supply/macsmc-battery/status")" = "Charging" ]; then
unbuffer echo "{\"text\":\"$capacity%\",\"class\":\"charging\"}"
else
unbuffer echo "{\"text\":\"$capacity%\"}"
fi
This script will not work:
#!/bin/bash
capacity=$(<"/sys/class/power_supply/macsmc-battery/capacity")
unbuffer echo "{\"text\":\"$capacity%\"}"
if [ "$(<"/sys/class/power_supply/macsmc-battery/status")" = "Charging" ]; then
unbuffer echo "{\"text\":\"$capacity%\",\"class\":\"charging\"}"
fi
Always put the json with more variables to be displayed first, because otherwise it will be overshadowed by the other one.
The text was updated successfully, but these errors were encountered: