2023-03-09 03:58:04 +01:00
spacetray
=========
2018-03-20 22:44:20 +01:00
2026-07-16 00:44:52 +02:00
A panel Applet using Qt5 for showing the Status of a Hackerspace. Compatible with the SpaceAPI version >= 0.13.
2018-03-20 22:44:20 +01:00
2026-07-17 23:05:12 +02:00
Red = Door/Lock open:
2026-07-17 14:03:06 +02:00
2026-07-17 18:33:27 +02:00

2026-07-17 14:03:06 +02:00
2026-07-17 23:05:12 +02:00
Green = Door/Lock closed:
2026-07-17 18:33:27 +02:00

2018-03-20 23:12:46 +01:00
2026-07-17 14:10:23 +02:00
Additionally, a notification is displayed as soon as the status changes.
2018-03-20 22:44:20 +01:00
Installation:
-------------
Requirements:
2026-07-16 01:50:15 +02:00
- Standard tools like g++, cmake, etc.
2026-07-16 00:44:52 +02:00
- Qt5 (Widgets and Network modules)
2018-03-20 22:44:20 +01:00
Use the following command for getting the sources:
2023-02-12 09:29:27 +01:00
git clone https://github.com/hanez/spacetray.git
2018-03-20 22:44:20 +01:00
Change into the new directory:
2023-02-12 09:29:27 +01:00
cd spacetray
2018-03-20 22:44:20 +01:00
2026-08-09 03:32:52 +02:00
To configure and compile the sources, run:
2018-03-20 22:44:20 +01:00
2026-08-09 03:32:52 +02:00
cmake -S . -B build
cmake --build build
2018-03-20 22:44:20 +01:00
2026-07-16 00:44:52 +02:00
This will compile spacetray with status icon and notification support.
2018-03-20 22:44:20 +01:00
2026-08-09 03:32:52 +02:00
Just copy "build/spacetray" to a folder in your $PATH. I do:
2018-03-20 22:44:20 +01:00
2026-08-09 03:32:52 +02:00
cp ./build/spacetray ~/bin/
2018-03-20 22:44:20 +01:00
2018-03-20 23:19:19 +01:00
You can copy the file to /usr/bin to make it available to all users but I don't. If you want that just run:
2018-03-20 22:44:20 +01:00
2026-08-09 03:32:52 +02:00
sudo cp ./build/spacetray /usr/bin/
2018-03-20 22:44:20 +01:00
Configuration:
--------------
2026-07-16 00:44:52 +02:00
Configuration is done via command line arguments.
2018-03-20 22:44:20 +01:00
Usage:
------
2023-02-12 09:29:27 +01:00
Run spacetray with:
2018-03-20 22:44:20 +01:00
2026-08-09 03:32:52 +02:00
./build/spacetray <statusurl> &
2018-03-20 23:07:35 +01:00
Or if in your $PATH:
2026-07-16 00:44:52 +02:00
spacetray <statusurl>
2018-03-20 22:44:20 +01:00
2026-08-09 03:32:52 +02:00
The polling interval defaults to 300 seconds (5 minutes). It can be changed with the `-i` or `--interval` option, given either before or after the status URL:
./build/spacetray <statusurl> -i 60 &
./build/spacetray -i 60 <statusurl>
The interval is specified in seconds and must be a positive number.
2023-03-09 03:58:04 +01:00
Themes:
-------
2026-07-16 00:44:52 +02:00
You can create your own icon theme by generating a C++ header file containing the icons as raw RGBA8888 pixel data in a `static const quint8` array.
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
The format should look like this:
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
static const quint8 icon_open_data[] = {
0xRR, 0xGG, 0xBB, 0xAA, ...
};
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
static const quint8 icon_closed_data[] = {
0xRR, 0xGG, 0xBB, 0xAA, ...
};
2023-03-09 03:58:04 +01:00
2026-07-16 01:50:15 +02:00
The image size used in the default theme is 52x48 pixels with four channels (RGBA).
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
To create these arrays from a PNG image, you can use `ImageMagick` to convert the image to raw RGBA data and then format it into a C++ header.
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
Example using `magick` (ImageMagick 7):
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
magick icon_open.png -size 52x48 -depth 8 RGBA:icon_open.raw
hexdump -v -e '12/1 "0x%02x, " "\n"' icon_open.raw
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
Or using a simple one-liner to generate the header content:
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
echo "static const quint8 icon_open_data[] = {" > themes/my_theme.h
magick icon_open.png -size 52x48 -depth 8 RGBA:- | hexdump -v -e '12/1 "0x%02x, " "\n"' >> themes/my_theme.h
echo "};" >> themes/my_theme.h
2023-03-09 03:58:04 +01:00
2026-07-16 00:44:52 +02:00
Repeat the process for `icon_closed_data` and append it to the same header file.
You can then use your custom icon theme by changing the line:
2023-03-09 03:58:04 +01:00
2023-03-09 03:59:40 +01:00
#include "themes/lock.h"
2023-03-09 03:58:04 +01:00
to:
2023-03-09 03:59:40 +01:00
#include "themes/THEME_NAME.h"
2023-03-09 03:58:04 +01:00
2023-03-09 04:00:37 +01:00
in:
2026-07-16 00:44:52 +02:00
./spacetray.cpp