Compare commits

..

No commits in common. "fa58550954fcef3d7e7c7a3aad4ee7b93f93f24e" and "fad592ed094a02348d441a92175c3288d56e6997" have entirely different histories.

5 changed files with 39 additions and 26 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
fiboBG
fibboBG
*.o

View File

@ -1,12 +1,11 @@
TARGET=fiboBG
DEST=$(HOME)/.local/bin/ #local install
#DES=/usr/local #global install
DEST=$(HOME)/.local/bin
SRC=main.c
# DEBUG=-g
DEBUG=
$(TARGET): main.c config.h
gcc -Wall -Wextra -pedantic $(DEBUG) $(SRC) `pkg-config --cflags --libs cairo x11` -o $(TARGET) -lm
gcc -Wall -Wextra $(DEBUG) $(SRC) `pkg-config --cflags --libs cairo x11` -o $(TARGET) -lm
install:
cp $(TARGET) $(DEST)
cp $(TARGET) $(DEST)/
uninstall:
rm $(DEST)/$(TARGET)

View File

@ -1,6 +1,6 @@
# FiboBG
FiboBG is a very simple program which displays the [Fibonacci clock](https://www.theguardian.com/science/alexs-adventures-in-numberland/2015/may/09/fibonacci-clock-can-you-tell-the-time-on-the-worlds-most-stylish-nerd-timepiece). It creates a dynamic background for simple window manager like i3 or dwm. FiboBG was only tested on dwm. The program works well with compositors like compton. **Multiple monitors are not yet supported.**
FiboBG is a very simple program which displays the [Fibonacci clock](https://www.theguardian.com/science/alexs-adventures-in-numberland/2015/may/09/fibonacci-clock-can-you-tell-the-time-on-the-worlds-most-stylish-nerd-timepiece). It creates a dynamic background for simple window manager like i3 or dwm. FiboBG was only tested on dwm. The program works well with compositors like compton.
## Installation
@ -10,7 +10,6 @@ cd fiboBG
make
make install
```
The installation assumes you want to install fiboBG locally to $HOME/.local . If you want to install it globally ( genarally not a good idea ), you can do this by modifying the Makefile.
## Usage
In xinitrc, run the compiled program in background before window manager! If you have a compositor (only compton tested) you can make a dynamical background more usable with setting your terminal alpha parameter.

View File

@ -1,21 +1,12 @@
#define REFRESH_TIME 30 // Refresh rate in seconds
#define STARTPOS_Y 12 // y coordinate of the top-left
// corner of the background window
#define STARTPOS_X 0 // x coordinate of the top-left
// corner of the background window
#define BOX_HEIGHT_RATE 0.9 // The box height and screen height ratio
#define GAP_SIZE 3 // The gap size between the boxes
/* The clock well be centered inside of the defined box.
The block bellow is for some slite modification.
*/
#define LEFT_OFFSET 0
#define REFRESH_TIME 30
#define STARTPOS_Y 12
#define STARTPOS_X 0
#define LEFT_OFFSET 0
#define TOP_OFFSET 12
#define RIGHT_OFFSET 0
#define BOTTOM_OFFSET 0
#define BOX_HEIGHT_RATE 0.9
#define GAP_SIZE 3
// +--------+---+-------------------
// + + + +
@ -36,7 +27,7 @@ typedef struct _color {
float blue;
} color;
// TIME COLORS
color colors[4]={
//base
{

30
main.c
View File

@ -93,13 +93,36 @@ void drawRectangle(cairo_t* cr, rectangle R){
cairo_fill(cr); /* fill rectangle */
}
void drawReminder(cairo_t* cr, int minRem){
float x_pos[4]={10, 810, 810, 10};
float y_pos[4]={10, 10, 510, 510};
int previous;
if(minRem == 0){
previous = 4;
} else {
previous = minRem - 1;
}
for(int i = 0; i < 4; ++i){
cairo_arc(cr, x_pos[i], y_pos[i],10, 0, 2 * M_PI);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5); /* set fill color */
cairo_fill(cr);
}
cairo_arc(cr, x_pos[previous], y_pos[previous], 10, 0, 2 * M_PI);
cairo_set_source_rgb(cr, 0.5, 0.5, 0.5); /* set fill color */
cairo_fill(cr);
if(minRem != 0){
cairo_arc(cr, x_pos[minRem - 1], y_pos[minRem - 1], 7, 0, 2 * M_PI);
cairo_set_source_rgb(cr, 0, 0, 0); /* set fill color */
cairo_fill(cr);
}
}
void drawFibbTime(cairo_t* cr, int width, int height){
cairo_set_source_rgb(cr, 0, 0, 0); // setting black background color
cairo_paint(cr); // Paint the surface with the source color
int bh = ((int) ((height - TOP_OFFSET) * BOX_HEIGHT_RATE) / 5) * 5;
int unit = bh / 5;
@ -151,6 +174,7 @@ void drawFibbTime(cairo_t* cr, int width, int height){
drawRectangle(cr, Rs[3]);
drawRectangle(cr, Rs[4]);
drawRectangle(cr, Rs[0]);
/* drawReminder(cr, (t.minute % 5)); */
}
int main(int argc, char** argv) {