You are not logged in.

#1 2011-09-30 21:46:15

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Tidybattery - extremely lightweight GTK tray battery monitor

It's a fork of slimebattery-git app, but written on Python. Slimebattery is also good app, but have segfaults.

tidybattery.png

Here it is. and AUR

Last edited by decay_of_mind (2011-09-30 22:06:07)

Offline

#2 2011-10-01 16:15:50

jsteel
Trusted User (TU)
From: England
Registered: 2008-03-18
Posts: 115

Re: Tidybattery - extremely lightweight GTK tray battery monitor

What icon theme and panel is that you're using?

Thanks


PGP key: F40D2072
Key fingerprint: 8742 F753 5E7B 394A 1B04  8163 332C 9C40 F40D 2072

Offline

#3 2011-10-01 16:41:32

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,472
Website

Re: Tidybattery - extremely lightweight GTK tray battery monitor

It's Faenza and looking at the October screenshot thread, I assume that is Lxpanel.

Decay, I have been looking for a small battery monitor that worked for a long time! I just came across tint2's built in battery monitor, otherwise I definitely would've tried yours!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#4 2011-10-01 17:03:41

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Tidybattery - extremely lightweight GTK tray battery monitor

you are right - Faenza-Dark and lxpanel

Offline

#5 2011-10-29 21:09:02

samuvuo
Member
From: Finland
Registered: 2011-02-20
Posts: 84

Re: Tidybattery - extremely lightweight GTK tray battery monitor

Fab! Finally a battery monitor that Just Works. Thank you kindly.

Offline

#6 2011-12-03 17:42:01

xyon
Member
Registered: 2007-09-17
Posts: 23

Re: Tidybattery - extremely lightweight GTK tray battery monitor

I am excited to use this script. I have built it from AUR, it starts and reports battery information properly, however, I do not have a proper icon (there is a red 'x' with some themes, other themes are just blank). I've installed quite a few icon themes (and switched to them using 'lxappearance'), but I am obviously missing a vital piece. I do not have lxde installed, just fluxbox and X.

gnome-icon-theme 3.2.1.2-1
gnome-icon-theme-extras 3.0.0-1
gnome-icon-theme-symbolic 3.2.1-1
gtk-update-icon-cache 2.24.8-2
hicolor-icon-theme 0.12-1
human-icon-theme 0.36-2
icon-naming-utils 0.8.90-2
kdeartwork-iconthemes 4.7.3-1
lxde-icon-theme 0.0.1-1
oxygen-icons 4.7.3-1
tangerine-icon-theme 0.26-5
xf86-video-siliconmotion 1.7.5-3

Offline

#7 2012-01-28 13:03:43

kittykatt
Member
From: Missouri, USA
Registered: 2009-11-04
Posts: 260
Website

Re: Tidybattery - extremely lightweight GTK tray battery monitor

Using now. Great application. Thanks. big_smile


- [ My Blog ] | [ AUR Packages ] | [ My deviantART ] | [ screenFetch ] | [ SilverIRC ] -

Offline

#8 2012-03-04 12:37:17

swordfish
Member
Registered: 2012-01-14
Posts: 160

Re: Tidybattery - extremely lightweight GTK tray battery monitor

xyon wrote:

I am excited to use this script. I have built it from AUR, it starts and reports battery information properly, however, I do not have a proper icon (there is a red 'x' with some themes, other themes are just blank).

Same here with Openbox and Tint2. Tidybattery shows just a white "paper"-icon with a red cross on it. The icon shows an on-mouse-over effect that says in my case:

unknown, 97%

Any hint on how to get a proper icon would be appreciated wink

Last edited by swordfish (2012-03-04 12:37:54)


Arch_x64 on Thinkpad Edge E520 (Intel Core i5, 4 GB RAM, 128 GB Crucial M4 SSD) + ITX-Desktop (Asrock H77M-ITX, Intel Core i3-2120T, 8GB RAM, 64 GB Samsung 830 SSD)

Offline

#9 2012-03-22 09:07:57

Prezioso
Member
Registered: 2011-01-17
Posts: 77

Re: Tidybattery - extremely lightweight GTK tray battery monitor

Same here, only red X

Offline

#10 2012-04-13 06:10:30

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Tidybattery - extremely lightweight GTK tray battery monitor

