Git Product home page Git Product logo

battery-meter's Introduction

battery-meter

A Battery meter for X11 written in pure Xlib.

Battery Meter Screenshot

why

I was putting together a minimal X11 environment on my smaller Thinkpad T61 laptop based around twm and Xaw. I wanted a simple battery meter, so I wrote one.

usage

bm <xpos> <ypos> <width> <height>
  • xpos = the X pixel position on screen
  • ypos = the Y pixel position on screen
  • width = the width of the battery bar, in pixels
  • height = the height of the battery bar, in pixels

example

On my Thinkpad T61 with 1280x800 display, putting close to lower right, next to my clock (as in the screenshot)

bm 840 766 256 16

license

Licensed under GPL v. 3, see LICENSE file for details.

author

Thomas Cherryhomes <thom.cherryhomes at gmail.com>

battery-meter's People

Contributors

tschak909 avatar polluks avatar

Stargazers

TurBoss avatar John Mercier avatar  avatar

Watchers

 avatar  avatar

Forkers

polluks

battery-meter's Issues

WSL1 XGetGeometry crash

(gdb) r 10 10 10 10
Starting program: /home/stefan/g/battery-meter/bm 10 10 10 10
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007fffff6789a6 in XGetGeometry () from /usr/lib/x86_64-linux-gnu/libX11.so.6
(gdb) bt
#0  0x00007fffff6789a6 in XGetGeometry () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#1  0x0000000008001490 in handle_expose () at bm.c:85
#2  0x0000000008001891 in main (argc=5, argv=0x7ffffffee1d8) at bm.c:152

FYI

/sys/class/power_supply/
|-- ac
|   |-- online
|   `-- type
|-- battery
|   |-- capacity
|   |-- charge_counter
|   |-- current_now
|   |-- health
|   |-- present
|   |-- status
|   |-- technology
|   |-- temp
|   |-- type
|   `-- voltage_now
`-- usb
    |-- online
    `-- type

Minor clang warnings

cc -obm -I/opt/X11/include -L/opt/X11/lib -O2 bm.c -lX11
bm.c:85:47: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
  XGetGeometry(display, win, winRoot, &x, &y, &w, &h, &bw, &de);
                                              ^~
/opt/X11/include/X11/Xlib.h:2640:37: note: passing argument to parameter here
    unsigned int*       /* width_return */,
                                          ^
bm.c:85:51: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
  XGetGeometry(display, win, winRoot, &x, &y, &w, &h, &bw, &de);
                                                  ^~
/opt/X11/include/X11/Xlib.h:2641:38: note: passing argument to parameter here
    unsigned int*       /* height_return */,
                                           ^
bm.c:85:55: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
  XGetGeometry(display, win, winRoot, &x, &y, &w, &h, &bw, &de);
                                                      ^~~
/opt/X11/include/X11/Xlib.h:2642:44: note: passing argument to parameter here
    unsigned int*       /* border_width_return */,
                                                 ^
bm.c:85:60: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
  XGetGeometry(display, win, winRoot, &x, &y, &w, &h, &bw, &de);
                                                           ^~~
/opt/X11/include/X11/Xlib.h:2644:1: note: passing argument to parameter here
);
^
4 warnings generated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.