Skip to content
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

Hide percentage in panel when indicator shows calculating #146

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Indicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,18 @@ public class Power.Indicator : Wingpanel.Indicator {
if (display_device != null && display_widget != null) {
var icon_name = display_device.get_symbolic_icon_name_for_battery ();
display_widget.icon_name = icon_name;
display_widget.allow_percent = true;

/* Debug output for designers */
debug ("Icon changed to \"%s\"", icon_name);

display_widget.percentage = (int)Math.round (display_device.percentage);
var percent = (int)Math.round (display_device.percentage);

if (percent <= 0) {
display_widget.allow_percent = false;
} else {
display_widget.percentage = percent;
display_widget.allow_percent = true;
}
}
}

Expand Down