{"action":"created","issue":{"url":"https://api.github.com/repos/tmux-plugins/tmux-battery/issues/7","labels_url":"https://api.github.com/repos/tmux-plugins/tmux-battery/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/tmux-plugins/tmux-battery/issues/7/comments","events_url":"https://api.github.com/repos/tmux-plugins/tmux-battery/issues/7/events","html_url":"https://github.com/tmux-plugins/tmux-battery/pull/7","id":58456663,"number":7,"title":"Display all batteries that upower knows about","user":{"login":"JanAhrens","id":693647,"avatar_url":"https://avatars.githubusercontent.com/u/693647?v=3","gravatar_id":"","url":"https://api.github.com/users/JanAhrens","html_url":"https://github.com/JanAhrens","followers_url":"https://api.github.com/users/JanAhrens/followers","following_url":"https://api.github.com/users/JanAhrens/following{/other_user}","gists_url":"https://api.github.com/users/JanAhrens/gists{/gist_id}","starred_url":"https://api.github.com/users/JanAhrens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanAhrens/subscriptions","organizations_url":"https://api.github.com/users/JanAhrens/orgs","repos_url":"https://api.github.com/users/JanAhrens/repos","events_url":"https://api.github.com/users/JanAhrens/events{/privacy}","received_events_url":"https://api.github.com/users/JanAhrens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-21T11:46:18Z","updated_at":"2015-02-21T18:28:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tmux-plugins/tmux-battery/pulls/7","html_url":"https://github.com/tmux-plugins/tmux-battery/pull/7","diff_url":"https://github.com/tmux-plugins/tmux-battery/pull/7.diff","patch_url":"https://github.com/tmux-plugins/tmux-battery/pull/7.patch"},"body":"My laptop has two batteries: One exchangeable and a built-in one. The exchangeable battery will unload before the internal. Unfortunately `BAT0` is the internal battery and `BAT1` is the external one. Without this patch, `battery_percentage.sh` displays 100% until the exchangeable battery ran out of power. \r\n\r\nI'm suggesting to display all batteries that `upower` knows about. With this patch all batteries percentage levels will be displayed with a seperating space: \"14% 85%\".\r\n\r\nIf there is only one battery, the behavior of this script does not change. The for-loop will yield exactly one line and `xargs echo` won't change it.\r\n\r\nI tested this on my system by pretending what would happen if it had only one battery.\r\n```\r\nfor battery in $(upower -e | grep battery | head -1); do \\\r\n  upower -i $battery | grep percentage | awk '{print $2}'; \\\r\ndone | xargs echo\r\n```\r\n\r\nThis is how the `upower -e` output looks on my machine:\r\n\r\n```\r\n$ upower -e\r\n/org/freedesktop/UPower/devices/line_power_AC\r\n/org/freedesktop/UPower/devices/battery_BAT0\r\n/org/freedesktop/UPower/devices/battery_BAT1\r\n```"},"comment":{"url":"https://api.github.com/repos/tmux-plugins/tmux-battery/issues/comments/75385037","html_url":"https://github.com/tmux-plugins/tmux-battery/pull/7#issuecomment-75385037","issue_url":"https://api.github.com/repos/tmux-plugins/tmux-battery/issues/7","id":75385037,"user":{"login":"JanAhrens","id":693647,"avatar_url":"https://avatars.githubusercontent.com/u/693647?v=3","gravatar_id":"","url":"https://api.github.com/users/JanAhrens","html_url":"https://github.com/JanAhrens","followers_url":"https://api.github.com/users/JanAhrens/followers","following_url":"https://api.github.com/users/JanAhrens/following{/other_user}","gists_url":"https://api.github.com/users/JanAhrens/gists{/gist_id}","starred_url":"https://api.github.com/users/JanAhrens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanAhrens/subscriptions","organizations_url":"https://api.github.com/users/JanAhrens/orgs","repos_url":"https://api.github.com/users/JanAhrens/repos","events_url":"https://api.github.com/users/JanAhrens/events{/privacy}","received_events_url":"https://api.github.com/users/JanAhrens/received_events","type":"User","site_admin":false},"created_at":"2015-02-21T18:28:17Z","updated_at":"2015-02-21T18:28:17Z","body":"I decided to add my changes to `battery_icon.sh` to this pull-request, because they concern the same feature: multi battery support for `upower`. If you like to discuss this in seperate pull-requests I'm happy to create those."}}