Initial commit
This commit is contained in:
commit
344c3b8431
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 8
|
||||||
|
charset = utf-8
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
bin/
|
||||||
|
lib/
|
||||||
|
~*
|
34
INSTALL.md
Normal file
34
INSTALL.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Installing
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- Xlib
|
||||||
|
- Xt
|
||||||
|
- Motif
|
||||||
|
- A C compiler
|
||||||
|
|
||||||
|
Installing via APK:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# apk add libx11 libx11-dev libxt libxt-dev motif motif-dev clang
|
||||||
|
```
|
||||||
|
|
||||||
|
## libXmd
|
||||||
|
|
||||||
|
Before building any of the applications you will need to build libXmd, which
|
||||||
|
contains code common to most of them:
|
||||||
|
|
||||||
|
```
|
||||||
|
# cd libXmd
|
||||||
|
# ./build.sh install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Individual applications
|
||||||
|
|
||||||
|
Individual applications can be installed using `./build.sh` in their respective
|
||||||
|
subdirectories:
|
||||||
|
|
||||||
|
```
|
||||||
|
# cd <application>
|
||||||
|
# ./build.sh install
|
||||||
|
```
|
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Xmd
|
||||||
|
|
||||||
|
A collection of X11 Motif desktop utilities written in C99.
|
14
libXmd/XmdIcon.c
Normal file
14
libXmd/XmdIcon.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <Xmd/Icon.h>
|
||||||
|
|
||||||
|
Pixmap _XmdLoadBitmapIcon (Widget widget, unsigned char *bits, int width, int height) {
|
||||||
|
Pixel fg, bg;
|
||||||
|
XtVaGetValues (widget,
|
||||||
|
XmNforeground, &fg,
|
||||||
|
XmNbackground, &bg,
|
||||||
|
NULL);
|
||||||
|
return XCreatePixmapFromBitmapData (
|
||||||
|
XtDisplay (widget),
|
||||||
|
RootWindowOfScreen(XtScreen(widget)),
|
||||||
|
(char *)(bits), width, height,
|
||||||
|
fg, bg, DefaultDepthOfScreen(XtScreen(widget)));
|
||||||
|
}
|
26
libXmd/build.sh
Executable file
26
libXmd/build.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. ../scripts/flags.sh
|
||||||
|
|
||||||
|
function build() {
|
||||||
|
cc $CFLAGS -shared -o "lib/libXmd.so" *.c || \
|
||||||
|
echo "XXX FAIL!"
|
||||||
|
}
|
||||||
|
|
||||||
|
function clean() {
|
||||||
|
rm -f lib/*
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
install)
|
||||||
|
clean; build
|
||||||
|
cp lib/*.so "$PREFIX/lib"
|
||||||
|
cp include/Xmd/*.h "$PREFIX/include/Xmd"
|
||||||
|
clean
|
||||||
|
;;
|
||||||
|
clean)
|
||||||
|
clean
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
build
|
||||||
|
esac
|
13
libXmd/include/Xmd/Icon.h
Normal file
13
libXmd/include/Xmd/Icon.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef _XmdIcon_h
|
||||||
|
#define _XmdIcon_h
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Intrinsic.h>
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
|
||||||
|
/* XmdLoadBitmapIcon is a macro that loads an icon with the specified name. That Icon must
|
||||||
|
be #include'd in your code somewhere. The name parameter must be a token, not a string. */
|
||||||
|
#define XmdLoadBitmapIcon(widget, name) _XmdLoadBitmapIcon(widget, name##_bits, name##_width, name##_height)
|
||||||
|
Pixmap _XmdLoadBitmapIcon (Widget widget, unsigned char *bits, int width, int height);
|
||||||
|
|
||||||
|
#endif
|
13
libXmd/include/Xmd/Launcher.h
Normal file
13
libXmd/include/Xmd/Launcher.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef _XmdLauncher_h
|
||||||
|
#define _XmdLauncher_h
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Intrinsic.h>
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Pixmap icon;
|
||||||
|
const char *command;
|
||||||
|
} XmdLauncher;
|
||||||
|
|
||||||
|
#endif
|
27
scripts/buildapp.sh
Executable file
27
scripts/buildapp.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. `dirname $0`/flags.sh
|
||||||
|
|
||||||
|
function build() {
|
||||||
|
mkdir -p bin
|
||||||
|
cc $CFLAGS -c -o "bin/$1.o" src/*.c && \
|
||||||
|
cc -o "bin/$1" "bin/$1.o" $APP_LIBS || \
|
||||||
|
echo "XXX FAIL!"
|
||||||
|
}
|
||||||
|
|
||||||
|
function clean() {
|
||||||
|
rm -f bin/*
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$2" in
|
||||||
|
install)
|
||||||
|
clean; build "$1"
|
||||||
|
cp "bin/$1" "$PREFIX/bin"
|
||||||
|
clean
|
||||||
|
;;
|
||||||
|
clean)
|
||||||
|
clean
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
build "$1"
|
||||||
|
esac
|
5
scripts/flags.sh
Normal file
5
scripts/flags.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
CFLAGS="-std=c99 -Wall -Wextra -Werror -fPIC"
|
||||||
|
PREFIX="/usr/local"
|
||||||
|
APP_LIBS="-lXmd -lXm -lXt -lX11"
|
BIN
xmbattery/..o
Normal file
BIN
xmbattery/..o
Normal file
Binary file not shown.
BIN
xmbattery/.o
Normal file
BIN
xmbattery/.o
Normal file
Binary file not shown.
2
xmbattery/build.sh
Executable file
2
xmbattery/build.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
../scripts/buildapp.sh xmbattery "$@"
|
15
xmbattery/src/icons/charging.xbm
Normal file
15
xmbattery/src/icons/charging.xbm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#define charging_width 48
|
||||||
|
#define charging_height 24
|
||||||
|
static unsigned char charging_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0x18, 0x03, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xf6, 0xff, 0xff, 0xff, 0x33,
|
||||||
|
0x0c, 0xf6, 0xff, 0xff, 0xff, 0x37, 0x0c, 0xe6, 0xff, 0x3f, 0xfe, 0x37,
|
||||||
|
0x46, 0xec, 0xff, 0x07, 0xff, 0x67, 0xe6, 0xec, 0xff, 0x80, 0xff, 0x6f,
|
||||||
|
0xe6, 0xec, 0x1f, 0xc0, 0xff, 0x6f, 0xe6, 0xec, 0x07, 0xe3, 0xff, 0x6f,
|
||||||
|
0xe6, 0xec, 0xff, 0x63, 0xf0, 0x6f, 0xe6, 0xec, 0xff, 0x01, 0xfc, 0x6f,
|
||||||
|
0xe6, 0xec, 0xff, 0x80, 0xff, 0x6f, 0x46, 0xec, 0x7f, 0xf0, 0xff, 0x67,
|
||||||
|
0x0c, 0xe6, 0x3f, 0xfe, 0xff, 0x37, 0x0c, 0xf6, 0xff, 0xff, 0xff, 0x37,
|
||||||
|
0x0c, 0xf6, 0xff, 0xff, 0xff, 0x33, 0x18, 0x03, 0x00, 0x00, 0x00, 0x18,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
15
xmbattery/src/icons/error.xbm
Normal file
15
xmbattery/src/icons/error.xbm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#define error_width 48
|
||||||
|
#define error_height 24
|
||||||
|
static unsigned char error_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0x18, 0x03, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x30,
|
||||||
|
0x0c, 0x06, 0x40, 0x80, 0x00, 0x30, 0x0c, 0x06, 0xe0, 0xc0, 0x01, 0x30,
|
||||||
|
0x46, 0x0c, 0xc0, 0xe1, 0x00, 0x60, 0xe6, 0x0c, 0x80, 0x73, 0x00, 0x60,
|
||||||
|
0xe6, 0x0c, 0x00, 0x3f, 0x00, 0x60, 0xe6, 0x0c, 0x00, 0x1e, 0x00, 0x60,
|
||||||
|
0xe6, 0x0c, 0x00, 0x1e, 0x00, 0x60, 0xe6, 0x0c, 0x00, 0x3f, 0x00, 0x60,
|
||||||
|
0xe6, 0x0c, 0x80, 0x73, 0x00, 0x60, 0x46, 0x0c, 0xc0, 0xe1, 0x00, 0x60,
|
||||||
|
0x0c, 0x06, 0xe0, 0xc0, 0x01, 0x30, 0x0c, 0x06, 0x40, 0x80, 0x00, 0x30,
|
||||||
|
0x0c, 0x06, 0x00, 0x00, 0x00, 0x30, 0x18, 0x03, 0x00, 0x00, 0x00, 0x18,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
15
xmbattery/src/icons/level0.xbm
Normal file
15
xmbattery/src/icons/level0.xbm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#define level0_width 48
|
||||||
|
#define level0_height 24
|
||||||
|
static unsigned char level0_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0x18, 0x03, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x32,
|
||||||
|
0x0c, 0x06, 0x00, 0x02, 0x00, 0x37, 0x0c, 0x06, 0x00, 0x07, 0x00, 0x37,
|
||||||
|
0x46, 0x0c, 0x00, 0x07, 0x00, 0x67, 0xe6, 0x0c, 0x00, 0x07, 0x80, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0x07, 0x80, 0x6f, 0xe6, 0x0c, 0x00, 0x07, 0x80, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0x02, 0x80, 0x6f, 0xe6, 0x0c, 0x00, 0x02, 0x80, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0x00, 0x80, 0x6f, 0x46, 0x0c, 0x00, 0x02, 0x00, 0x67,
|
||||||
|
0x0c, 0x06, 0x00, 0x07, 0x00, 0x37, 0x0c, 0x06, 0x00, 0x02, 0x00, 0x37,
|
||||||
|
0x0c, 0x06, 0x00, 0x00, 0x00, 0x32, 0x18, 0x03, 0x00, 0x00, 0x00, 0x18,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
15
xmbattery/src/icons/level1.xbm
Normal file
15
xmbattery/src/icons/level1.xbm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#define level1_width 48
|
||||||
|
#define level1_height 24
|
||||||
|
static unsigned char level1_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0x18, 0x03, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x06, 0x00, 0x00, 0xfe, 0x33,
|
||||||
|
0x0c, 0x06, 0x00, 0x00, 0xff, 0x37, 0x0c, 0x06, 0x00, 0x00, 0xff, 0x37,
|
||||||
|
0x46, 0x0c, 0x00, 0x00, 0xff, 0x67, 0xe6, 0x0c, 0x00, 0x80, 0xff, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0x80, 0xff, 0x6f, 0xe6, 0x0c, 0x00, 0x80, 0xff, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0x80, 0xff, 0x6f, 0xe6, 0x0c, 0x00, 0x80, 0xff, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0x80, 0xff, 0x6f, 0x46, 0x0c, 0x00, 0x00, 0xff, 0x67,
|
||||||
|
0x0c, 0x06, 0x00, 0x00, 0xff, 0x37, 0x0c, 0x06, 0x00, 0x00, 0xff, 0x37,
|
||||||
|
0x0c, 0x06, 0x00, 0x00, 0xfe, 0x33, 0x18, 0x03, 0x00, 0x00, 0x00, 0x18,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
15
xmbattery/src/icons/level2.xbm
Normal file
15
xmbattery/src/icons/level2.xbm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#define level2_width 48
|
||||||
|
#define level2_height 24
|
||||||
|
static unsigned char level2_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0x18, 0x03, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x06, 0x00, 0xf8, 0xff, 0x33,
|
||||||
|
0x0c, 0x06, 0x00, 0xfc, 0xff, 0x37, 0x0c, 0x06, 0x00, 0xfc, 0xff, 0x37,
|
||||||
|
0x46, 0x0c, 0x00, 0xfc, 0xff, 0x67, 0xe6, 0x0c, 0x00, 0xfe, 0xff, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0xfe, 0xff, 0x6f, 0xe6, 0x0c, 0x00, 0xfe, 0xff, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0xfe, 0xff, 0x6f, 0xe6, 0x0c, 0x00, 0xfe, 0xff, 0x6f,
|
||||||
|
0xe6, 0x0c, 0x00, 0xfe, 0xff, 0x6f, 0x46, 0x0c, 0x00, 0xfc, 0xff, 0x67,
|
||||||
|
0x0c, 0x06, 0x00, 0xfc, 0xff, 0x37, 0x0c, 0x06, 0x00, 0xfc, 0xff, 0x37,
|
||||||
|
0x0c, 0x06, 0x00, 0xf8, 0xff, 0x33, 0x18, 0x03, 0x00, 0x00, 0x00, 0x18,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
15
xmbattery/src/icons/level3.xbm
Normal file
15
xmbattery/src/icons/level3.xbm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#define level3_width 48
|
||||||
|
#define level3_height 24
|
||||||
|
static unsigned char level3_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0x18, 0x03, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x06, 0xfe, 0xff, 0xff, 0x33,
|
||||||
|
0x0c, 0x06, 0xff, 0xff, 0xff, 0x37, 0x0c, 0x06, 0xff, 0xff, 0xff, 0x37,
|
||||||
|
0x46, 0x0c, 0xff, 0xff, 0xff, 0x67, 0xe6, 0x8c, 0xff, 0xff, 0xff, 0x6f,
|
||||||
|
0xe6, 0x8c, 0xff, 0xff, 0xff, 0x6f, 0xe6, 0x8c, 0xff, 0xff, 0xff, 0x6f,
|
||||||
|
0xe6, 0x8c, 0xff, 0xff, 0xff, 0x6f, 0xe6, 0x8c, 0xff, 0xff, 0xff, 0x6f,
|
||||||
|
0xe6, 0x8c, 0xff, 0xff, 0xff, 0x6f, 0x46, 0x0c, 0xff, 0xff, 0xff, 0x67,
|
||||||
|
0x0c, 0x06, 0xff, 0xff, 0xff, 0x37, 0x0c, 0x06, 0xff, 0xff, 0xff, 0x37,
|
||||||
|
0x0c, 0x06, 0xfe, 0xff, 0xff, 0x33, 0x18, 0x03, 0x00, 0x00, 0x00, 0x18,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
15
xmbattery/src/icons/level4.xbm
Normal file
15
xmbattery/src/icons/level4.xbm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#define level4_width 48
|
||||||
|
#define level4_height 24
|
||||||
|
static unsigned char level4_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||||
|
0x18, 0x03, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xf6, 0xff, 0xff, 0xff, 0x33,
|
||||||
|
0x0c, 0xf6, 0xff, 0xff, 0xff, 0x37, 0x0c, 0xe6, 0xff, 0xff, 0xff, 0x37,
|
||||||
|
0x46, 0xec, 0xff, 0xff, 0xff, 0x67, 0xe6, 0xec, 0xff, 0xff, 0xff, 0x6f,
|
||||||
|
0xe6, 0xec, 0xff, 0xff, 0xff, 0x6f, 0xe6, 0xec, 0xff, 0xff, 0xff, 0x6f,
|
||||||
|
0xe6, 0xec, 0xff, 0xff, 0xff, 0x6f, 0xe6, 0xec, 0xff, 0xff, 0xff, 0x6f,
|
||||||
|
0xe6, 0xec, 0xff, 0xff, 0xff, 0x6f, 0x46, 0xec, 0xff, 0xff, 0xff, 0x67,
|
||||||
|
0x0c, 0xe6, 0xff, 0xff, 0xff, 0x37, 0x0c, 0xf6, 0xff, 0xff, 0xff, 0x37,
|
||||||
|
0x0c, 0xf6, 0xff, 0xff, 0xff, 0x33, 0x18, 0x03, 0x00, 0x00, 0x00, 0x18,
|
||||||
|
0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
15
xmbattery/src/icons/not.xbm
Normal file
15
xmbattery/src/icons/not.xbm
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#define not_width 48
|
||||||
|
#define not_height 24
|
||||||
|
static unsigned char not_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xa0, 0xaa, 0xaa, 0xaa, 0xaa, 0x02, 0x50, 0x55, 0x55, 0x55, 0x55, 0x05,
|
||||||
|
0x08, 0x02, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10,
|
||||||
|
0x08, 0x02, 0x00, 0x00, 0x00, 0x20, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10,
|
||||||
|
0x02, 0x08, 0x00, 0x00, 0x00, 0x20, 0x44, 0x04, 0x00, 0x00, 0x00, 0x40,
|
||||||
|
0xa2, 0x08, 0x00, 0x00, 0x00, 0x20, 0x44, 0x04, 0x00, 0x00, 0x00, 0x40,
|
||||||
|
0xa2, 0x08, 0x00, 0x00, 0x00, 0x20, 0x44, 0x04, 0x00, 0x00, 0x00, 0x40,
|
||||||
|
0xa2, 0x08, 0x00, 0x00, 0x00, 0x20, 0x44, 0x04, 0x00, 0x00, 0x00, 0x40,
|
||||||
|
0x08, 0x02, 0x00, 0x00, 0x00, 0x20, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10,
|
||||||
|
0x08, 0x02, 0x00, 0x00, 0x00, 0x20, 0x10, 0x01, 0x00, 0x00, 0x00, 0x10,
|
||||||
|
0xa0, 0xaa, 0xaa, 0xaa, 0xaa, 0x0a, 0x40, 0x55, 0x55, 0x55, 0x55, 0x05,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
242
xmbattery/src/main.c
Normal file
242
xmbattery/src/main.c
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
/* C99 */
|
||||||
|
|
||||||
|
#define _XOPEN_SOURCE
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
#include <Xm/Scale.h>
|
||||||
|
#include <Xm/LabelG.h>
|
||||||
|
#include <Xm/PushB.h>
|
||||||
|
#include <Xm/MessageB.h>
|
||||||
|
#include <Xm/RowColumn.h>
|
||||||
|
#include <Xm/Separator.h>
|
||||||
|
#include <Xmd/Icon.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "icons/level0.xbm"
|
||||||
|
#include "icons/level1.xbm"
|
||||||
|
#include "icons/level2.xbm"
|
||||||
|
#include "icons/level3.xbm"
|
||||||
|
#include "icons/level4.xbm"
|
||||||
|
#include "icons/charging.xbm"
|
||||||
|
#include "icons/error.xbm"
|
||||||
|
#include "icons/not.xbm"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
BatteryStateCharging,
|
||||||
|
BatteryStateNotCharging,
|
||||||
|
BatteryStateFull,
|
||||||
|
BatteryStateDischarging,
|
||||||
|
BatteryStateError
|
||||||
|
} BatteryState;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int level;
|
||||||
|
BatteryState state;
|
||||||
|
int hours;
|
||||||
|
int minutes;
|
||||||
|
int seconds;
|
||||||
|
} BatteryInfo;
|
||||||
|
|
||||||
|
BatteryInfo getBatteryInfo (void);
|
||||||
|
Pixmap selectBatteryIcon (BatteryInfo);
|
||||||
|
void loadAllPixmaps (Widget);
|
||||||
|
void batteryPoll (XtPointer, XtIntervalId *);
|
||||||
|
void resetBatteryPollTimeout(void);
|
||||||
|
void batteryInfoDialog (Widget, XtPointer, XtPointer);
|
||||||
|
|
||||||
|
Pixmap levels[8] = { 0 };
|
||||||
|
XtAppContext application;
|
||||||
|
Widget icon;
|
||||||
|
Widget text;
|
||||||
|
Widget layout;
|
||||||
|
Widget window;
|
||||||
|
|
||||||
|
int main (int argc, char *argv[]) {
|
||||||
|
window = XtVaAppInitialize (
|
||||||
|
&application, "Battery",
|
||||||
|
NULL, 0,
|
||||||
|
&argc, argv,
|
||||||
|
NULL,
|
||||||
|
XmNtitle, "Battery",
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
layout = XtVaCreateWidget (
|
||||||
|
"layout", xmRowColumnWidgetClass, window,
|
||||||
|
XmNorientation, XmHORIZONTAL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
loadAllPixmaps(layout);
|
||||||
|
icon = XtVaCreateManagedWidget (
|
||||||
|
"batteryIcon", xmPushButtonWidgetClass, layout,
|
||||||
|
XmNleftAttachment, XmATTACH_FORM,
|
||||||
|
XmNlabelType, XmPIXMAP,
|
||||||
|
NULL);
|
||||||
|
XtAddCallback(icon, XmNactivateCallback, batteryInfoDialog, NULL);
|
||||||
|
|
||||||
|
XtVaCreateManagedWidget (
|
||||||
|
"separator", xmSeparatorWidgetClass, layout,
|
||||||
|
XmNorientation, XmVERTICAL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
text = XtVaCreateManagedWidget (
|
||||||
|
"text", xmLabelGadgetClass, layout,
|
||||||
|
XmNalignment, XmALIGNMENT_CENTER,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
batteryPoll(NULL, NULL);
|
||||||
|
|
||||||
|
XtManageChild(layout);
|
||||||
|
XtRealizeWidget(window);
|
||||||
|
XtAppMainLoop(application);
|
||||||
|
}
|
||||||
|
|
||||||
|
BatteryInfo getBatteryInfo (void) {
|
||||||
|
BatteryInfo result = { 0 };
|
||||||
|
char charging[16] = { 0 };
|
||||||
|
int battery;
|
||||||
|
|
||||||
|
FILE *stream = popen("acpi -b", "r");
|
||||||
|
if (stream == NULL) {
|
||||||
|
result.state = BatteryStateError;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
fscanf (
|
||||||
|
stream, "Battery %d: %16s %d%%, %d:%d:%d",
|
||||||
|
&battery, charging, &result.level,
|
||||||
|
&result.hours, &result.minutes, &result.seconds);
|
||||||
|
|
||||||
|
switch (charging[0]) {
|
||||||
|
case 'C': result.state = BatteryStateCharging; break;
|
||||||
|
case 'N': result.state = BatteryStateNotCharging; break;
|
||||||
|
case 'D': result.state = BatteryStateDischarging; break;
|
||||||
|
case 'F': result.state = BatteryStateFull; break;
|
||||||
|
default: result.state = BatteryStateError; break;
|
||||||
|
}
|
||||||
|
if (pclose(stream) != 0) {
|
||||||
|
result.state = BatteryStateError;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pixmap selectBatteryIcon (BatteryInfo info) {
|
||||||
|
if (info.state == BatteryStateCharging) {
|
||||||
|
return levels[5];
|
||||||
|
} else if (info.state == BatteryStateNotCharging) {
|
||||||
|
return levels[7];
|
||||||
|
} else if (info.state == BatteryStateError) {
|
||||||
|
return levels[6];
|
||||||
|
} else if (info.level < 15) {
|
||||||
|
return levels[0];
|
||||||
|
} else if (info.level < 35) {
|
||||||
|
return levels[1];
|
||||||
|
} else if (info.level < 65) {
|
||||||
|
return levels[2];
|
||||||
|
} else if (info.level < 85) {
|
||||||
|
return levels[3];
|
||||||
|
} else {
|
||||||
|
return levels[4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadAllPixmaps (Widget widget) {
|
||||||
|
levels[0] = XmdLoadBitmapIcon(widget, level0);
|
||||||
|
levels[1] = XmdLoadBitmapIcon(widget, level1);
|
||||||
|
levels[2] = XmdLoadBitmapIcon(widget, level2);
|
||||||
|
levels[3] = XmdLoadBitmapIcon(widget, level3);
|
||||||
|
levels[4] = XmdLoadBitmapIcon(widget, level4);
|
||||||
|
levels[5] = XmdLoadBitmapIcon(widget, charging);
|
||||||
|
levels[6] = XmdLoadBitmapIcon(widget, error);
|
||||||
|
levels[7] = XmdLoadBitmapIcon(widget, not);
|
||||||
|
}
|
||||||
|
|
||||||
|
void batteryPoll (XtPointer clientData, XtIntervalId *timer) {
|
||||||
|
(void)(clientData);
|
||||||
|
(void)(timer);
|
||||||
|
BatteryInfo info = getBatteryInfo();
|
||||||
|
|
||||||
|
XtVaSetValues (
|
||||||
|
icon,
|
||||||
|
XmNlabelType, XmPIXMAP,
|
||||||
|
XmNlabelPixmap, selectBatteryIcon(info),
|
||||||
|
NULL);
|
||||||
|
XtVaSetValues (
|
||||||
|
window,
|
||||||
|
XmNiconPixmap, selectBatteryIcon(info),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
#define BUFFER_LEN 32
|
||||||
|
char buffer[BUFFER_LEN];
|
||||||
|
snprintf(buffer, BUFFER_LEN, "%d%%", info.level);
|
||||||
|
#undef BUFFER_LEN
|
||||||
|
|
||||||
|
/* if we don't unmanage and then re-manage the child, the text flies to
|
||||||
|
* the top which is rather annoying. this little quirk bent me over and
|
||||||
|
* fucked me for hours. */
|
||||||
|
XtUnmanageChild(text);
|
||||||
|
XmString string = XmStringCreateLocalized(buffer);
|
||||||
|
XtVaSetValues (
|
||||||
|
text,
|
||||||
|
XmNlabelString, string,
|
||||||
|
NULL);
|
||||||
|
XmStringFree(string);
|
||||||
|
XtManageChild(text);
|
||||||
|
|
||||||
|
resetBatteryPollTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetBatteryPollTimeout (void) {
|
||||||
|
XtAppAddTimeOut(application, 2000, batteryPoll, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void batteryInfoDialog (Widget button, XtPointer clientData, XtPointer callData) {
|
||||||
|
(void)(clientData);
|
||||||
|
(void)(callData);
|
||||||
|
|
||||||
|
BatteryInfo info = getBatteryInfo();
|
||||||
|
|
||||||
|
static const char *states[] = {
|
||||||
|
"Charging",
|
||||||
|
"Full",
|
||||||
|
"Discharging",
|
||||||
|
"Error"
|
||||||
|
};
|
||||||
|
|
||||||
|
#define BUFFER_LEN 48
|
||||||
|
char timeBuffer[BUFFER_LEN] = { 0 };
|
||||||
|
switch (info.state) {
|
||||||
|
case BatteryStateCharging:
|
||||||
|
snprintf (
|
||||||
|
timeBuffer, BUFFER_LEN, "\n%d:%02d:%02d until charged.",
|
||||||
|
info.hours, info.minutes, info.seconds);
|
||||||
|
break;
|
||||||
|
case BatteryStateDischarging:
|
||||||
|
snprintf (
|
||||||
|
timeBuffer, BUFFER_LEN, "\n%d:%02d:%02d until empty.",
|
||||||
|
info.hours, info.minutes, info.seconds);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
#undef BUFFER_LEN
|
||||||
|
#define BUFFER_LEN 128
|
||||||
|
char messageBuffer[BUFFER_LEN];
|
||||||
|
snprintf (
|
||||||
|
messageBuffer, BUFFER_LEN, "%d%%, %s%s",
|
||||||
|
info.level, states[info.state], timeBuffer);
|
||||||
|
#undef BUFFER_LEN
|
||||||
|
|
||||||
|
Arg args[5] = { 0 };
|
||||||
|
int n = 0;
|
||||||
|
XmString message = XmStringCreateLocalized(messageBuffer);
|
||||||
|
XtSetArg(args[n], XmNmessageString, message); n ++;
|
||||||
|
XmString title = XmStringCreateLocalized("Battery Status");
|
||||||
|
XtSetArg(args[n], XmNdialogTitle, title); n ++;
|
||||||
|
|
||||||
|
Widget dialog = XmCreateInformationDialog(button, "batteryInfo", args, n);
|
||||||
|
|
||||||
|
XmStringFree(message);
|
||||||
|
XmStringFree(title);
|
||||||
|
|
||||||
|
XtManageChild(dialog);
|
||||||
|
XtPopup(XtParent(dialog), XtGrabNone);
|
||||||
|
}
|
2
xmbrightness/build.sh
Executable file
2
xmbrightness/build.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
../scripts/buildapp.sh xmbrightness "$@"
|
86
xmbrightness/src/main.c
Normal file
86
xmbrightness/src/main.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/* C99 */
|
||||||
|
|
||||||
|
#define _XOPEN_SOURCE
|
||||||
|
#include <Xm/Scale.h>
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
#include <Xm/MwmUtil.h>
|
||||||
|
#include <X11/Shell.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void valueChanged (Widget, XtPointer, XtPointer);
|
||||||
|
void setBrightness (int);
|
||||||
|
int getBrightness ();
|
||||||
|
int getMaxBrightness ();
|
||||||
|
|
||||||
|
int main (int argc, char *argv[]) {
|
||||||
|
XtAppContext application;
|
||||||
|
Widget window = XtVaAppInitialize (
|
||||||
|
&application, "Brightness",
|
||||||
|
NULL, 0,
|
||||||
|
&argc, argv,
|
||||||
|
NULL,
|
||||||
|
XmNtitle, "Battery",
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
int level = getBrightness();
|
||||||
|
int max = getMaxBrightness();
|
||||||
|
int percent =
|
||||||
|
(float)(level) /
|
||||||
|
(float)(max) * 100;
|
||||||
|
|
||||||
|
Widget scale = XtVaCreateManagedWidget (
|
||||||
|
"Brightness", xmScaleWidgetClass, window,
|
||||||
|
XmNmaximum, 100,
|
||||||
|
XmNminimum, 1,
|
||||||
|
XmNvalue, percent,
|
||||||
|
NULL);
|
||||||
|
XtAddCallback(scale, XmNvalueChangedCallback, valueChanged, NULL);
|
||||||
|
|
||||||
|
XtVaSetValues(window, XmNmwmDecorations, MWM_DECOR_BORDER, NULL);
|
||||||
|
XtVaSetValues(window, XmNmwmFunctions, MWM_FUNC_RESIZE, NULL);
|
||||||
|
|
||||||
|
//XtVaSetValues(window, XtNheight, 400, NULL);
|
||||||
|
//XtVaSetValues(window, XtNwidth, 400, NULL);
|
||||||
|
|
||||||
|
XtRealizeWidget(window);
|
||||||
|
XtAppMainLoop(application);
|
||||||
|
}
|
||||||
|
|
||||||
|
void valueChanged (Widget scale, XtPointer clientData, XtPointer callData) {
|
||||||
|
(void)(scale);
|
||||||
|
(void)(clientData);
|
||||||
|
XmScaleCallbackStruct *event = (XmScaleCallbackStruct *)(callData);
|
||||||
|
setBrightness(event->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBrightness (int level) {
|
||||||
|
char command[32] = { 0 };
|
||||||
|
snprintf(command, 32, "brightnessctl s %d%% -q", level);
|
||||||
|
system(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getBrightness () {
|
||||||
|
FILE *stream = popen("brightnessctl g", "r");
|
||||||
|
if (stream == NULL) {
|
||||||
|
fprintf(stderr, "ERR could not get brightness\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int result = 1;
|
||||||
|
fscanf(stream, "%d", &result);
|
||||||
|
pclose(stream);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getMaxBrightness () {
|
||||||
|
FILE *stream = popen("brightnessctl m", "r");
|
||||||
|
if (stream == NULL) {
|
||||||
|
fprintf(stderr, "ERR could not get brightness\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int result = 1;
|
||||||
|
fscanf(stream, "%d", &result);
|
||||||
|
pclose(stream);
|
||||||
|
return result;
|
||||||
|
}
|
2
xmpanel/build.sh
Executable file
2
xmpanel/build.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
../scripts/buildapp.sh xmpanel "$@"
|
27
xmpanel/src/icons/appCalculator.xbm
Normal file
27
xmpanel/src/icons/appCalculator.xbm
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#define appCalculator_width 48
|
||||||
|
#define appCalculator_height 48
|
||||||
|
static unsigned char appCalculator_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00,
|
||||||
|
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xdf, 0x00,
|
||||||
|
0x00, 0x13, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x5b, 0x62, 0x00, 0xd8, 0x00,
|
||||||
|
0x00, 0x53, 0x4a, 0x00, 0xc8, 0x00, 0x00, 0xdb, 0x48, 0x05, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x00, 0x00, 0xc8, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xdf, 0x00,
|
||||||
|
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xdf, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xdf, 0x00,
|
||||||
|
0x00, 0xf3, 0xff, 0xcf, 0xcf, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0xf3, 0xff, 0xcf, 0xcf, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xdf, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xdf, 0x00,
|
||||||
|
0x00, 0xf3, 0xff, 0xcf, 0xcf, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0x13, 0x42, 0x48, 0xc8, 0x00, 0x00, 0x1b, 0x42, 0x78, 0xd8, 0x00,
|
||||||
|
0x00, 0xf3, 0xff, 0xcf, 0xcf, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xdf, 0x00,
|
||||||
|
0x00, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00,
|
||||||
|
0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
27
xmpanel/src/icons/appEditor.xbm
Normal file
27
xmpanel/src/icons/appEditor.xbm
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#define appEditor_width 48
|
||||||
|
#define appEditor_height 48
|
||||||
|
static unsigned char appEditor_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x80, 0xff, 0xff, 0xff, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0x05, 0x01, 0x80, 0x01, 0x00, 0x00, 0x09, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0x11, 0x01, 0x80, 0xf1, 0x6f, 0x00, 0x21, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0x7f, 0x01, 0x80, 0x71, 0x02, 0x00, 0xfe, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x91, 0x3f, 0x0f, 0xc0, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0xf1, 0xdc, 0x7b, 0xc0, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0xf1, 0x8f, 0xff, 0xc7, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x71, 0x07, 0x00, 0xc0, 0x01, 0x80, 0x81, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x81, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x81, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x81, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x81, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x81, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x81, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x81, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x81, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x81, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x81, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x71, 0x07, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x01,
|
||||||
|
0x80, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x80, 0xff, 0xff, 0xff, 0xff, 0x01,
|
||||||
|
0x80, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
27
xmpanel/src/icons/appFiles.xbm
Normal file
27
xmpanel/src/icons/appFiles.xbm
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#define appFiles_width 48
|
||||||
|
#define appFiles_height 48
|
||||||
|
static unsigned char appFiles_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00,
|
||||||
|
0x00, 0x06, 0x00, 0x00, 0x60, 0x00, 0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00,
|
||||||
|
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x56, 0x00, 0x00, 0x6a, 0x00,
|
||||||
|
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||||
|
0x00, 0x56, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||||
|
0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x00,
|
||||||
|
0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x36, 0x00, 0x00, 0x6c, 0x00,
|
||||||
|
0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x36, 0x00, 0x00, 0x6c, 0x00,
|
||||||
|
0x00, 0xf6, 0xff, 0xff, 0x6f, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||||
|
0x00, 0x56, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0x08, 0x10, 0x68, 0x00, 0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x16, 0x08, 0x10, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0xf8, 0x1f, 0x68, 0x00, 0x00, 0x16, 0x00, 0x00, 0x68, 0x00,
|
||||||
|
0x00, 0x16, 0x00, 0x00, 0x68, 0x00, 0x00, 0x56, 0x00, 0x00, 0x6a, 0x00,
|
||||||
|
0x00, 0x1e, 0x00, 0x00, 0x78, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
27
xmpanel/src/icons/appMail.xbm
Normal file
27
xmpanel/src/icons/appMail.xbm
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#define appMail_width 48
|
||||||
|
#define appMail_height 48
|
||||||
|
static unsigned char appMail_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f,
|
||||||
|
0x1c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x2c, 0x00, 0x00, 0x50, 0x55, 0x34,
|
||||||
|
0x4c, 0x00, 0x00, 0xa8, 0x00, 0x32, 0x8c, 0x00, 0x00, 0x00, 0x44, 0x31,
|
||||||
|
0x0c, 0x01, 0x00, 0x50, 0x81, 0x30, 0x0c, 0x02, 0x00, 0xa8, 0x54, 0x30,
|
||||||
|
0x0c, 0x04, 0x00, 0x00, 0x20, 0x30, 0x0c, 0x08, 0x00, 0x00, 0x10, 0x30,
|
||||||
|
0x0c, 0x10, 0x00, 0x00, 0x08, 0x30, 0x0c, 0x20, 0x00, 0x00, 0x04, 0x30,
|
||||||
|
0x0c, 0x40, 0x00, 0x00, 0x02, 0x30, 0x0c, 0x80, 0x00, 0x00, 0x01, 0x30,
|
||||||
|
0x0c, 0x00, 0x01, 0x80, 0x00, 0x30, 0x0c, 0x00, 0x02, 0x40, 0x00, 0x30,
|
||||||
|
0x0c, 0x00, 0x06, 0x60, 0x00, 0x30, 0x0c, 0x00, 0x09, 0x90, 0x00, 0x30,
|
||||||
|
0x0c, 0x80, 0x10, 0x08, 0x01, 0x30, 0x0c, 0x40, 0x20, 0x04, 0x02, 0x30,
|
||||||
|
0x0c, 0x20, 0x40, 0x02, 0x04, 0x30, 0x0c, 0x10, 0x80, 0x01, 0x08, 0x30,
|
||||||
|
0x0c, 0x08, 0x00, 0x00, 0x10, 0x30, 0x0c, 0x04, 0x00, 0x00, 0x20, 0x30,
|
||||||
|
0x0c, 0x02, 0x00, 0x00, 0x40, 0x30, 0x0c, 0x01, 0x00, 0x00, 0x80, 0x30,
|
||||||
|
0x8c, 0x00, 0x00, 0x00, 0x00, 0x31, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x32,
|
||||||
|
0x2c, 0x00, 0x00, 0x00, 0x00, 0x34, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x38,
|
||||||
|
0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x3f,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
27
xmpanel/src/icons/appTerminal.xbm
Normal file
27
xmpanel/src/icons/appTerminal.xbm
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#define appTerminal_width 48
|
||||||
|
#define appTerminal_height 48
|
||||||
|
static unsigned char appTerminal_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xc0, 0xff, 0xff, 0xff, 0xff, 0x01, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x03,
|
||||||
|
0x60, 0x00, 0x00, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0x0e, 0xfd, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0x0e, 0x80, 0xf2, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0x0e, 0xfd, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0x0e, 0xf0, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03, 0x60, 0xfe, 0xff, 0xff, 0x3f, 0x03,
|
||||||
|
0x60, 0x00, 0x00, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||||
|
0x60, 0x00, 0x00, 0x00, 0x33, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||||
|
0xe0, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x01,
|
||||||
|
0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00,
|
||||||
|
0xc0, 0xff, 0xff, 0xff, 0xff, 0x01, 0x60, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||||
|
0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x00, 0x00, 0x00, 0x0c,
|
||||||
|
0x0c, 0xc0, 0xff, 0xff, 0x03, 0x18, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f,
|
||||||
|
0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f,
|
||||||
|
0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
27
xmpanel/src/icons/appWebBrowser.xbm
Normal file
27
xmpanel/src/icons/appWebBrowser.xbm
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#define appWebBrowser_width 48
|
||||||
|
#define appWebBrowser_height 48
|
||||||
|
static unsigned char appWebBrowser_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
|
||||||
|
0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0xf0, 0x18, 0x1c, 0x0f, 0x00,
|
||||||
|
0x00, 0xfc, 0xff, 0xfc, 0x3f, 0x00, 0x00, 0x0e, 0x80, 0x07, 0x70, 0x00,
|
||||||
|
0x00, 0xff, 0xff, 0xff, 0xef, 0x00, 0x80, 0xf3, 0x00, 0x00, 0xc6, 0x01,
|
||||||
|
0xc0, 0x01, 0xff, 0xff, 0x81, 0x03, 0xc0, 0x00, 0x38, 0x10, 0x00, 0x03,
|
||||||
|
0x60, 0x00, 0xfc, 0x3f, 0x00, 0x06, 0x70, 0x00, 0x04, 0xc0, 0x00, 0x0e,
|
||||||
|
0x30, 0x00, 0xf8, 0xff, 0x03, 0x0c, 0x30, 0x00, 0x10, 0x00, 0x0e, 0x0c,
|
||||||
|
0x18, 0x00, 0xf0, 0xff, 0x0f, 0x18, 0x18, 0x00, 0x20, 0x00, 0x0e, 0x18,
|
||||||
|
0x18, 0x00, 0xff, 0xff, 0x01, 0x18, 0x0c, 0xff, 0x01, 0x00, 0x01, 0x30,
|
||||||
|
0x0c, 0xff, 0xff, 0xff, 0x07, 0x30, 0x0c, 0x01, 0x00, 0x00, 0x02, 0x30,
|
||||||
|
0x8c, 0xff, 0xff, 0xff, 0xa1, 0x3f, 0x8c, 0x00, 0x00, 0x18, 0xc0, 0x31,
|
||||||
|
0x8c, 0xff, 0xff, 0x0f, 0x00, 0x37, 0x9c, 0x00, 0x00, 0xc8, 0xff, 0x30,
|
||||||
|
0xac, 0xff, 0xff, 0xcf, 0xff, 0x31, 0x2c, 0x04, 0x00, 0xc8, 0x80, 0x23,
|
||||||
|
0x1c, 0xf8, 0xff, 0xcf, 0x80, 0x06, 0x18, 0x10, 0x00, 0xc8, 0x9c, 0x0c,
|
||||||
|
0x18, 0xf0, 0xff, 0xdf, 0x80, 0x18, 0x18, 0x10, 0x00, 0xd0, 0x84, 0x3f,
|
||||||
|
0x30, 0xf0, 0xff, 0xdf, 0x00, 0x3f, 0x30, 0x10, 0x00, 0xd0, 0x1c, 0x30,
|
||||||
|
0x70, 0xf0, 0xff, 0xdf, 0x00, 0x30, 0x60, 0x10, 0x00, 0xd0, 0x7c, 0x33,
|
||||||
|
0xc0, 0xf0, 0xff, 0xdf, 0x00, 0x30, 0xc0, 0x11, 0x00, 0xd0, 0x00, 0x30,
|
||||||
|
0x80, 0xf3, 0xff, 0xdf, 0x00, 0x30, 0x00, 0x37, 0x00, 0xd3, 0x00, 0x30,
|
||||||
|
0x00, 0xee, 0xff, 0xdd, 0x00, 0x30, 0x00, 0x3c, 0xf8, 0xd8, 0x00, 0x30,
|
||||||
|
0x00, 0xf0, 0x0f, 0xc0, 0x00, 0x30, 0x00, 0xe0, 0x07, 0xc0, 0x00, 0x30,
|
||||||
|
0x00, 0x00, 0xff, 0xcf, 0xff, 0x3f, 0x00, 0x00, 0xf8, 0xcf, 0xff, 0x3f,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
75
xmpanel/src/main.c
Normal file
75
xmpanel/src/main.c
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#define _XOPEN_SOURCE
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
#include <Xm/RowColumn.h>
|
||||||
|
#include <Xm/PushB.h>
|
||||||
|
#include <Xmd/Icon.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "icons/appCalculator.xbm"
|
||||||
|
#include "icons/appEditor.xbm"
|
||||||
|
#include "icons/appFiles.xbm"
|
||||||
|
#include "icons/appMail.xbm"
|
||||||
|
#include "icons/appTerminal.xbm"
|
||||||
|
#include "icons/appWebBrowser.xbm"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Pixmap icon;
|
||||||
|
const char * command;
|
||||||
|
} Launcher;
|
||||||
|
|
||||||
|
void createAllLaunchers (Widget);
|
||||||
|
Widget createLauncher (Widget, Launcher);
|
||||||
|
void activateLauncher (Widget, XtPointer, XtPointer);
|
||||||
|
|
||||||
|
XtAppContext application;
|
||||||
|
|
||||||
|
int main (int argc, char *argv[]) {
|
||||||
|
Widget window = XtVaAppInitialize (
|
||||||
|
&application, "Panel",
|
||||||
|
NULL, 0,
|
||||||
|
&argc, argv,
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
|
Widget layout = XtVaCreateWidget (
|
||||||
|
"layout", xmRowColumnWidgetClass, window,
|
||||||
|
XmNorientation, XmHORIZONTAL,
|
||||||
|
NULL);
|
||||||
|
createAllLaunchers(layout);
|
||||||
|
|
||||||
|
XtManageChild(layout);
|
||||||
|
XtRealizeWidget(window);
|
||||||
|
XtAppMainLoop(application);
|
||||||
|
}
|
||||||
|
|
||||||
|
void createAllLaunchers (Widget parent) {
|
||||||
|
#define add(name, cmd) createLauncher(parent, (Launcher){\
|
||||||
|
.icon = XmdLoadBitmapIcon(parent, app##name),\
|
||||||
|
.command = cmd " &"\
|
||||||
|
} );
|
||||||
|
add(Calculator, "xcalc");
|
||||||
|
add(Editor, "nedit");
|
||||||
|
add(Files, "caja");
|
||||||
|
add(Mail, "nedit");
|
||||||
|
add(Terminal, "xterm");
|
||||||
|
add(WebBrowser, "firefox");
|
||||||
|
#undef add
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget createLauncher (Widget parent, Launcher launcher) {
|
||||||
|
Widget button = XtVaCreateManagedWidget (
|
||||||
|
"launcher", xmPushButtonWidgetClass, parent,
|
||||||
|
XmNleftAttachment, XmATTACH_FORM,
|
||||||
|
XmNlabelType, XmPIXMAP,
|
||||||
|
XmNlabelPixmap, launcher.icon,
|
||||||
|
NULL);
|
||||||
|
XtAddCallback(button, XmNactivateCallback, activateLauncher, (XtPointer)(launcher.command));
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
|
void activateLauncher (Widget button, XtPointer clientData, XtPointer callData) {
|
||||||
|
(void)(button);
|
||||||
|
(void)(callData);
|
||||||
|
system((char *)(clientData));
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user