One solution is to copy all status icons from Faenza Dark to your icon theme of choice. Of course, that will destroy all nice status icons in that icon theme. In Faenza Dark the png's are called 'gpm-battery-xxx-xxx.png' and 'gpm-primary-xxx-xxx.png', or the like. You could also copy each and every one of them manually for all sizes and scalable too. That would preserve your present status icons and just add the necessary ones.

Offline

#11 2012-04-24 06:47:05

malachi
Member
Registered: 2008-11-11
Posts: 15

Re: Tidybattery - extremely lightweight GTK tray battery monitor

Gentoo/Openbox user here

This is fantastic.

I've been mad at xfce4-power-manager for a while now because while its interface is pretty much the same as this (which is what I want), it likes to not realize that i've removed the power adaptor, or plugged it back in, and so on. So I sat there wondering why there didn't seem to be a battery monitor that just polled acpi periodically, and ended up just writing a shell script that just outputs the %

...but this is much, much nicer smile It's people like you that make me miss my Arch days.

Last edited by malachi (2012-04-24 06:48:13)

Offline

#12 2012-05-28 13:24:42

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Tidybattery - extremely lightweight GTK tray battery monitor

swordfish wrote:

unknown, 97%

This script is just polling an acpi status from "acpi -i" output.
So, if you got an Unknown status in acpi -i output and you have ThinkPad, it possibly means "Charging".

Offline

#13 2012-06-23 16:51:16

stlarch
Member
From: hell
Registered: 2010-12-25
Posts: 1,250

Re: Tidybattery - extremely lightweight GTK tray battery monitor

I can't download this. 403

Offline

#14 2012-12-14 00:47:30

latgarf
Member
Registered: 2012-12-14
Posts: 14

Re: Tidybattery - extremely lightweight GTK tray battery monitor

swanson wrote:

One solution is to copy all status icons from Faenza Dark to your icon theme of choice. Of course, that will destroy all nice status icons in that icon theme. In Faenza Dark the png's are called 'gpm-battery-xxx-xxx.png' and 'gpm-primary-xxx-xxx.png', or the like. You could also copy each and every one of them manually for all sizes and scalable too. That would preserve your present status icons and just add the necessary ones.

Trying this solution, but it's not yet working for me. I have openbox and Clearlooks is my default theme. After I copied all Faenza-Dark png's from status/16 to /usr/share/themes/Clearlooks same red cross persists. Thanks for any tips!

Offline

#15 2012-12-23 00:53:54

latgarf
Member
Registered: 2012-12-14
Posts: 14

Re: Tidybattery - extremely lightweight GTK tray battery monitor

Found my solution: 
Specify in file
/etc/gtk-2.0/gtkrc
gtk-fallback-icon-theme = "Faenza-Dark"

Offline

#16 2012-12-23 04:29:49

BennyBolton
Member
From: Christchurch New Zealand
Registered: 2011-10-14
Posts: 63
Website

Re: Tidybattery - extremely lightweight GTK tray battery monitor

I had a problem where this script would crash after suspending my laptop due to the output of acpi not matching the desired result, i've modified the script to check to make sure the output matches using a regular expression and i also modified the icons to use the xfce4-battery-* icons. Here is my modified version of the script:

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
#       

import gtk
import gobject
import subprocess
import re

ACPI_CMD = 'acpi'
TIMEOUT = 2

class MainApp:
	def __init__(self):
		self.icon = gtk.StatusIcon()
		self.update_icon()
		gobject.timeout_add_seconds(TIMEOUT,self.update_icon)
	
	def get_battery_info(self):
		text = subprocess.check_output(ACPI_CMD).strip('\n')
		if(re.match("[^:]+:[^,]+,.+",text)):
			data = text.split(',')
			return {'state':data[0].split(':')[1].strip(' '),
					'percentage':int(data[1].strip(' %')),
					'tooltip': text.split(':',1)[1][1:]
					}
	
	def get_icon_name(self, state, percentage):
		if state == 'Discharging':
			if percentage < 10:
				return 'xfce4-battery-critical'
			elif percentage < 40:
				return 'xfce4-battery-low'
			elif percentage < 75:
				return 'xfce4-battery-ok'
			else:
				return 'xfce4-battery-full'
		else:
			if percentage < 10:
				return 'xfce4-battery-critical-charging'
			elif percentage < 40:
				return 'xfce4-battery-low-charging'
			elif percentage < 75:
				return 'xfce4-battery-ok-charging'
			else:
				return 'xfce4-battery-full-charging'
	
	def update_icon(self):
		info = self.get_battery_info()
		icon_name = self.get_icon_name(info['state'],info['percentage'])
		self.icon.set_from_icon_name(icon_name)
		self.icon.set_tooltip_text(info['tooltip'])
		return True
	
