aboutsummaryrefslogtreecommitdiff
path: root/sway/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/sway/config.c b/sway/config.c
index f4d78e19..60b62bbc 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -25,6 +25,8 @@
#include "sway/commands.h"
#include "sway/config.h"
#include "sway/tree/layout.h"
+#include "cairo.h"
+#include "pango.h"
#include "readline.h"
#include "stringop.h"
#include "list.h"
@@ -130,6 +132,17 @@ static void destroy_removed_seats(struct sway_config *old_config,
}
}
+int get_font_text_height(char *font) {
+ cairo_t *cairo = cairo_create(NULL);
+ int text_height;
+ get_text_size(cairo, font, NULL, &text_height, 1, false,
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "!@#$%^&*([{|");
+ cairo_destroy(cairo);
+ return text_height;
+}
+
static void set_color(float dest[static 4], uint32_t color) {
dest[0] = ((color >> 16) & 0xff) / 255.0;
dest[1] = ((color >> 8) & 0xff) / 255.0;
@@ -169,7 +182,7 @@ static void config_defaults(struct sway_config *config) {
config->default_layout = L_NONE;
config->default_orientation = L_NONE;
if (!(config->font = strdup("monospace 10"))) goto cleanup;
- //config->font_height = get_font_text_height(config->font);
+ config->font_height = get_font_text_height(config->font);
// floating view
config->floating_maximum_width = 0;
@@ -208,31 +221,31 @@ static void config_defaults(struct sway_config *config) {
set_color(config->border_colors.focused.border, 0x4C7899);
set_color(config->border_colors.focused.border, 0x4C7899);
set_color(config->border_colors.focused.background, 0x285577);
- set_color(config->border_colors.focused.text, 0xFFFFFF);
+ config->border_colors.focused.text = 0xFFFFFFFF;
set_color(config->border_colors.focused.indicator, 0x2E9EF4);
set_color(config->border_colors.focused.child_border, 0x285577);
set_color(config->border_colors.focused_inactive.border, 0x333333);
set_color(config->border_colors.focused_inactive.background, 0x5F676A);
- set_color(config->border_colors.focused_inactive.text, 0xFFFFFF);
+ config->border_colors.focused_inactive.text = 0xFFFFFFFF;
set_color(config->border_colors.focused_inactive.indicator, 0x484E50);
set_color(config->border_colors.focused_inactive.child_border, 0x5F676A);
set_color(config->border_colors.unfocused.border, 0x333333);
set_color(config->border_colors.unfocused.background, 0x222222);
- set_color(config->border_colors.unfocused.text, 0x888888);
+ config->border_colors.unfocused.text = 0x888888FF;
set_color(config->border_colors.unfocused.indicator, 0x292D2E);
set_color(config->border_colors.unfocused.child_border, 0x222222);
set_color(config->border_colors.urgent.border, 0x2F343A);
set_color(config->border_colors.urgent.background, 0x900000);
- set_color(config->border_colors.urgent.text, 0xFFFFFF);
+ config->border_colors.urgent.text = 0xFFFFFFFF;
set_color(config->border_colors.urgent.indicator, 0x900000);
set_color(config->border_colors.urgent.child_border, 0x900000);
set_color(config->border_colors.placeholder.border, 0x000000);
set_color(config->border_colors.placeholder.background, 0x0C0C0C);
- set_color(config->border_colors.placeholder.text, 0xFFFFFF);
+ config->border_colors.placeholder.text = 0xFFFFFFFF;
set_color(config->border_colors.placeholder.indicator, 0x000000);
set_color(config->border_colors.placeholder.child_border, 0x0C0C0C);