xfce-winxp-tc icon indicating copy to clipboard operation
xfce-winxp-tc copied to clipboard

Battery Power On Taskband

Open kammererN opened this issue 1 year ago • 3 comments

Wondering if there is any way to display the battery power of a laptop on the taskband. I am running wintc-taskband as a start application, and am working on disabling the XFCE taskbar.

If no such battery power display exists, I would not be opposed to working on developing a port for this feature.

kammererN avatar Jan 12 '24 04:01 kammererN

There is currently only a volume control icon implemented, battery and network icons need doing.

rozniak avatar Jan 15 '24 12:01 rozniak

I am currently learning C and would be interested in implementing this. It would be my first open-source contribution, so it will likely take some time.

Would a good course of action be to copy templates from the volume control icon and go from there?

kammererN avatar Jan 18 '24 15:01 kammererN

I would first start by making a very simple C application to basically just print like the current battery level? To make sure you have the core logic for detecting whether a battery is present, and that you can monitor changes (charging, discharging, etc.)

This may mean reading from something under /dev, or perhaps calling upower? (I don't know how portable the latter is... try to find what seems like the most portable solution/minimal dependencies)

Once you have the battery logic working, then make a start on integrating it with the taskband

  • Get battery stuff working with printf output in the console
  • Get a notification icon to appear in the UI
  • Integrate the battery logic into the notification icon behaviour

Feel free to ask any questions if you get stuck! The gist of the notification icons atm is that the systray creates the icon in the UI, and then maps a 'behaviour' to it (so the systray manages the UI, and the behaviour contains all the actual logic for that particular icon)

Have a look over how the volume icon works, hopefully it is straight forward enough!

rozniak avatar Jan 18 '24 16:01 rozniak