if __name__ == "__main__":
	try:
		MainApp()
		gtk.main()
	except KeyboardInterrupt:
		pass

HP DV6 + Arch + Openbox

Offline

#17 2013-05-03 12:12:30

broom
Member
Registered: 2008-01-21
Posts: 7

Re: Tidybattery - extremely lightweight GTK tray battery monitor

BennyBolton wrote:

I had a problem where this script would crash after suspending my laptop due to the output of acpi not matching the desired result

I had the same problem, and I fixed it before reading the page to the end and finding your solution. smile

My solution is just a bit different (I've added new icon if output of 'acpi' command can't be parsed):

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
#       

import gtk
import gobject
import subprocess

ACPI_CMD = 'acpi'
TIMEOUT = 2

class MainApp:
        def __init__(self):
                self.icon = gtk.StatusIcon()
                self.update_icon()
                gobject.timeout_add_seconds(TIMEOUT,self.update_icon)

        def get_battery_info(self):
                text = subprocess.check_output(ACPI_CMD).strip('\n')
                if not 'Battery' in text:
                        return {'state':"Unknown",
                                'percentage':0,
                                'tooltip':""
                                }
                data = text.split(',')
                return {'state':data[0].split(':')[1].strip(' '),
                                'percentage':int(data[1].strip(' %')),
                                'tooltip': text.split(':',1)[1][1:]
                                }

        def get_icon_name(self, state, percentage):
                if state == 'Discharging':
                        if percentage < 10:
                                return 'battery_empty'
                        elif percentage < 20:
                                return 'battery_caution'
                        elif percentage < 40:
                                return 'battery_low'
                        elif percentage < 60:
                                return 'battery_two_thirds'
                        elif percentage < 75:
                                return 'battery_third_fouth'
                        else:
                                return 'battery_full'
                elif state == 'Charged':
                        return 'battery_charged'
                elif state == 'Unknown':
                        return 'dialog-question'
                else:
                        return 'battery_plugged'

        def update_icon(self):
                info = self.get_battery_info()
                icon_name = self.get_icon_name(info['state'],info['percentage'])
                self.icon.set_from_icon_name(icon_name)
                self.icon.set_tooltip_text(info['tooltip'])
                return True

if __name__ == "__main__":
        try:
                MainApp()
                gtk.main()
        except KeyboardInterrupt:
                pass

Offline

#18 2013-12-16 18:45:51

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Tidybattery - extremely lightweight GTK tray battery monitor

Sorry, guys.
Big part of my IT life has changed and I do not use ArchLinux anymore. So, I've realized, that you folks use my simple scripts. I made repo on github and updated PKGBUILD's on AUR.
Enjooy!

Offline

#19 2014-05-05 18:08:09

nashamri
Member
Registered: 2014-04-09
Posts: 29

Re: Tidybattery - extremely lightweight GTK tray battery monitor

Hey there,
I forked the github repo and created a modified version of the application.
The application that I created is for systems with dual battery setups (like the Thinkpad X240).
you can find the modified version here

https://aur.archlinux.org/packages/dualtidy/

Hope you guys like it smile

Offline

#20 2014-05-31 18:10:24

nashamri
Member
Registered: 2014-04-09
Posts: 29

Re: Tidybattery - extremely lightweight GTK tray battery monitor

Hey there,

New update, now it supports one battery and more.

Thanks to mynameisfiber [https://github.com/mynameisfiber]

Offline

#21 2015-12-29 22:53:36

verbify
Member
Registered: 2015-12-29
Posts: 1

Re: Tidybattery - extremely lightweight GTK tray battery monitor

The AUR links are giving me a 404.

Offline

Board footer

Powered by FluxBB