How difficult would it be to show battery information similar to what showtime and the weather app show on the desktop

Something as simple as …

Charging - 75%

or …

Discharging - 70%


Information from:

upower -i (upower -e | grep ‘BAT’)

state: discharging

percentage: 70%

Where do I start (and yes, I want to make it myself). I tried looking through the showtime code but that is too much for me :smiley:

Would you also (or only) want this on your desktop, or just (only) as an applet?

btw, seems you don’t need a system call, but you can use dbus: org.freedesktop.UPower

Install d-feet and watch all your options :slight_smile:

No ON the desktop. I got a complaint from people I maintain systems for that those digits in the panel are too small. There already is something for on the panel.

Aha, then strictly, you wouldn’t need it to be an applet, just a settings window like previews would do, -or- you could make it an applet without any presence in the panel (so no icon), only a settings section.
The show on your desktop would be just a transparent DESKTOP window in any case. What would you prefer?

The one that takes effort but not too much (I am lazy by nature).

" transparent DESKTOP window" That sounds like what I would like to see :smiley:

Only textual, or also with representative images? Color & font needs to be (able to be) set I guess?

Well. color and font: yes. Coordinates.
An image would be fancy but not really needed. The info is more important :slight_smile:

OH Forgot the most important part: I need to know how it is done :smiley: :smiley: :smiley: :smiley: I got more ideas for this.

Nice nice. I will make a few snippets you can look at. Vala, right?

shivers sure Vala :smiley:
murmurs snakes rule.

The parts we will need:

  • A transparent window
  • css for text
  • images representing state
  • gsettings connection
  • a control window or an applet to do the job
  • dbus

No doubt I forget one or more things. They will come to you in steps :slight_smile:

Can you use Conky for that sort of on screen information? I understand it’s customizable.

To be honest, I wouldn’t know. I don’t know Conky that well. The characters are tiny on first glance though, the main reason for this desktop representation.

Oh I did consider it but it will be overkill for something so simple.
But the biggest issue: most of conky is from 2015 when it was very popular. So pre python3 and loads of cool features never got updated. Maybe nobody cares anymore but THE coolest conky feature was showing transmission on the desktop: a list of torrents. Made in 2015. Needs a complete rewrite to be usable with the newest Ubuntu.

Conky is cool sure. But only a specific sub set of Ubuntu users wants to see cpu, gpu and memory usage on the desktop.

I would fully agree with you. With the recent demise of python2 security support, anyone who still uses python 2 based stuff are opening themselves up to a world of hurt. Stay well clear of anything python2 based.

… and yes 19.10 & 20.04 UB are now free of python2 - 20.04 repos has gone much further and removed many of the legacy python2 based stuff that hasnt had any maintenance for years.

…A transparent window…

I pushed it here

You’ll need a few dev libs, wait…
libgtk3-dev and libcairo2-dev

You deserve 3 {insert beverage}.
That code is easy to read. I am going hack away later today

AHUM libgtk-3-dev

valac is ook nodig neem ik aan.

woot :slight_smile:

rinzwind@schijfwereld:~ valac --pkg gtk+-3.0 m.vala rinzwind@schijfwereld:~ ./m

and it works O

1 Like

Daklop, dat was ik vergeten :slight_smile:

Question #1.

  • OnBattery and all shown here at the top I can get https://upower.freedesktop.org/docs/UPower.html

  • Percentage and all others in GetDisplayDevice not. All are 0 or empty.

    [DBus (name = “org.freedesktop.UPower.Device”)]
    public interface UPower : GLib.Object {
    [DBus (name = “OnBattery”)]
    public abstract bool on_battery { get; }
    [DBus (name = “Percentage”)]
    public abstract double percentage { get; }
    [DBus (name = “GetDisplayDevice”)]
    public abstract async GLib.ObjectPath get_display_device() throws DBusError, IOError;
    }

bold is likely wrong (guessed that one from the one above).
The 2 below it should lead me to Percentage (guessing).

So how do I get the contents from GetDisplayDevice. GLib.ObjectPath is not a variable(?) Object I would assume.