Added line_wrap config option

This commit is contained in:
Scoopta 2020-02-21 00:17:59 -08:00
parent c0b6233bd6
commit 33a69e713a
2 changed files with 8 additions and 0 deletions

View File

@ -141,6 +141,9 @@ Specifies the key to use in order to submit an action. Default is Return. See \f
.TP
.B key_exit=\fIKEY\fR
Specifies the key to use in order to exit wofi. Default is Escape. See \fBwofi\-keys\fR(7) for the key codes.
.TP
.B line_wrap=\fIBOOL\fR
Enables line wrap mode. If enabled lines will be wrapped to avoid scrolling. Default is false.
.SH CSS SELECTORS
Any GTK widget can be selected by using the name of its CSS node, these however might change with updates and are not guarenteed to stay constant. Wofi also provides certain widgets with names and classes which can be referenced from CSS to give access to the most important widgets easily. \fBwofi\fR(7) contains the current widget layout used by wofi so if you want to get into CSS directly using GTK widget names look there for info.

View File

@ -70,6 +70,8 @@ static uint16_t widget_count = 0;
static enum sort_order sort_order;
static int64_t min_height = INT64_MAX;
static uint64_t lines;
static bool line_wrap;
static char* key_up, *key_down, *key_left, *key_right, *key_forward, *key_backward, *key_submit, *key_exit;
static char* mod_up, *mod_down, *mod_left, *mod_right, *mod_forward, *mod_backward, *mod_exit;
@ -266,6 +268,7 @@ static char* parse_images(WofiPropertyBox* box, const char* text, bool create_wi
gtk_widget_set_name(label, "text");
gtk_label_set_use_markup(GTK_LABEL(label), allow_markup);
gtk_label_set_xalign(GTK_LABEL(label), 0);
gtk_label_set_line_wrap(GTK_LABEL(label), line_wrap);
gtk_container_add(GTK_CONTAINER(box), label);
} else {
char* tmp = ret;
@ -318,6 +321,7 @@ static GtkWidget* create_label(char* mode, char* text, char* search_text, char*
gtk_widget_set_name(label, "text");
gtk_label_set_use_markup(GTK_LABEL(label), allow_markup);
gtk_label_set_xalign(GTK_LABEL(label), 0);
gtk_label_set_line_wrap(GTK_LABEL(label), line_wrap);
gtk_container_add(GTK_CONTAINER(box), label);
}
if(parse_search) {
@ -1210,6 +1214,7 @@ void wofi_init(struct map* _config) {
lines = strtol(config_get(config, "lines", "0"), NULL, 10);
columns = strtol(config_get(config, "columns", "1"), NULL, 10);
sort_order = config_get_mnemonic(config, "sort_order", "default", 2, "default", "alphabetical");
line_wrap = strcmp(config_get(config, "line_wrap", "false"), "true") == 0;
key_up = config_get(config, "key_up", "Up");
key_down = config_get(config, "key_down", "Down");