Compare commits
10 Commits
fad592ed09
...
fa58550954
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa58550954 | ||
|
|
7d08356273 | ||
|
|
97a473c427 | ||
|
|
585390485c | ||
|
|
84c5c89a70 | ||
|
|
4af77093b8 | ||
|
|
ff4cdc0c25 | ||
|
|
310dff2387 | ||
|
|
b7cd218fe8 | ||
|
|
3fd7145d69 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
fibboBG
|
fiboBG
|
||||||
*.o
|
*.o
|
||||||
|
|||||||
7
Makefile
7
Makefile
@ -1,11 +1,12 @@
|
|||||||
TARGET=fiboBG
|
TARGET=fiboBG
|
||||||
DEST=$(HOME)/.local/bin
|
DEST=$(HOME)/.local/bin/ #local install
|
||||||
|
#DES=/usr/local #global install
|
||||||
SRC=main.c
|
SRC=main.c
|
||||||
# DEBUG=-g
|
# DEBUG=-g
|
||||||
DEBUG=
|
DEBUG=
|
||||||
$(TARGET): main.c config.h
|
$(TARGET): main.c config.h
|
||||||
gcc -Wall -Wextra $(DEBUG) $(SRC) `pkg-config --cflags --libs cairo x11` -o $(TARGET) -lm
|
gcc -Wall -Wextra -pedantic $(DEBUG) $(SRC) `pkg-config --cflags --libs cairo x11` -o $(TARGET) -lm
|
||||||
install:
|
install:
|
||||||
cp $(TARGET) $(DEST)/
|
cp $(TARGET) $(DEST)
|
||||||
uninstall:
|
uninstall:
|
||||||
rm $(DEST)/$(TARGET)
|
rm $(DEST)/$(TARGET)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# FiboBG
|
# 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.
|
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.**
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -10,6 +10,7 @@ cd fiboBG
|
|||||||
make
|
make
|
||||||
make install
|
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
|
## 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.
|
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.
|
||||||
|
|||||||
23
config.h
23
config.h
@ -1,12 +1,21 @@
|
|||||||
#define REFRESH_TIME 30
|
#define REFRESH_TIME 30 // Refresh rate in seconds
|
||||||
#define STARTPOS_Y 12
|
|
||||||
#define STARTPOS_X 0
|
#define STARTPOS_Y 12 // y coordinate of the top-left
|
||||||
#define LEFT_OFFSET 0
|
// 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 TOP_OFFSET 12
|
#define TOP_OFFSET 12
|
||||||
#define RIGHT_OFFSET 0
|
#define RIGHT_OFFSET 0
|
||||||
#define BOTTOM_OFFSET 0
|
#define BOTTOM_OFFSET 0
|
||||||
#define BOX_HEIGHT_RATE 0.9
|
|
||||||
#define GAP_SIZE 3
|
|
||||||
|
|
||||||
// +--------+---+-------------------
|
// +--------+---+-------------------
|
||||||
// + + + +
|
// + + + +
|
||||||
@ -27,7 +36,7 @@ typedef struct _color {
|
|||||||
float blue;
|
float blue;
|
||||||
} color;
|
} color;
|
||||||
|
|
||||||
|
// TIME COLORS
|
||||||
color colors[4]={
|
color colors[4]={
|
||||||
//base
|
//base
|
||||||
{
|
{
|
||||||
|
|||||||
30
main.c
30
main.c
@ -93,36 +93,13 @@ void drawRectangle(cairo_t* cr, rectangle R){
|
|||||||
cairo_fill(cr); /* fill rectangle */
|
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){
|
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 bh = ((int) ((height - TOP_OFFSET) * BOX_HEIGHT_RATE) / 5) * 5;
|
||||||
int unit = bh / 5;
|
int unit = bh / 5;
|
||||||
|
|
||||||
@ -174,7 +151,6 @@ void drawFibbTime(cairo_t* cr, int width, int height){
|
|||||||
drawRectangle(cr, Rs[3]);
|
drawRectangle(cr, Rs[3]);
|
||||||
drawRectangle(cr, Rs[4]);
|
drawRectangle(cr, Rs[4]);
|
||||||
drawRectangle(cr, Rs[0]);
|
drawRectangle(cr, Rs[0]);
|
||||||
/* drawReminder(cr, (t.minute % 5)); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user