diff options
-rw-r--r-- | meson.build | 3 | ||||
-rw-r--r-- | src/entry.c | 88 | ||||
-rw-r--r-- | src/entry.h | 11 | ||||
-rw-r--r-- | src/entry_backend/harfbuzz.c | 23 | ||||
-rw-r--r-- | src/entry_backend/pango.c | 4 | ||||
-rw-r--r-- | src/history.c | 6 | ||||
-rw-r--r-- | src/main.c | 192 | ||||
-rw-r--r-- | src/string_vec.c | 3 | ||||
-rw-r--r-- | src/surface.c | 3 | ||||
-rw-r--r-- | src/tofi.h | 17 |
10 files changed, 225 insertions, 125 deletions
diff --git a/meson.build b/meson.build index 85d6176..b4b203a 100644 --- a/meson.build +++ b/meson.build @@ -43,7 +43,8 @@ add_project_arguments( #'-Wconversion', '-Wshadow', '-Wno-unused-parameter', - '-D_POSIX_C_SOURCE=200809L', + '-D_XOPEN_SOURCE=700', + '-D_FORTIFY_SOURCE=2', ], language: 'c' ) diff --git a/src/entry.c b/src/entry.c index 252e3e1..b476e36 100644 --- a/src/entry.c +++ b/src/entry.c @@ -1,9 +1,29 @@ #include <cairo/cairo.h> +#include <math.h> #include <wchar.h> #include "entry.h" #include "log.h" #include "nelem.h" +static void rounded_rectangle(cairo_t *cr, uint32_t width, uint32_t height, uint32_t r) +{ + cairo_new_path(cr); + + /* Top-left */ + cairo_arc(cr, r, r, r, -M_PI, -M_PI_2); + + /* Top-right */ + cairo_arc(cr, width - r, r, r, -M_PI_2, 0); + + /* Bottom-right */ + cairo_arc(cr, width - r, height - r, r, 0, M_PI_2); + + /* Bottom-left */ + cairo_arc(cr, r, height - r, r, M_PI_2, M_PI); + + cairo_close_path(cr); +} + void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, uint32_t height, uint32_t scale) { entry->image.width = width; @@ -49,60 +69,53 @@ void entry_init(struct entry *entry, uint8_t *restrict buffer, uint32_t width, u width /= scale; height /= scale; - /* Draw the outer outline */ - struct color color = entry->border.outline_color; + + /* Draw the background */ + struct color color = entry->background_color; cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); - cairo_set_line_width(cr, 2 * entry->border.outline_width); - cairo_rectangle(cr, 0, 0, width, height); - cairo_stroke(cr); + cairo_save(cr); + cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); + cairo_paint(cr); + cairo_restore(cr); + /* Draw the border with outlines */ + cairo_set_line_width(cr, 4 * entry->border.outline_width + 2 * entry->border.width); + rounded_rectangle(cr, width, height, entry->corner_radius); - /* Move and clip following draws to be within this outline */ - cairo_translate( - cr, - entry->border.outline_width, - entry->border.outline_width); - width -= 2 * entry->border.outline_width; - height -= 2 * entry->border.outline_width; - cairo_rectangle(cr, 0, 0, width, height); - cairo_clip(cr); + color = entry->border.outline_color; + cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); + cairo_stroke_preserve(cr); - /* Draw the border */ color = entry->border.color; cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); - cairo_set_line_width(cr, 2 * entry->border.width); - cairo_rectangle(cr, 0, 0, width, height); - cairo_stroke(cr); + cairo_set_line_width(cr, 2 * entry->border.outline_width + 2 * entry->border.width); + cairo_stroke_preserve(cr); - /* Move and clip following draws to be within the border */ - cairo_translate(cr, entry->border.width, entry->border.width); - width -= 2 * entry->border.width; - height -= 2 * entry->border.width; - cairo_rectangle(cr, 0, 0, width, height); - cairo_clip(cr); - - /* Draw the inner outline */ color = entry->border.outline_color; cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); cairo_set_line_width(cr, 2 * entry->border.outline_width); + cairo_stroke_preserve(cr); + + /* Clear the overdrawn bits outside of the rounded corners */ cairo_rectangle(cr, 0, 0, width, height); - cairo_stroke(cr); + cairo_set_source_rgba(cr, 0, 0, 0, 0.5); + cairo_save(cr); + cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); + cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); + cairo_fill(cr); + cairo_restore(cr); + /* Move and clip following draws to be within this outline */ cairo_translate( cr, - entry->border.outline_width, - entry->border.outline_width); - width -= 2 * entry->border.outline_width; - height -= 2 * entry->border.outline_width; + 2 * entry->border.outline_width + entry->border.width, + 2 * entry->border.outline_width + entry->border.width); + width -= 4 * entry->border.outline_width + 2 * entry->border.width; + height -= 4 * entry->border.outline_width + 2 * entry->border.width; cairo_rectangle(cr, 0, 0, width, height); cairo_clip(cr); - /* Draw the entry background */ - color = entry->background_color; - cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); - cairo_paint(cr); - /* Move and clip following draws to be within the specified padding */ cairo_translate(cr, entry->padding, entry->padding); width -= 2 * entry->padding; @@ -152,7 +165,10 @@ void entry_update(struct entry *entry) /* Clear the image. */ struct color color = entry->background_color; cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); + cairo_save(cr); + cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); cairo_paint(cr); + cairo_restore(cr); /* Draw our text. */ color = entry->foreground_color; diff --git a/src/entry.h b/src/entry.h index 95cab5d..f450daa 100644 --- a/src/entry.h +++ b/src/entry.h @@ -36,18 +36,21 @@ struct entry { struct history history; /* Options */ + bool horizontal; + uint32_t num_results; uint32_t font_size; const char *font_name; + const char *prompt_text; + uint32_t corner_radius; uint32_t padding; - uint32_t num_characters; - uint32_t num_lines; + int32_t result_padding; struct color foreground_color; struct color background_color; struct { struct color color; struct color outline_color; - int32_t width; - int32_t outline_width; + uint32_t width; + uint32_t outline_width; } border; }; diff --git a/src/entry_backend/harfbuzz.c b/src/entry_backend/harfbuzz.c index 89ed13b..f2e2d26 100644 --- a/src/entry_backend/harfbuzz.c +++ b/src/entry_backend/harfbuzz.c @@ -138,7 +138,6 @@ void entry_backend_init( if (err) { log_error("Error setting font size: %s\n", get_ft_error_string(err)); - exit(EXIT_FAILURE); } log_debug("Creating Cairo font.\n"); @@ -149,10 +148,17 @@ void entry_backend_init( cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a); cairo_set_font_face(cr, entry->backend.cairo_face); cairo_set_font_size(cr, entry->font_size * PT_TO_DPI); + cairo_font_options_t *opts = cairo_font_options_create(); + cairo_font_options_set_hint_style(opts, CAIRO_HINT_STYLE_NONE); + cairo_set_font_options(cr, opts); + /* We also need to set up the font for our other Cairo context. */ cairo_set_font_face(entry->cairo[1].cr, entry->backend.cairo_face); cairo_set_font_size(entry->cairo[1].cr, entry->font_size * PT_TO_DPI); + cairo_set_font_options(entry->cairo[1].cr, opts); + + cairo_font_options_destroy(opts); log_debug("Creating Harfbuzz font.\n"); entry->backend.hb_font = @@ -165,7 +171,7 @@ void entry_backend_init( /* Draw the prompt now, as this only needs to be done once */ log_debug("Drawing prompt.\n"); - hb_buffer_add_utf8(entry->backend.hb_buffer, "run: ", -1, 0, -1); + hb_buffer_add_utf8(entry->backend.hb_buffer, entry->prompt_text, -1, 0, -1); hb_shape(entry->backend.hb_font, entry->backend.hb_buffer, NULL, 0); uint32_t prompt_width = render_hb_buffer(cr, buffer, scale); @@ -188,25 +194,30 @@ void entry_backend_update(struct entry *entry) { cairo_t *cr = entry->cairo[entry->index].cr; hb_buffer_t *buffer = entry->backend.hb_buffer; + uint32_t width; /* Render the entry text */ hb_buffer_clear_contents(buffer); setup_hb_buffer(buffer); hb_buffer_add_utf8(buffer, entry->input_mb, -1, 0, -1); hb_shape(entry->backend.hb_font, buffer, NULL, 0); - render_hb_buffer(cr, buffer, entry->image.scale); + width = render_hb_buffer(cr, buffer, entry->image.scale); cairo_font_extents_t font_extents; cairo_font_extents(cr, &font_extents); /* Render our results entry text */ - for (size_t i = 0; i < 5 && i < entry->results.count; i++) { - cairo_translate(cr, 0, font_extents.height); + for (size_t i = 0; i < entry->num_results && i < entry->results.count; i++) { + if (entry->horizontal) { + cairo_translate(cr, width + entry->result_padding, 0); + } else { + cairo_translate(cr, 0, font_extents.height + entry->result_padding); + } hb_buffer_clear_contents(buffer); setup_hb_buffer(buffer); hb_buffer_add_utf8(buffer, entry->results.buf[i], -1, 0, -1); hb_shape(entry->backend.hb_font, buffer, NULL, 0); - render_hb_buffer(cr, buffer, entry->image.scale); + width = render_hb_buffer(cr, buffer, entry->image.scale); } } diff --git a/src/entry_backend/pango.c b/src/entry_backend/pango.c index 6aafaef..d063147 100644 --- a/src/entry_backend/pango.c +++ b/src/entry_backend/pango.c @@ -26,7 +26,7 @@ void entry_backend_init(struct entry *entry, uint32_t *width, uint32_t *height, entry->backend.layout = pango_layout_new(context); log_debug("Setting Pango text.\n"); - pango_layout_set_text(entry->backend.layout, "run: ", -1); + pango_layout_set_text(entry->backend.layout, entry->prompt_text, -1); log_debug("First Pango draw.\n"); pango_cairo_update_layout(cr, entry->backend.layout); @@ -64,7 +64,7 @@ void entry_backend_update(struct entry *entry) int height; pango_layout_get_size(layout, NULL, &height); - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < entry->num_results && i < entry->results.count; i++) { cairo_translate(cr, 0, (int)(height / PANGO_SCALE)); const char *str; if (i < entry->results.count) { diff --git a/src/history.c b/src/history.c index 89a45d3..94d3f75 100644 --- a/src/history.c +++ b/src/history.c @@ -79,7 +79,11 @@ struct history history_load() } char *buf = xmalloc(len); - fread(buf, 1, len, histfile); + if (fread(buf, 1, len, histfile) != 0) { + log_error("Error reading history file: %s.\n", strerror(errno)); + fclose(histfile); + return vec; + } fclose(histfile); char *saveptr = NULL; @@ -25,6 +25,33 @@ #undef MAX #define MAX(a, b) ((a) > (b) ? (a) : (b)) +static int get_anchor(int anchor) +{ + switch (anchor) { + case 1: + return ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP + | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT; + case 2: + return ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP; + case 3: + return ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP + | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; + case 4: + return ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; + case 5: + return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM + | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; + case 6: + return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM; + case 7: + return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM + | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT; + case 8: + return ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT; + } + return 0; +} + static void zwlr_layer_surface_configure( void *data, struct zwlr_layer_surface_v1 *zwlr_layer_surface, @@ -39,30 +66,26 @@ static void zwlr_layer_surface_configure( return; } log_debug("Layer surface configure, %d x %d.\n", width, height); - if (width != tofi->window.width || height != tofi->window.height) { - tofi->window.width = width; - tofi->window.height = height; - /* - * Resize the main window. - * We want actual pixel width / height, so we have to scale the - * values provided by Wayland. - */ - tofi->window.surface.width = - tofi->window.width * tofi->window.scale; - tofi->window.surface.height = - tofi->window.height * tofi->window.scale; + /* + * Resize the main window. + * We want actual pixel width / height, so we have to scale the + * values provided by Wayland. + */ + tofi->window.width = width * tofi->window.scale; + tofi->window.height = height * tofi->window.scale; - /* Assume 4 bytes per pixel for WL_SHM_FORMAT_XRGB8888 */ - tofi->window.surface.stride = - tofi->window.surface.width * 4; + tofi->window.surface.width = tofi->window.width; + tofi->window.surface.height = tofi->window.height; - /* - * Need to redraw the background at the new size. This entails - * a wl_surface_commit, so no need to do so explicitly here. - */ - tofi->window.surface.redraw = true; - } + /* Assume 4 bytes per pixel for WL_SHM_FORMAT_ARGB8888 */ + tofi->window.surface.stride = tofi->window.surface.width * 4; + + /* + * Need to redraw the background at the new size. This entails + * a wl_surface_commit, so no need to do so explicitly here. + */ + tofi->window.surface.redraw = true; zwlr_layer_surface_v1_ack_configure( tofi->window.zwlr_layer_surface, serial); @@ -92,7 +115,7 @@ static void wl_keyboard_keymap( struct tofi *tofi = data; assert(format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1); - char *map_shm = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); + char *map_shm = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); assert(map_shm != MAP_FAILED); struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_string( @@ -156,7 +179,7 @@ static void wl_keyboard_key( sizeof(buf)); wchar_t ch; mbtowc(&ch, buf, sizeof(buf)); - if (len > 0 && iswprint(ch)) { + if (len > 0 && iswprint(ch) && !iswblank(ch)) { if (entry->input_length < N_ELEM(entry->input) - 1) { entry->input[entry->input_length] = ch; entry->input_length++; @@ -423,6 +446,22 @@ static void output_scale( log_debug("Output scale factor is %d.\n", factor); } +static void output_name( + void *data, + struct wl_output *wl_output, + const char *name) +{ + /* Deliberately left blank */ +} + +static void output_description( + void *data, + struct wl_output *wl_output, + const char *description) +{ + /* Deliberately left blank */ +} + static void output_done(void *data, struct wl_output *wl_output) { log_debug("Output configuration done.\n"); @@ -433,6 +472,8 @@ static const struct wl_output_listener wl_output_listener = { .mode = output_mode, .done = output_done, .scale = output_scale, + .name = output_name, + .description = output_description, }; static void registry_global( @@ -467,7 +508,7 @@ static void registry_global( wl_registry, name, &wl_output_interface, - 3); + 4); wl_output_add_listener( tofi->wl_output, &wl_output_listener, @@ -528,8 +569,6 @@ static void usage() { fprintf(stderr, "Usage: tofi [options]\n" -" -u, --user=NAME The user to login as.\n" -" -c, --command=COMMAND The command to run on login.\n" " -B, --background-color=COLOR Color of the background.\n" " -o, --outline-width=VALUE Width of the border outlines in pixels.\n" " -O, --outline-color=COLOR Color of the border outlines.\n" @@ -540,7 +579,6 @@ static void usage() " -f, --font-name=NAME Font to use.\n" " -F, --font-size=VALUE Point size of text.\n" " -T, --text-color=COLOR Color of text.\n" -" -n, --width-characters=VALUE Width of the entry box in characters.\n" " -H, --hide-cursor Hide the cursor.\n" " -h, --help Print this message and exit.\n" ); @@ -556,14 +594,11 @@ int main(int argc, char *argv[]) /* Default options. */ struct tofi tofi = { - .username = "nobody", - .command = "false", .window = { .background_color = {0.89f, 0.8f, 0.824f, 1.0f}, .scale = 1, .width = 640, - .height = 480, - .surface = { .width = 640, .height = 480 }, + .height = 320, .entry = { .border = { .width = 6, @@ -573,8 +608,9 @@ int main(int argc, char *argv[]) }, .font_name = "Sans Bold", .font_size = 24, + .prompt_text = "run: ", + .num_results = 5, .padding = 8, - .num_characters = 12, .background_color = {0.106f, 0.114f, 0.118f, 1.0f}, .foreground_color = {1.0f, 1.0f, 1.0f, 1.0f} } @@ -593,35 +629,50 @@ int main(int argc, char *argv[]) /* Option parsing with getopt. */ struct option long_options[] = { + {"anchor", required_argument, NULL, 'a'}, {"background-color", required_argument, NULL, 'B'}, - {"border-width", required_argument, NULL, 'r'}, - {"border-color", required_argument, NULL, 'R'}, - {"outline-width", required_argument, NULL, 'o'}, - {"outline-color", required_argument, NULL, 'O'}, + {"corner-radius", required_argument, NULL, 'c'}, {"entry-padding", required_argument, NULL, 'e'}, {"entry-color", required_argument, NULL, 'E'}, - {"text-color", required_argument, NULL, 'T'}, {"font-name", required_argument, NULL, 'f'}, {"font-size", required_argument, NULL, 'F'}, - {"command", required_argument, NULL, 'c'}, - {"user", required_argument, NULL, 'u'}, - {"width-characters", required_argument, NULL, 'n'}, + {"num-results", required_argument, NULL, 'n'}, + {"outline-width", required_argument, NULL, 'o'}, + {"outline-color", required_argument, NULL, 'O'}, + {"prompt-text", required_argument, NULL, 'p'}, + {"result-padding", required_argument, NULL, 'P'}, + {"border-width", required_argument, NULL, 'r'}, + {"border-color", required_argument, NULL, 'R'}, + {"text-color", required_argument, NULL, 'T'}, + {"width", required_argument, NULL, 'X'}, + {"height", required_argument, NULL, 'Y'}, + {"x-offset", required_argument, NULL, 'x'}, + {"y-offset", required_argument, NULL, 'y'}, + {"layout-horizontal", no_argument, NULL, 'l'}, {"hide-cursor", no_argument, NULL, 'H'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0} }; - const char *short_options = ":b:B:c:e:E:f:F:hHr:R:n:o:O:T:u:"; + const char *short_options = ":a:B:c:e:E:f:F:hHln:o:O:p:P:r:R:T:x:X:y:Y:"; int opt = getopt_long(argc, argv, short_options, long_options, NULL); while (opt != -1) { switch (opt) { + case 'a': + tofi.anchor = + get_anchor(strtol(optarg, NULL, 0)); + break; case 'B': tofi.window.background_color = hex_to_color(optarg); break; + case 'c': + tofi.window.entry.corner_radius = + strtoul(optarg, NULL, 0); + break; case 'r': tofi.window.entry.border.width = - strtol(optarg, NULL, 0); + strtoul(optarg, NULL, 0); break; case 'R': tofi.window.entry.border.color = @@ -629,7 +680,7 @@ int main(int argc, char *argv[]) break; case 'o': tofi.window.entry.border.outline_width = - strtol(optarg, NULL, 0); + strtoul(optarg, NULL, 0); break; case 'O': tofi.window.entry.border.outline_color = @@ -637,7 +688,7 @@ int main(int argc, char *argv[]) break; case 'e': tofi.window.entry.padding = - strtol(optarg, NULL, 0); + strtoul(optarg, NULL, 0); break; case 'E': tofi.window.entry.background_color = @@ -652,20 +703,40 @@ int main(int argc, char *argv[]) break; case 'F': tofi.window.entry.font_size = - strtol(optarg, NULL, 0); + strtoul(optarg, NULL, 0); break; - case 'c': - tofi.command = optarg; + case 'H': + tofi.hide_cursor = true; break; - case 'u': - tofi.username = optarg; + case 'p': + tofi.window.entry.prompt_text = optarg; + break; + case 'P': + tofi.window.entry.result_padding = + strtol(optarg, NULL, 0); break; case 'n': - tofi.window.entry.num_characters = + tofi.window.entry.num_results = + strtoul(optarg, NULL, 0); + break; + case 'X': + tofi.window.width = + strtoul(optarg, NULL, 0); + break; + case 'x': + tofi.window.x = strtol(optarg, NULL, 0); break; - case 'H': - tofi.hide_cursor = true; + case 'Y': + tofi.window.height = + strtoul(optarg, NULL, 0); + break; + case 'y': + tofi.window.y = + strtol(optarg, NULL, 0); + break; + case 'l': + tofi.window.entry.horizontal = true; break; case 'h': usage(); @@ -760,7 +831,7 @@ int main(int argc, char *argv[]) tofi.zwlr_layer_shell, tofi.window.surface.wl_surface, tofi.wl_output, - ZWLR_LAYER_SHELL_V1_LAYER_TOP, + ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "launcher"); zwlr_layer_surface_v1_set_keyboard_interactivity( tofi.window.zwlr_layer_surface, @@ -772,17 +843,20 @@ int main(int argc, char *argv[]) &tofi); zwlr_layer_surface_v1_set_anchor( tofi.window.zwlr_layer_surface, - ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP - | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM - | ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT - | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT); + tofi.anchor); zwlr_layer_surface_v1_set_exclusive_zone( tofi.window.zwlr_layer_surface, -1); zwlr_layer_surface_v1_set_size( tofi.window.zwlr_layer_surface, - 800, - 400); + tofi.window.width, + tofi.window.height); + zwlr_layer_surface_v1_set_margin( + tofi.window.zwlr_layer_surface, + tofi.window.x, + tofi.window.y, + tofi.window.x, + tofi.window.y); wl_surface_commit(tofi.window.surface.wl_surface); /* diff --git a/src/string_vec.c b/src/string_vec.c index e55dea4..82b86e1 100644 --- a/src/string_vec.c +++ b/src/string_vec.c @@ -1,3 +1,4 @@ +#define _GNU_SOURCE /* Required for strcasestr */ #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -100,7 +101,7 @@ struct string_vec string_vec_filter( { struct string_vec filt = string_vec_create(); for (size_t i = 0; i < vec->count; i++) { - if (strstr(vec->buf[i], substr) != NULL) { + if (strcasestr(vec->buf[i], substr) != NULL) { string_vec_add(&filt, vec->buf[i]); } } diff --git a/src/surface.c b/src/surface.c index 30a46cd..e7b2ac1 100644 --- a/src/surface.c +++ b/src/surface.c @@ -12,7 +12,6 @@ void surface_init( struct surface *surface, struct wl_shm *wl_shm) { - const int height = surface->height; const int stride = surface->stride; @@ -42,7 +41,7 @@ void surface_init( surface->width, surface->height, surface->stride, - WL_SHM_FORMAT_XRGB8888); + WL_SHM_FORMAT_ARGB8888); } log_debug("Created shm file with size %d KiB.\n", @@ -19,19 +19,12 @@ struct tofi { struct wl_shm *wl_shm; struct zwlr_layer_shell_v1 *zwlr_layer_shell; - uint32_t wl_display_name; - uint32_t wl_registry_name; - uint32_t wl_compositor_name; - uint32_t wl_seat_name; - uint32_t wl_output_name; - uint32_t wl_shm_name; - uint32_t zwlr_layer_shell_name; - /* Objects */ struct wl_keyboard *wl_keyboard; struct wl_pointer *wl_pointer; /* State */ + bool submit; bool closed; struct { struct surface surface; @@ -41,6 +34,8 @@ struct tofi { uint32_t width; uint32_t height; uint32_t scale; + int32_t x; + int32_t y; } window; /* Keyboard state */ @@ -48,12 +43,8 @@ struct tofi { struct xkb_context *xkb_context; struct xkb_keymap *xkb_keymap; - /* greetd state */ - const char *username; - const char *command; - bool submit; - /* Options */ + int anchor; bool hide_cursor; }; |