aboutsummaryrefslogtreecommitdiff
path: root/comet.c
diff options
context:
space:
mode:
Diffstat (limited to 'comet.c')
-rw-r--r--comet.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/comet.c b/comet.c
index 5cc7734..85bdb27 100644
--- a/comet.c
+++ b/comet.c
@@ -1,3 +1,4 @@
+#include <math.h>
#include <glib.h>
#include <glib-unix.h>
@@ -5,6 +6,8 @@
#include "log.h"
#include "draw.h"
+#define EVEN(n) ((int)(n) - ((int)(n) % 2 != 0))
+
static gboolean mainloop_quit(gpointer data)
{
g_main_loop_quit(data);
@@ -25,6 +28,17 @@ int main(int argc, char **argv)
Window *win = window_create();
+ int screen_width, screen_height;
+ window_get_screen_size(win, &screen_width, &screen_height);
+
+ int height = EVEN(round(screen_height * 0.021));
+ int x_padding = EVEN(round(screen_width * 0.005));
+ int y_padding = EVEN(round(screen_height * 0.004));
+
+ log_debug("Calculated dimensions [height=%d, x_pad=%d, y_pad=%d]", height, x_padding, y_padding);
+
+ draw_init("Hack 12", height, x_padding, y_padding);
+
guint source_term = g_unix_signal_add(SIGTERM, mainloop_quit, mainloop);
guint source_int = g_unix_signal_add(SIGINT, mainloop_quit, mainloop);