sub get_online { ! $battery->GetPropertyBoolean('battery.rechargeable.is_discharging'); } sub get_percent { $battery->GetPropertyInteger('battery.charge_level.percentage'); } sub get_remaining { my $time_remaining = "00:00:00"; eval { my $seconds = $battery->GetPropertyInteger('battery.remaining_time'); my $h = $seconds / 3600; my $m = ($seconds % 3600) / 60; my $s = $seconds % 60; $time_remaining = sprintf "%02d:%02d:%02d", $h, $m, $s; }; $time_remaining; }