From c609e5e0857b03015cf28f3b61861915a863f0cb Mon Sep 17 00:00:00 2001 From: Qball Date: Thu, 13 Feb 2025 21:04:29 +0100 Subject: [PATCH 01/19] [DRun] Better handling of corrupted cache file. --- source/modes/drun.c | 108 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 86 insertions(+), 22 deletions(-) diff --git a/source/modes/drun.c b/source/modes/drun.c index 848f1a16..02454bc5 100644 --- a/source/modes/drun.c +++ b/source/modes/drun.c @@ -235,6 +235,7 @@ struct RegexEvalArg { const char *path; gboolean success; }; +static void drun_entry_clear(DRunModeEntry *e); static gboolean drun_helper_eval_cb(const GMatchInfo *info, GString *res, gpointer data) { @@ -964,18 +965,19 @@ static void drun_write_str(FILE *fd, const char *str) { static void drun_write_integer(FILE *fd, int32_t val) { fwrite(&val, sizeof(val), 1, fd); } -static void drun_read_integer(FILE *fd, int32_t *type) { +static gboolean drun_read_integer(FILE *fd, int32_t *type) { if (fread(type, sizeof(int32_t), 1, fd) != 1) { g_warning("Failed to read entry, cache corrupt?"); - return; + return TRUE; } + return FALSE; } -static void drun_read_string(FILE *fd, char **str) { +static gboolean drun_read_string(FILE *fd, char **str) { size_t l = 0; if (fread(&l, sizeof(l), 1, fd) != 1) { g_warning("Failed to read entry, cache corrupt?"); - return; + return TRUE; } (*str) = NULL; if (l > 0) { @@ -984,8 +986,10 @@ static void drun_read_string(FILE *fd, char **str) { (*str) = g_malloc(l); if (fread((*str), 1, l, fd) != l) { g_warning("Failed to read entry, cache corrupt?"); + return TRUE; } } + return FALSE; } static void drun_write_strv(FILE *fd, char **str) { guint vl = (str == NULL ? 0 : g_strv_length(str)); @@ -994,20 +998,23 @@ static void drun_write_strv(FILE *fd, char **str) { drun_write_str(fd, str[index]); } } -static void drun_read_stringv(FILE *fd, char ***str) { +static gboolean drun_read_stringv(FILE *fd, char ***str) { guint vl = 0; (*str) = NULL; if (fread(&vl, sizeof(vl), 1, fd) != 1) { g_warning("Failed to read entry, cache corrupt?"); - return; + return TRUE; } if (vl > 0) { // Include terminating NULL entry. (*str) = g_malloc0((vl + 1) * sizeof(**str)); for (guint index = 0; index < vl; index++) { - drun_read_string(fd, &((*str)[index])); + if (drun_read_string(fd, &((*str)[index]))) { + return TRUE; + } } } + return FALSE; } static void write_cache(DRunModePrivateData *pd, const char *cache_file) { @@ -1098,30 +1105,82 @@ static gboolean drun_read_cache(DRunModePrivateData *pd, pd->entry_list = g_malloc0(pd->cmd_list_length_actual * sizeof(*(pd->entry_list))); - for (unsigned int index = 0; index < pd->cmd_list_length; index++) { + int error = 0; + for (unsigned int index = 0; !error && index < pd->cmd_list_length; index++) { DRunModeEntry *entry = &(pd->entry_list[index]); - drun_read_string(fd, &(entry->action)); - drun_read_string(fd, &(entry->root)); - drun_read_string(fd, &(entry->path)); - drun_read_string(fd, &(entry->app_id)); - drun_read_string(fd, &(entry->desktop_id)); - drun_read_string(fd, &(entry->icon_name)); - drun_read_string(fd, &(entry->exec)); - drun_read_string(fd, &(entry->name)); - drun_read_string(fd, &(entry->generic_name)); + if (drun_read_string(fd, &(entry->action))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->root))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->path))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->app_id))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->desktop_id))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->icon_name))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->exec))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->name))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->generic_name))) { + error = 1; + continue; + } - drun_read_stringv(fd, &(entry->categories)); - drun_read_stringv(fd, &(entry->keywords)); + if (drun_read_stringv(fd, &(entry->categories))) { + error = 1; + continue; + } + if (drun_read_stringv(fd, &(entry->keywords))) { + error = 1; + continue; + } - drun_read_string(fd, &(entry->comment)); - drun_read_string(fd, &(entry->url)); + if (drun_read_string(fd, &(entry->comment))) { + error = 1; + continue; + } + if (drun_read_string(fd, &(entry->url))) { + error = 1; + continue; + } int32_t type = 0; - drun_read_integer(fd, &(type)); + if (drun_read_integer(fd, &(type))) { + error = 1; + continue; + } entry->type = type; } fclose(fd); + if (error) { + for (size_t i = 0; i < pd->cmd_list_length; i++) { + drun_entry_clear(&(pd->entry_list[i])); + } + g_free(pd->entry_list); + pd->cmd_list_length = 0; + pd->cmd_list_length_actual = 0; + return TRUE; + } TICK_N("DRUN Read CACHE: stop"); return FALSE; } @@ -1188,6 +1247,8 @@ static void get_apps(DRunModePrivateData *pd) { TICK_N("Sorting done."); write_cache(pd, cache_file); + } else { + g_debug("Read drun entries from cache."); } g_free(cache_file); } @@ -1267,6 +1328,9 @@ static int drun_mode_init(Mode *sw) { return TRUE; } static void drun_entry_clear(DRunModeEntry *e) { + if (e == NULL) { + return; + } g_free(e->root); g_free(e->path); g_free(e->app_id); From 47053f30d29c0b9dd5215195573227e78801c43c Mon Sep 17 00:00:00 2001 From: Qball Date: Tue, 18 Feb 2025 21:15:14 +0100 Subject: [PATCH 02/19] [View] xcb_clear_area fixed wrong argument order. --- source/view.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/view.c b/source/view.c index 59d4d663..b87558be 100644 --- a/source/view.c +++ b/source/view.c @@ -666,7 +666,8 @@ void rofi_view_set_selected_line(RofiViewState *state, } } listview_set_selected(state->list_view, selected); - xcb_clear_area(xcb->connection, CacheState.main_window, 1, 0, 0, 1, 1); + // Clear the window and force an expose event resulting in a redraw. + xcb_clear_area(xcb->connection, 1, CacheState.main_window, 0, 0, 1, 1); xcb_flush(xcb->connection); } From 5d77a9bb3356b4a6a2d26e16f5ad0cbfa522a4e2 Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Thu, 20 Feb 2025 09:56:29 +0100 Subject: [PATCH 03/19] [Helper] Add a rofi_fallthrough macro to tell compiler fallthrough is intentional --- include/helper.h | 13 +++++++++++++ source/view.c | 14 +++++++------- source/widgets/listview.c | 5 +++-- source/xcb.c | 4 ++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/include/helper.h b/include/helper.h index c16daeb0..06e9ef85 100644 --- a/include/helper.h +++ b/include/helper.h @@ -455,6 +455,19 @@ void helper_select_next_matching_mode(void); * Switch to the previous matching method. */ void helper_select_previous_matching_mode(void); + +/** + * Method to indicate fallthrough. This will help + * gcc/llvm warning/static code analysis. + */ +#if __has_attribute(__fallthrough__) +#define rofi_fallthrough __attribute__((__fallthrough__)) +#else +#define rofi_fallthrough \ + do { \ + } while (0) /* fallthrough */ +#endif + G_END_DECLS /**@} */ diff --git a/source/view.c b/source/view.c index b87558be..9c2f7a96 100644 --- a/source/view.c +++ b/source/view.c @@ -396,30 +396,30 @@ static void rofi_view_calculate_window_position(RofiViewState *state) { switch (location) { case WL_NORTH_WEST: state->x = CacheState.mon.x; - /* FALLTHRU */ + rofi_fallthrough; case WL_NORTH: state->y = CacheState.mon.y; break; case WL_NORTH_EAST: state->y = CacheState.mon.y; - /* FALLTHRU */ + rofi_fallthrough; case WL_EAST: state->x = CacheState.mon.x + CacheState.mon.w; break; case WL_SOUTH_EAST: state->x = CacheState.mon.x + CacheState.mon.w; - /* FALLTHRU */ + rofi_fallthrough; case WL_SOUTH: state->y = CacheState.mon.y + CacheState.mon.h; break; case WL_SOUTH_WEST: state->y = CacheState.mon.y + CacheState.mon.h; - /* FALLTHRU */ + rofi_fallthrough; case WL_WEST: state->x = CacheState.mon.x; break; case WL_CENTER:; - /* FALLTHRU */ + rofi_fallthrough; default: break; } @@ -2057,10 +2057,10 @@ void rofi_view_trigger_action(RofiViewState *state, BindingsScope scope, return; case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END: target = NULL; - /* FALLTHRU */ + rofi_fallthrough; case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN: state->mouse.motion_target = target; - /* FALLTHRU */ + rofi_fallthrough; case WIDGET_TRIGGER_ACTION_RESULT_HANDLED: return; } diff --git a/source/widgets/listview.c b/source/widgets/listview.c index b76bedee..77040623 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -34,6 +34,7 @@ #include #include +#include "helper.h" #include "settings.h" #include "theme.h" #include "view.h" @@ -120,7 +121,7 @@ struct _listview { xcb_timestamp_t last_click; listview_mouse_activated_cb mouse_activated; void *mouse_activated_data; - + listview_page_changed_cb page_callback; char *listview_name; @@ -757,7 +758,7 @@ static WidgetTriggerActionResult listview_element_trigger_action( break; case ACCEPT_HOVERED_CUSTOM: custom = TRUE; - /* FALLTHRU */ + rofi_fallthrough; case ACCEPT_HOVERED_ENTRY: listview_set_selected(lv, lv->last_offset + i); lv->mouse_activated(lv, custom, lv->mouse_activated_data); diff --git a/source/xcb.c b/source/xcb.c index f2073fc5..0c9501a1 100644 --- a/source/xcb.c +++ b/source/xcb.c @@ -1172,13 +1172,13 @@ static gboolean x11_button_to_nk_bindings_scroll(guint32 x11_button, switch (x11_button) { case 4: *steps = -1; - /* fallthrough */ + rofi_fallthrough; case 5: *axis = NK_BINDINGS_SCROLL_AXIS_VERTICAL; break; case 6: *steps = -1; - /* fallthrough */ + rofi_fallthrough; case 7: *axis = NK_BINDINGS_SCROLL_AXIS_HORIZONTAL; break; From 8639783f5f9311711c09083aab3303157441640b Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Thu, 20 Feb 2025 10:08:35 +0100 Subject: [PATCH 04/19] [XCB] Don't keep casting from int to double to int --- include/xcb.h | 2 +- source/view.c | 2 +- source/xcb.c | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/xcb.h b/include/xcb.h index b4a7a3ba..c0116951 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -237,7 +237,7 @@ cairo_surface_t *x11_helper_get_screenshot_surface_window(xcb_window_t window, * * Blur the content of the surface with radius and deviation. */ -void cairo_image_surface_blur(cairo_surface_t *surface, double radius, +void cairo_image_surface_blur(cairo_surface_t *surface, int radius, double deviation); #ifdef XCB_IMDKIT diff --git a/source/view.c b/source/view.c index 9c2f7a96..f77af637 100644 --- a/source/view.c +++ b/source/view.c @@ -847,7 +847,7 @@ rofi_view_setup_fake_transparency(widget *win, cairo_destroy(dr); cairo_surface_destroy(s); if (blur > 0) { - cairo_image_surface_blur(CacheState.fake_bg, (double)blur, 0); + cairo_image_surface_blur(CacheState.fake_bg, blur, 0); TICK_N("BLUR"); } } diff --git a/source/xcb.c b/source/xcb.c index 0c9501a1..6b2d9e0b 100644 --- a/source/xcb.c +++ b/source/xcb.c @@ -146,11 +146,10 @@ static xcb_visualtype_t *lookup_visual(xcb_screen_t *s, xcb_visualid_t vis) { * website: http://macslow.thepimp.net. I'm not entirely sure he's proud of it, * but it has proved immeasurably useful for me. */ -static uint32_t *create_kernel(double radius, double deviation, - uint32_t *sum2) { - int size = 2 * (int)(radius) + 1; +static uint32_t *create_kernel(int radius, double deviation, uint32_t *sum2) { + int size = 2 * (radius) + 1; uint32_t *kernel = (uint32_t *)(g_malloc(sizeof(uint32_t) * (size + 1))); - double radiusf = fabs(radius) + 1.0; + double radiusf = abs(radius) + 1.0; double value = -radius; double sum = 0.0; int i; @@ -174,7 +173,7 @@ static uint32_t *create_kernel(double radius, double deviation, return kernel; } -void cairo_image_surface_blur(cairo_surface_t *surface, double radius, +void cairo_image_surface_blur(cairo_surface_t *surface, int radius, double deviation) { uint32_t *horzBlur; uint32_t *kernel = 0; From a84f04a14b4524a0a1872eea5b000192b9d3207a Mon Sep 17 00:00:00 2001 From: J0hannes101 <93882518+J0hannes101@users.noreply.github.com> Date: Fri, 21 Feb 2025 16:28:21 +0100 Subject: [PATCH 05/19] [DRUN] Add option to exclude categories from drun #2102 (#2104) * Add option to exclude categories from drun * Fix memory leak when both -drun-categories and -drun-exclude-categories are used * update docs --- config/config.c | 2 ++ doc/rofi.1.markdown | 4 ++++ include/settings.h | 2 ++ source/modes/drun.c | 19 +++++++++++++++++++ source/xrmoptions.c | 6 ++++++ 5 files changed, 33 insertions(+) diff --git a/config/config.c b/config/config.c index 2d2347a5..1b9bccac 100644 --- a/config/config.c +++ b/config/config.c @@ -128,6 +128,8 @@ Settings config = { .drun_match_fields = "name,generic,exec,categories,keywords", /** Only show entries in this category */ .drun_categories = NULL, + /** Exclude entries in this category */ + .drun_exclude_categories = NULL, /** Desktop entry show actions */ .drun_show_actions = FALSE, /** Desktop format display */ diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown index 28be15fb..3847cde8 100644 --- a/doc/rofi.1.markdown +++ b/doc/rofi.1.markdown @@ -374,6 +374,10 @@ Tokenize the input. Only show desktop files that are present in the listed categories. +`-drun-exclude-categories` *category1*,*category2* + +Exclude desktop files that are present in the listed categories. + `-drun-match-fields` *field1*,*field2*,... When using `drun`, match only with the specified Desktop entry fields. diff --git a/include/settings.h b/include/settings.h index a958b478..971841f4 100644 --- a/include/settings.h +++ b/include/settings.h @@ -119,6 +119,8 @@ typedef struct { char *drun_match_fields; /** Only show entries in this category */ char *drun_categories; + /** Exclude entries in this category */ + char *drun_exclude_categories; /** Desktop entry show actions */ unsigned int drun_show_actions; /** Desktop format display */ diff --git a/source/modes/drun.c b/source/modes/drun.c index 02454bc5..4b146fb9 100644 --- a/source/modes/drun.c +++ b/source/modes/drun.c @@ -215,6 +215,7 @@ struct _DRunModePrivateData { unsigned int expected_line_height; char **show_categories; + char **exclude_categories; // Theme const gchar *icon_theme; @@ -722,6 +723,19 @@ static void read_desktop_file(DRunModePrivateData *pd, const char *root, } } + if (pd->exclude_categories) { + if (categories == NULL) { + categories = g_key_file_get_locale_string_list( + kf, DRUN_GROUP_NAME, "Categories", NULL, NULL, NULL); + } + if (rofi_strv_contains((const char *const *)categories, + (const char *const *)pd->exclude_categories)) { + g_strfreev(categories); + g_key_file_free(kf); + return; + } + } + size_t nl = ((pd->cmd_list_length) + 1); if (nl >= pd->cmd_list_length_actual) { pd->cmd_list_length_actual += 256; @@ -1320,6 +1334,10 @@ static int drun_mode_init(Mode *sw) { pd->show_categories = g_strsplit(config.drun_categories, ",", 0); } + if (config.drun_exclude_categories && *(config.drun_exclude_categories)) { + pd->exclude_categories = g_strsplit(config.drun_exclude_categories, ",", 0); + } + drun_mode_parse_entry_fields(); drun_mode_parse_display_format(); get_apps(pd); @@ -1473,6 +1491,7 @@ static void drun_mode_destroy(Mode *sw) { g_strfreev(rmpd->current_desktop_list); g_strfreev(rmpd->show_categories); + g_strfreev(rmpd->exclude_categories); g_free(rmpd); mode_set_private_data(sw, NULL); } diff --git a/source/xrmoptions.c b/source/xrmoptions.c index e4cbe4af..692124f9 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -241,6 +241,12 @@ static XrmOption xrmOptions[] = { NULL, "Only show Desktop entry from these categories", CONFIG_DEFAULT}, + {xrm_String, + "drun-exclude-categories", + {.str = &config.drun_exclude_categories}, + NULL, + "Exclude Desktop entries from these categories", + CONFIG_DEFAULT}, {xrm_Boolean, "drun-show-actions", {.num = &config.drun_show_actions}, From 22a0e39b9b1d47b335fc16f078afe217a14ff447 Mon Sep 17 00:00:00 2001 From: Qball Date: Fri, 21 Feb 2025 16:40:20 +0100 Subject: [PATCH 06/19] [Build] Update dependencies for sr.ht. --- .build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.build.yml b/.build.yml index 4f0c2cf6..617a3668 100644 --- a/.build.yml +++ b/.build.yml @@ -2,6 +2,8 @@ image: ubuntu/lts packages: - meson - ninja-build + - autoconf + - automake - build-essential - libpango1.0-dev - libstartup-notification0-dev @@ -13,10 +15,14 @@ packages: - libxcb-xkb-dev - libxcb-xrm-dev - libxcb-cursor-dev + - libxcb-imdkit-dev + - libxcb-keysyms1 - libxkbcommon-dev - libxkbcommon-dev - libxkbcommon-x11-dev - libgdk-pixbuf2.0-dev + - ninja-build + - pandoc - check - flex - bison @@ -38,4 +44,4 @@ tasks: - dist: | ninja -C rofi/builddir dist artifacts: - - rofi/builddir/meson-dist/rofi-1.7.5-dev.tar.xz + - rofi/builddir/meson-dist/rofi-1.7.8-dev.tar.xz From e70e3906cc9a6f07b8ff2e54a02d88ee995ef146 Mon Sep 17 00:00:00 2001 From: J0hannes101 <93882518+J0hannes101@users.noreply.github.com> Date: Tue, 25 Feb 2025 18:50:25 +0100 Subject: [PATCH 07/19] Add theming to hide text cursor if no text is put in (#2106) * Add theming to hide text cursor if no text is put in * rename "hide-empty-cursor" to "hide-cursor-on-empty" * update docs --- doc/rofi-theme.5.markdown | 9 ++-- source/widgets/textbox.c | 87 ++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 45 deletions(-) diff --git a/doc/rofi-theme.5.markdown b/doc/rofi-theme.5.markdown index c0381035..1a505047 100644 --- a/doc/rofi-theme.5.markdown +++ b/doc/rofi-theme.5.markdown @@ -132,18 +132,18 @@ element-text { └─────────────────────────────────────────────────────────────────────┘ ``` -We can also specify the color and width of the cursor. You could, for example, -create a crimson block cursor like this: +We can also customize the cursor's color, width, and choose to hide it when the input box is empty. You could, for example, create a crimson block cursor that only appears when text is entered, like this: ```css entry { cursor-color: rgb(220,20,60); cursor-width: 8px; + hide-cursor-on-empty: true; } ``` By default, the `cursor-color` will be the same as the `text-color`. The -`cursor-width` will always default to 2 pixels. +`cursor-width` will always default to 2 pixels and `hide-cursor-on-empty` is set to false. If you want to see the complete theme, including the modification you can run: @@ -1068,6 +1068,9 @@ The following properties are currently supported: - **cursor-color**: The color used to draw the cursor. +- **hide-cursor-on-empty**: Hides the cursor when the search field is empty. + (Boolean) + - **cursor-outline**: Enable a border (outline) around the cursor. (Boolean) diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c index 8e54005e..d4364419 100644 --- a/source/widgets/textbox.c +++ b/source/widgets/textbox.c @@ -552,51 +552,54 @@ static void textbox_draw(widget *wid, cairo_t *draw) { if (tb->flags & TB_EDITABLE) { // We want to place the cursor based on the text shown. const char *text = pango_layout_get_text(tb->layout); - // Clamp the position, should not be needed, but we are paranoid. - size_t cursor_offset; + // hide the cursor, if no text is entered and hide-empty-cursor is set to true + if (!(tb->text[0] == '\0' && rofi_theme_get_boolean(WIDGET(tb), "hide-cursor-on-empty", FALSE) == TRUE)){ + // Clamp the position, should not be needed, but we are paranoid. + size_t cursor_offset; - if ((tb->flags & TB_PASSWORD) == TB_PASSWORD) { - // Calculate cursor position based on mask length - size_t mask_len = strlen(tb->password_mask_char); - cursor_offset = MIN(tb->cursor * mask_len, strlen(text)); - } else { - cursor_offset = MIN(tb->cursor, g_utf8_strlen(text, -1)); - // convert to byte location. - char *offset = g_utf8_offset_to_pointer(text, cursor_offset); - cursor_offset = offset - text; - } - PangoRectangle pos; - pango_layout_get_cursor_pos(tb->layout, cursor_offset, &pos, NULL); - int cursor_x = pos.x / PANGO_SCALE; - int cursor_y = pos.y / PANGO_SCALE; - int cursor_height = pos.height / PANGO_SCALE; - RofiDistance cursor_width = - rofi_theme_get_distance(WIDGET(tb), "cursor-width", 2); - int cursor_pixel_width = - distance_get_pixel(cursor_width, ROFI_ORIENTATION_HORIZONTAL); - if ((x + cursor_x) != tb->cursor_x_pos) { - tb->cursor_x_pos = x + cursor_x; - } - if (tb->blink) { - // This save/restore state is necessary to render the text in the - // correct color when `cursor-color` is set - cairo_save(draw); - // use text color as fallback for themes that don't specify the cursor - // color - rofi_theme_get_color(WIDGET(tb), "cursor-color", draw); - cairo_rectangle(draw, x + cursor_x, y + cursor_y, cursor_pixel_width, - cursor_height); - if (rofi_theme_get_boolean(WIDGET(tb), "cursor-outline", FALSE)) { - cairo_fill_preserve(draw); - rofi_theme_get_color(WIDGET(tb), "cursor-outline-color", draw); - double width = - rofi_theme_get_double(WIDGET(tb), "cursor-outline-width", 0.5); - cairo_set_line_width(draw, width); - cairo_stroke(draw); + if ((tb->flags & TB_PASSWORD) == TB_PASSWORD) { + // Calculate cursor position based on mask length + size_t mask_len = strlen(tb->password_mask_char); + cursor_offset = MIN(tb->cursor * mask_len, strlen(text)); } else { - cairo_fill(draw); + cursor_offset = MIN(tb->cursor, g_utf8_strlen(text, -1)); + // convert to byte location. + char *offset = g_utf8_offset_to_pointer(text, cursor_offset); + cursor_offset = offset - text; + } + PangoRectangle pos; + pango_layout_get_cursor_pos(tb->layout, cursor_offset, &pos, NULL); + int cursor_x = pos.x / PANGO_SCALE; + int cursor_y = pos.y / PANGO_SCALE; + int cursor_height = pos.height / PANGO_SCALE; + RofiDistance cursor_width = + rofi_theme_get_distance(WIDGET(tb), "cursor-width", 2); + int cursor_pixel_width = + distance_get_pixel(cursor_width, ROFI_ORIENTATION_HORIZONTAL); + if ((x + cursor_x) != tb->cursor_x_pos) { + tb->cursor_x_pos = x + cursor_x; + } + if (tb->blink) { + // This save/restore state is necessary to render the text in the + // correct color when `cursor-color` is set + cairo_save(draw); + // use text color as fallback for themes that don't specify the cursor + // color + rofi_theme_get_color(WIDGET(tb), "cursor-color", draw); + cairo_rectangle(draw, x + cursor_x, y + cursor_y, cursor_pixel_width, + cursor_height); + if (rofi_theme_get_boolean(WIDGET(tb), "cursor-outline", FALSE)) { + cairo_fill_preserve(draw); + rofi_theme_get_color(WIDGET(tb), "cursor-outline-color", draw); + double width = + rofi_theme_get_double(WIDGET(tb), "cursor-outline-width", 0.5); + cairo_set_line_width(draw, width); + cairo_stroke(draw); + } else { + cairo_fill(draw); + } + cairo_restore(draw); } - cairo_restore(draw); } } From 8b13ae350d00aa794085fcb3903ad04303da3506 Mon Sep 17 00:00:00 2001 From: elig0n <31196036+elig0n@users.noreply.github.com> Date: Thu, 6 Mar 2025 12:13:34 +0200 Subject: [PATCH 08/19] Fix typo in fullscreen-preview.rasi (#2113) --- themes/fullscreen-preview.rasi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/fullscreen-preview.rasi b/themes/fullscreen-preview.rasi index 81c779ae..9078680c 100644 --- a/themes/fullscreen-preview.rasi +++ b/themes/fullscreen-preview.rasi @@ -21,7 +21,7 @@ window { } -/** We add an extra child to this is PREVIEW=true */ +/** We add an extra child to this if PREVIEW=true */ listview-split { orientation: horizontal; spacing: 0.4em; From a993ceadf4400368a8a9445f2766d370a3f59e62 Mon Sep 17 00:00:00 2001 From: Qball Date: Thu, 6 Mar 2025 11:26:18 +0100 Subject: [PATCH 09/19] [DOC] Fix indenting of sub-bullets as mkdocs interpets them differently issue: #2112 --- doc/rofi-theme.5.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/rofi-theme.5.markdown b/doc/rofi-theme.5.markdown index 1a505047..b14ae467 100644 --- a/doc/rofi-theme.5.markdown +++ b/doc/rofi-theme.5.markdown @@ -985,10 +985,10 @@ The following properties are currently supported: - **transparency**: string Indicating if transparency should be used and what type: - - **real** - True transparency. Only works with a compositor. - - **background** - Take a screenshot of the background image and use that. - - **screenshot** - Take a screenshot of the screen and use that. - - **Path** to png file - Use an image. + - **real** - True transparency. Only works with a compositor. + - **background** - Take a screenshot of the background image and use that. + - **screenshot** - Take a screenshot of the screen and use that. + - **Path** to png file - Use an image. - **location**: position The place of the anchor on the monitor From 56fd08ed58d437cdf46023ce777ee868b3faa801 Mon Sep 17 00:00:00 2001 From: J0hannes101 <93882518+J0hannes101@users.noreply.github.com> Date: Sat, 8 Mar 2025 18:34:39 +0100 Subject: [PATCH 10/19] [scrollbar] Add theming for rounded corners (#2108) * [scrollbar] Add theming for rounded corners * rename "rounded-corners" to "handle-rounded-corners" --- doc/rofi-theme.5.markdown | 1 + source/widgets/scrollbar.c | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/rofi-theme.5.markdown b/doc/rofi-theme.5.markdown index b14ae467..e1fb7ed0 100644 --- a/doc/rofi-theme.5.markdown +++ b/doc/rofi-theme.5.markdown @@ -1011,6 +1011,7 @@ The following properties are currently supported: - **handle-width**: distance - **handle-color**: color - **border-color**: color +- **handle-rounded-corners**: boolean for rounded scrollbar ### box diff --git a/source/widgets/scrollbar.c b/source/widgets/scrollbar.c index edb40246..6b9d463b 100644 --- a/source/widgets/scrollbar.c +++ b/source/widgets/scrollbar.c @@ -175,8 +175,26 @@ static void scrollbar_draw(widget *wid, cairo_t *draw) { // Cap length; rofi_theme_get_color(WIDGET(sb), "handle-color", draw); - cairo_rectangle(draw, widget_padding_get_left(wid), - widget_padding_get_top(wid) + y, - widget_padding_get_remaining_width(wid), height); - cairo_fill(draw); + if (rofi_theme_get_boolean(WIDGET(sb), "handle-rounded-corners", FALSE)) { + float x = widget_padding_get_left(wid); + float width = widget_padding_get_remaining_width(wid); + + float radius = ((width < height) ? width : height) / 2; // Limit radius to prevent overlap + + // Draw rounded rectangle + cairo_new_sub_path(draw); + cairo_arc(draw, x + width - radius, y + radius, radius, -G_PI_2, 0); + cairo_arc(draw, x + width - radius, y + height - radius, radius, 0, G_PI_2); + cairo_arc(draw, x + radius, y + height - radius, radius, G_PI_2, G_PI); + cairo_arc(draw, x + radius, y + radius, radius, G_PI, 1.5 * G_PI); + cairo_close_path(draw); + + cairo_fill(draw); + } + else { + cairo_rectangle(draw, widget_padding_get_left(wid), + widget_padding_get_top(wid) + y, + widget_padding_get_remaining_width(wid), height); + cairo_fill(draw); + } } From d948e33e6824b07c05254c91dfa0c8d6f4dbc0d8 Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Sun, 9 Mar 2025 12:47:13 +0100 Subject: [PATCH 11/19] [rofi-sensible-terminal] Add ghostty fixes: #2110 --- script/rofi-sensible-terminal | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/rofi-sensible-terminal b/script/rofi-sensible-terminal index 4bec1c90..bab92d80 100755 --- a/script/rofi-sensible-terminal +++ b/script/rofi-sensible-terminal @@ -9,10 +9,10 @@ # We welcome patches that add distribution-specific mechanisms to find the # preferred terminal emulator. On Debian, there is the x-terminal-emulator # symlink for example. -for terminal in $TERMINAL x-terminal-emulator urxvt rxvt st terminology qterminal Eterm aterm uxterm xterm roxterm xfce4-terminal.wrapper mate-terminal lxterminal konsole alacritty kitty wezterm; do - if command -v $terminal >/dev/null 2>&1; then - exec $terminal "$@" - fi +for terminal in $TERMINAL x-terminal-emulator urxvt rxvt st terminology qterminal Eterm aterm uxterm xterm roxterm xfce4-terminal.wrapper mate-terminal lxterminal konsole alacritty kitty wezterm ghostty; do + if command -v $terminal >/dev/null 2>&1; then + exec $terminal "$@" + fi done rofi -e "Failed to find a suitable terminal" From f0ccf4c186697cc33629b8464bf079a7d9a4a768 Mon Sep 17 00:00:00 2001 From: Qball Date: Sun, 30 Mar 2025 15:04:22 +0200 Subject: [PATCH 12/19] [Widget] Add 2 workaround for error in corner radius drawing * Disable AA (works on nvidia) * Disable nvidia workaround. --- doc/rofi-theme.5.markdown | 13 +++++++++---- include/widgets/widget-internal.h | 6 ++++++ source/widgets/widget.c | 12 +++++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/doc/rofi-theme.5.markdown b/doc/rofi-theme.5.markdown index e1fb7ed0..dc0626b4 100644 --- a/doc/rofi-theme.5.markdown +++ b/doc/rofi-theme.5.markdown @@ -964,6 +964,11 @@ The following properties are currently supported: - **border-radius**: padding Sets a radius on the corners of the borders. +- border-aa: boolean + Disable aliasing on the border line. Disabling fixes some drawing issues because of nvidia broken driver workaround. + +- border-disable-nvidia-workaround: boolean + Disable work-around for nvidia driver breaking. - **background-color**: color Background color @@ -985,10 +990,10 @@ The following properties are currently supported: - **transparency**: string Indicating if transparency should be used and what type: - - **real** - True transparency. Only works with a compositor. - - **background** - Take a screenshot of the background image and use that. - - **screenshot** - Take a screenshot of the screen and use that. - - **Path** to png file - Use an image. + - **real** - True transparency. Only works with a compositor. + - **background** - Take a screenshot of the background image and use that. + - **screenshot** - Take a screenshot of the screen and use that. + - **Path** to png file - Use an image. - **location**: position The place of the anchor on the monitor diff --git a/include/widgets/widget-internal.h b/include/widgets/widget-internal.h index 8cc0a295..54870882 100644 --- a/include/widgets/widget-internal.h +++ b/include/widgets/widget-internal.h @@ -83,6 +83,12 @@ struct _widget { gboolean expand; /** Place widget at end of parent */ gboolean end; + + /** enable/disable border aliasing. */ + gboolean border_antialiasing; + /** enable/disable nvisia workaround. */ + gboolean border_disable_nvidia_workaround; + /** Parent widget */ struct _widget *parent; /** Internal */ diff --git a/source/widgets/widget.c b/source/widgets/widget.c index 830c98fa..7e60db8d 100644 --- a/source/widgets/widget.c +++ b/source/widgets/widget.c @@ -24,6 +24,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ +#include "cairo.h" #include "config.h" #include "theme.h" @@ -53,6 +54,10 @@ void widget_init(widget *wid, widget *parent, WidgetType type, // enabled by default wid->enabled = rofi_theme_get_boolean(wid, "enabled", TRUE); + + wid->border_antialiasing = rofi_theme_get_boolean(wid, "border-aa", TRUE); + wid->border_disable_nvidia_workaround = + rofi_theme_get_boolean(wid, "border-disable-nvidia-workaround", FALSE); } void widget_set_state(widget *wid, const char *state) { @@ -251,7 +256,12 @@ void widget_draw(widget *wid, cairo_t *d) { if (left != 0 || top != 0 || right != 0 || bottom != 0) { cairo_save(d); - // cairo_set_operator(d, CAIRO_OPERATOR_ADD); + if (wid->border_antialiasing == FALSE) { + cairo_set_antialias(d, CAIRO_ANTIALIAS_NONE); + } + if (wid->border_disable_nvidia_workaround) { + cairo_set_operator(d, CAIRO_OPERATOR_ADD); + } cairo_translate(d, wid->x, wid->y); cairo_new_path(d); rofi_theme_get_color(wid, "border-color", d); From b35f516556120d82d678cc7b048b9e971d778734 Mon Sep 17 00:00:00 2001 From: Amos Bird Date: Sat, 26 Apr 2025 22:16:51 +0800 Subject: [PATCH 13/19] Add -imdkit config to toggle imdkit at runtime (#2124) --- config/config.c | 2 ++ include/settings.h | 2 ++ source/view.c | 22 ++++++++++++---------- source/xcb.c | 33 ++++++++++++++++++++++----------- source/xrmoptions.c | 6 ++++++ 5 files changed, 44 insertions(+), 21 deletions(-) diff --git a/config/config.c b/config/config.c index 1b9bccac..45381d47 100644 --- a/config/config.c +++ b/config/config.c @@ -179,4 +179,6 @@ Settings config = { .xserver_i300_workaround = FALSE, /** What browser to use for completion */ .completer_mode = "filebrowser", + /** Whether to enable imdkit, see #2123 */ + .enable_imdkit = TRUE, }; diff --git a/include/settings.h b/include/settings.h index 971841f4..285cd7d9 100644 --- a/include/settings.h +++ b/include/settings.h @@ -206,6 +206,8 @@ typedef struct { gboolean xserver_i300_workaround; /** completer mode */ char *completer_mode; + /** Whether to enable imdkit, see #2123 */ + gboolean enable_imdkit; } Settings; /** Default number of lines in the list view */ diff --git a/source/view.c b/source/view.c index f77af637..60afc866 100644 --- a/source/view.c +++ b/source/view.c @@ -1037,12 +1037,12 @@ void __create_window(MenuFlags menu_flags) { xcb_event_masks, map}; #ifdef XCB_IMDKIT - xcb_xim_set_im_callback(xcb->im, &xim_callback, NULL); -#endif + if (config.enable_imdkit) { + xcb_xim_set_im_callback(xcb->im, &xim_callback, NULL); -// Open connection to XIM server. -#ifdef XCB_IMDKIT - xcb_xim_open(xcb->im, open_xim_callback, true, NULL); + // Open connection to XIM server. + xcb_xim_open(xcb->im, open_xim_callback, true, NULL); + } #endif xcb_window_t box_window = xcb_generate_id(xcb->connection); @@ -1440,11 +1440,13 @@ void rofi_view_update(RofiViewState *state, gboolean qr) { widget_draw(WIDGET(state->main_window), d); #ifdef XCB_IMDKIT - int x = widget_get_x_pos(&state->text->widget) + - textbox_get_cursor_x_pos(state->text); - int y = widget_get_y_pos(&state->text->widget) + - widget_get_height(&state->text->widget); - rofi_set_im_window_pos(x, y); + if (config.enable_imdkit) { + int x = widget_get_x_pos(&state->text->widget) + + textbox_get_cursor_x_pos(state->text); + int y = widget_get_y_pos(&state->text->widget) + + widget_get_height(&state->text->widget); + rofi_set_im_window_pos(x, y); + } #endif TICK_N("widgets"); diff --git a/source/xcb.c b/source/xcb.c index 6b2d9e0b..852dde0e 100644 --- a/source/xcb.c +++ b/source/xcb.c @@ -1373,7 +1373,7 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) { case XCB_KEY_PRESS: { xcb_key_press_event_t *xkpe = (xcb_key_press_event_t *)event; #ifdef XCB_IMDKIT - if (xcb->ic) { + if (config.enable_imdkit && xcb->ic) { g_log("IMDKit", G_LOG_LEVEL_DEBUG, "press key %d to xim", xkpe->detail); xcb_xim_forward_event(xcb->im, xcb->ic, xkpe); return; @@ -1387,7 +1387,7 @@ static void main_loop_x11_event_handler_view(xcb_generic_event_t *event) { case XCB_KEY_RELEASE: { xcb_key_release_event_t *xkre = (xcb_key_release_event_t *)event; #ifdef XCB_IMDKIT - if (xcb->ic) { + if (config.enable_imdkit && xcb->ic) { g_log("IMDKit", G_LOG_LEVEL_DEBUG, "release key %d to xim", xkre->detail); // Check if the keysym is a modifier key (e.g., Shift, Ctrl, Alt). If it @@ -1452,7 +1452,7 @@ static gboolean main_loop_x11_event_handler(xcb_generic_event_t *ev, } #ifdef XCB_IMDKIT - if (xcb->im && xcb_xim_filter_event(xcb->im, ev)) + if (config.enable_imdkit && xcb->im && xcb_xim_filter_event(xcb->im, ev)) return G_SOURCE_CONTINUE; #endif @@ -1675,7 +1675,9 @@ gboolean display_setup(GMainLoop *main_loop, NkBindings *bindings) { xcb->main_loop = main_loop; #ifdef XCB_IMDKIT - xcb_compound_text_init(); + if (config.enable_imdkit) { + xcb_compound_text_init(); + } #endif xcb->source = g_water_xcb_source_new(g_main_loop_get_context(xcb->main_loop), display_str, &xcb->screen_nbr, @@ -1686,14 +1688,21 @@ gboolean display_setup(GMainLoop *main_loop, NkBindings *bindings) { } xcb->connection = g_water_xcb_source_get_connection(xcb->source); #ifdef XCB_IMDKIT - xcb->im = xcb_xim_create(xcb->connection, xcb->screen_nbr, NULL); - xcb->syms = xcb_key_symbols_alloc(xcb->connection); + if (config.enable_imdkit) { + xcb->im = xcb_xim_create(xcb->connection, xcb->screen_nbr, NULL); + xcb->syms = xcb_key_symbols_alloc(xcb->connection); + } else { + xcb->im = NULL; + xcb->syms = NULL; + } #endif #ifdef XCB_IMDKIT #ifndef XCB_IMDKIT_1_0_3_LOWER - xcb_xim_set_use_compound_text(xcb->im, true); - xcb_xim_set_use_utf8_string(xcb->im, true); + if (config.enable_imdkit) { + xcb_xim_set_use_compound_text(xcb->im, true); + xcb_xim_set_use_utf8_string(xcb->im, true); + } #endif #endif @@ -1966,9 +1975,11 @@ void display_cleanup(void) { xcb_flush(xcb->connection); xcb_aux_sync(xcb->connection); #ifdef XCB_IMDKIT - xcb_xim_close(xcb->im); - xcb_xim_destroy(xcb->im); - xcb->im = NULL; + if (config.enable_imdkit) { + xcb_xim_close(xcb->im); + xcb_xim_destroy(xcb->im); + xcb->im = NULL; + } #endif g_water_xcb_source_free(xcb->source); xcb->source = NULL; diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 692124f9..2306a2ce 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -501,6 +501,12 @@ static XrmOption xrmOptions[] = { NULL, "What completer to use for drun/run.", CONFIG_DEFAULT}, + {xrm_Boolean, + "imdkit", + {.snum = &config.enable_imdkit}, + NULL, + "Whether to enable imdkit", + CONFIG_DEFAULT}, }; /** Dynamic array of extra options */ From c645bdeab9b023523186e694a6b5e916f5c86591 Mon Sep 17 00:00:00 2001 From: Qball Date: Sat, 17 May 2025 15:07:31 +0200 Subject: [PATCH 14/19] Add initial release notes for 1.7.9. --- releasenotes/1.7.9/release-1.7.9.markdown | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 releasenotes/1.7.9/release-1.7.9.markdown diff --git a/releasenotes/1.7.9/release-1.7.9.markdown b/releasenotes/1.7.9/release-1.7.9.markdown new file mode 100644 index 00000000..3a6c995e --- /dev/null +++ b/releasenotes/1.7.9/release-1.7.9.markdown @@ -0,0 +1,28 @@ +# 1.7.9 + +## Changelog + +* Add -imdkit config to toggle imdkit at runtime (#2124) (thx Amos Bird) +* [Widget] Add 2 workaround for error in corner radius drawing +* [rofi-sensible-terminal] Add ghostty (#2110) +* [scrollbar] Add theming for rounded corners (#2108) (thx J0hannes101) +* [DOC] Fix indenting of sub-bullets as mkdocs interpets them differently (#2112) +* Fix typo in fullscreen-preview.rasi (#2113) (thx elig0n) +* Add theming to hide text cursor if no text is put in (#2106) (thx J0hannes101) +* [DRUN] Add option to exclude categories from drun #2102 (#2104) (thx J0hannes101) +* [XCB] Don't keep casting from int to double to int +* [Helper] Add a rofi_fallthrough macro to tell compiler fallthrough is intentional +* [View] xcb_clear_area fixed wrong argument order. +* [DRun] Better handling of corrupted cache file. +* Fix broken Pango link (#2096) (thx Emil) +* [NKUtils] Drop support for binding Meta key. (#2095) +* [View] Allow cycling through matching methods (#2091) +* Fix wrong pointer `-replace` and small cleanup. +* [Textbox] Small signedness fixes for password mask code. +* [dmenu] Modified textbox password masking (#2067) (thx Zebra2711) +* add smartcase support like vim (#2060) (thx Phanium) +* [Mode] Fix wrong documentation header. +* Execute custom user commands or scripts on a variety of rofi events (#2053) (thx giomatfois62) +* Add option to enable the `kb-delete-entry` in script mode (#2087) (thx Tiou Lims) +* [Window] Allow active window to be sorted on top. (#2048) +* [Lexer] Allow for optional imports. (#2078) From 54411627a92717d2f521f0d25c82a52b7d1a2ddb Mon Sep 17 00:00:00 2001 From: Qball Date: Sat, 17 May 2025 19:24:15 +0200 Subject: [PATCH 15/19] More releasenote updates. --- releasenotes/1.7.9/release-1.7.9.markdown | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/releasenotes/1.7.9/release-1.7.9.markdown b/releasenotes/1.7.9/release-1.7.9.markdown index 3a6c995e..3da1038a 100644 --- a/releasenotes/1.7.9/release-1.7.9.markdown +++ b/releasenotes/1.7.9/release-1.7.9.markdown @@ -1,5 +1,31 @@ # 1.7.9 +## Custom commands on events + +Giomatfois62 added a nice feature that you can execute a custom command on different events. +For example play a sound on moving around. + +This pull request addresses issue #2032, making it possible to execute custom user commands or scripts on a variety of rofi events. The following events are covered for now: + +See the rofi-actions(5) manpage for more information. + +## NVidia workaround workaround + +Because of oddness in nvidia drivers, we had an issue the whole screen turned +black if we used the 'over' operator in cairo. Working around this caused some +drawing issues with anti-aliasing. There now exists two flags to to work around +this workaround again. Either disable the workaround, or disable anti-aliasing. + +## IMDKit runtime disable option + +Because IMDKit can break some keybindings, this can now be disabled at runtime. +For example if you try to bind only the 'Super' key, this can fix this. + +## Smartcase support + +Thanks to Phanium, rofi now supports Vim style 'smartcase'. Can be enabled +using `-case-smart`. + ## Changelog * Add -imdkit config to toggle imdkit at runtime (#2124) (thx Amos Bird) From 709faac842cb2381b5d60602fa7794ecd05d8fe7 Mon Sep 17 00:00:00 2001 From: Qball Date: Sun, 18 May 2025 11:43:33 +0200 Subject: [PATCH 16/19] Add `rofi-actions` to website and update releasenotes. --- mkdocs/docs/current/rofi-actions.5.markdown | 1 + releasenotes/1.7.9/release-1.7.9.markdown | 32 +++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) create mode 120000 mkdocs/docs/current/rofi-actions.5.markdown diff --git a/mkdocs/docs/current/rofi-actions.5.markdown b/mkdocs/docs/current/rofi-actions.5.markdown new file mode 120000 index 00000000..a9c62270 --- /dev/null +++ b/mkdocs/docs/current/rofi-actions.5.markdown @@ -0,0 +1 @@ +../../../doc/rofi-actions.5.markdown \ No newline at end of file diff --git a/releasenotes/1.7.9/release-1.7.9.markdown b/releasenotes/1.7.9/release-1.7.9.markdown index 3da1038a..58c15e20 100644 --- a/releasenotes/1.7.9/release-1.7.9.markdown +++ b/releasenotes/1.7.9/release-1.7.9.markdown @@ -2,12 +2,12 @@ ## Custom commands on events -Giomatfois62 added a nice feature that you can execute a custom command on different events. -For example play a sound on moving around. +Giomatfois62 added a nice feature that allows you to execute a custom command +on different events. For example play a sound when accepting an entry. -This pull request addresses issue #2032, making it possible to execute custom user commands or scripts on a variety of rofi events. The following events are covered for now: - -See the rofi-actions(5) manpage for more information. +See the +[rofi-actions(5)](https://github.com/davatorium/rofi/blob/1.7.9/doc/rofi-actions.5.markdown) +manpage for more information. ## NVidia workaround workaround @@ -16,16 +16,38 @@ black if we used the 'over' operator in cairo. Working around this caused some drawing issues with anti-aliasing. There now exists two flags to to work around this workaround again. Either disable the workaround, or disable anti-aliasing. +You can set these options per widget: + +```css +widget { + border-disable-nvidia-workaround: true; + border-aa: false; +} +``` + +It's recommended to set it globally. + +```css +* { + border-disable-nvidia-workaround: true; + border-aa: false; +} +``` + ## IMDKit runtime disable option Because IMDKit can break some keybindings, this can now be disabled at runtime. For example if you try to bind only the 'Super' key, this can fix this. +For more information, see issue: #2124 + ## Smartcase support Thanks to Phanium, rofi now supports Vim style 'smartcase'. Can be enabled using `-case-smart`. +Fore more information, see issue: #2060 + ## Changelog * Add -imdkit config to toggle imdkit at runtime (#2124) (thx Amos Bird) From c873b37119b3a8fd33102cca1991e572344f8b0e Mon Sep 17 00:00:00 2001 From: Qball Date: Sun, 18 May 2025 11:48:43 +0200 Subject: [PATCH 17/19] [MKDocs] More updates to menu structure. --- mkdocs/docs/index.md | 16 +++++++++------- mkdocs/mkdocs.yml | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mkdocs/docs/index.md b/mkdocs/docs/index.md index a7a9a71a..244563bc 100644 --- a/mkdocs/docs/index.md +++ b/mkdocs/docs/index.md @@ -11,7 +11,6 @@ The manpages are grouped on rofi version. - [Themes](themes/themes.md) - [User scripts (wiki)](https://github.com/davatorium/rofi/wiki/User-scripts) - ## Development version - [Rofi manpage](current/rofi.1.markdown) @@ -20,15 +19,18 @@ The manpages are grouped on rofi version. - [Script](current/rofi-script.5.markdown) - [Debugging](current/rofi-debugging.5.markdown) - [Keys](current/rofi-keys.5.markdown) +- [Actions](current/rofi-actions.5.markdown) +- [Thumbnails](current/rofi-thumbnails.5.markdown) ## Stable -- [Rofi manpage](1.7.5/rofi.1.markdown) -- [Themes](1.7.5/rofi-theme.5.markdown) -- [Dmenu](1.7.5/rofi-dmenu.5.markdown) -- [Script](1.7.5/rofi-script.5.markdown) -- [Debugging](1.7.5/rofi-debugging.5.markdown) -- [Keys](1.7.5/rofi-keys.5.markdown) +- [Rofi manpage](1.7.8/rofi.1.markdown) +- [Themes](1.7.8/rofi-theme.5.markdown) +- [Dmenu](1.7.8/rofi-dmenu.5.markdown) +- [Script](1.7.8/rofi-script.5.markdown) +- [Debugging](1.7.8/rofi-debugging.5.markdown) +- [Keys](1.7.8/rofi-keys.5.markdown) +- [Thumbnails](1.7.8/rofi-thumbnails.5.markdown) ## Guides diff --git a/mkdocs/mkdocs.yml b/mkdocs/mkdocs.yml index e90154d9..4ca030c5 100644 --- a/mkdocs/mkdocs.yml +++ b/mkdocs/mkdocs.yml @@ -23,6 +23,7 @@ nav: - Debugging: current/rofi-debugging.5.markdown - Keys: current/rofi-keys.5.markdown - Thumbnails: current/rofi-thumbnails.5.markdown + - Actions: current/rofi-actions.5.markdown - 1.7.8: - Rofi: 1.7.8/rofi.1.markdown - Themes: 1.7.8/rofi-theme.5.markdown From 4b41e4e8df20339adae5f3fc24f6a3a63704c22e Mon Sep 17 00:00:00 2001 From: Qball Date: Sun, 18 May 2025 12:12:15 +0200 Subject: [PATCH 18/19] [MKDocs] Update Downloads page with missing releases. --- mkdocs/docs/downloads.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mkdocs/docs/downloads.md b/mkdocs/docs/downloads.md index 35f75bc8..713615d5 100644 --- a/mkdocs/docs/downloads.md +++ b/mkdocs/docs/downloads.md @@ -6,6 +6,16 @@ For development no tarball is released. Please follow the [Installation](../INSTALL/) instructions for obtaining and compiling development version. +## [1.7.8](https://github.com/davatorium/rofi/releases/tag/1.7.8) + +- [tar.gz](https://github.com/davatorium/rofi/releases/download/1.7.8/rofi-1.7.8.tar.gz) +- [tar.xz](https://github.com/davatorium/rofi/releases/download/1.7.8/rofi-1.7.8.tar.xz) + +## [1.7.7](https://github.com/davatorium/rofi/releases/tag/1.7.7) + +- [tar.gz](https://github.com/davatorium/rofi/releases/download/1.7.7/rofi-1.7.7.tar.gz) +- [tar.xz](https://github.com/davatorium/rofi/releases/download/1.7.7/rofi-1.7.7.tar.xz) + ## [1.7.6](https://github.com/davatorium/rofi/releases/tag/1.7.6) - [tar.gz](https://github.com/davatorium/rofi/releases/download/1.7.6/rofi-1.7.6.tar.gz) From b5e1494fccd5f5eaf9e72fb3cdc5f4d8b8b86165 Mon Sep 17 00:00:00 2001 From: Qball Date: Sun, 18 May 2025 19:01:00 +0200 Subject: [PATCH 19/19] Bump release to 1.7.9 --- README.md | 2 + configure.ac | 2 +- meson.build | 2 +- mkdocs/docs/1.7.9/rofi-actions.5.markdown | 89 + mkdocs/docs/1.7.9/rofi-debugging.5.markdown | 177 ++ mkdocs/docs/1.7.9/rofi-dmenu.5.markdown | 245 +++ mkdocs/docs/1.7.9/rofi-keys.5.markdown | 588 ++++++ mkdocs/docs/1.7.9/rofi-script.5.markdown | 217 +++ mkdocs/docs/1.7.9/rofi-theme.5.markdown | 1690 ++++++++++++++++++ mkdocs/docs/1.7.9/rofi-thumbnails.5.markdown | 85 + mkdocs/docs/1.7.9/rofi.1.markdown | 1201 +++++++++++++ mkdocs/docs/downloads.md | 5 + mkdocs/docs/index.md | 14 +- mkdocs/mkdocs.yml | 8 + 14 files changed, 4316 insertions(+), 9 deletions(-) create mode 100644 mkdocs/docs/1.7.9/rofi-actions.5.markdown create mode 100644 mkdocs/docs/1.7.9/rofi-debugging.5.markdown create mode 100644 mkdocs/docs/1.7.9/rofi-dmenu.5.markdown create mode 100644 mkdocs/docs/1.7.9/rofi-keys.5.markdown create mode 100644 mkdocs/docs/1.7.9/rofi-script.5.markdown create mode 100644 mkdocs/docs/1.7.9/rofi-theme.5.markdown create mode 100644 mkdocs/docs/1.7.9/rofi-thumbnails.5.markdown create mode 100644 mkdocs/docs/1.7.9/rofi.1.markdown diff --git a/README.md b/README.md index 49dafa53..57b4c8e0 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ **Please match the documentation and scripts to the version of rofi used** - [next version](https://github.com/davatorium/rofi) +- [1.7.9](https://github.com/davatorium/rofi/tree/1.7.9) +- [1.7.8](https://github.com/davatorium/rofi/tree/1.7.8) - [1.7.7](https://github.com/davatorium/rofi/tree/1.7.7) - [1.7.6](https://github.com/davatorium/rofi/tree/1.7.6) - [1.7.5](https://github.com/davatorium/rofi/tree/1.7.5) diff --git a/configure.ac b/configure.ac index f5b9f4e0..e9206907 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([rofi], [1.7.8-dev], [https://github.com/davatorium/rofi/],[],[https://github.com/davatorium/rofi/discussions]) +AC_INIT([rofi], [1.7.9], [https://github.com/davatorium/rofi/],[],[https://github.com/davatorium/rofi/discussions]) AC_CONFIG_SRCDIR([source/rofi.c]) AC_CONFIG_HEADER([config.h]) diff --git a/meson.build b/meson.build index e54eec0c..eb1dfc44 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('rofi', 'c', - version: '1.7.8-dev', + version: '1.7.9', meson_version: '>=0.59.0', license: [ 'MIT' ], default_options: [ diff --git a/mkdocs/docs/1.7.9/rofi-actions.5.markdown b/mkdocs/docs/1.7.9/rofi-actions.5.markdown new file mode 100644 index 00000000..01f42f01 --- /dev/null +++ b/mkdocs/docs/1.7.9/rofi-actions.5.markdown @@ -0,0 +1,89 @@ +# rofi-actions(5) + +## NAME + +**rofi-actions** - Custom commands following interaction with rofi menus + +## DESCRIPTION + +**rofi** allows to set custom commands or scripts to be executed when some actions are performed in the menu, such as changing selection, accepting an entry or canceling. + +This makes it possible for example to play sound effects or read aloud menu entries on selection. + +## USAGE + +Following is the list of rofi flags for specifying custom commands or scripts to execute on supported actions: + +`-on-selection-changed` *cmd* + +Command or script to run when the current selection changes. Selected text is forwarded to the command replacing the pattern *{entry}*. + +`-on-entry-accepted` *cmd* + +Command or script to run when a menu entry is accepted. Accepted text is forwarded to the command replacing the pattern *{entry}*. + +`-on-mode-changed` *cmd* + +Command or script to run when the menu mode (e.g. drun,window,ssh...) is changed. + +`-on-menu-canceled` *cmd* + +Command or script to run when the menu is canceled. + +`-on-menu-error` *cmd* + +Command or script to run when an error menu is shown (e.g. `rofi -e "error message"`). Error text is forwarded to the command replacing the pattern *{error}*. + +`-on-screenshot-taken` *cmd* + +Command or script to run when a screenshot of rofi is taken. Screenshot path is forwarded to the command replacing the pattern *{path}*. + +### Example usage + +Rofi command line: + +```bash +rofi -on-selection-changed "/path/to/select.sh {entry}" \ + -on-entry-accepted "/path/to/accept.sh {entry}" \ + -on-menu-canceled "/path/to/exit.sh" \ + -on-mode-changed "/path/to/change.sh" \ + -on-menu-error "/path/to/error.sh {error}" \ + -on-screenshot-taken "/path/to/camera.sh {path}" \ + -show drun +``` + +Rofi config file: + +```css +configuration { + on-selection-changed: "/path/to/select.sh {entry}"; + on-entry-accepted: "/path/to/accept.sh {entry}"; + on-menu-canceled: "/path/to/exit.sh"; + on-mode-changed: "/path/to/change.sh"; + on-menu-error: "/path/to/error.sh {error}"; + on-screenshot-taken: "/path/to/camera.sh {path}"; +} +``` + +### Play sound effects + +Here's an example bash script that plays a sound effect using `aplay` when the current selection is changed: + +```bash +#!/bin/bash + +coproc aplay -q $HOME/Music/selecting_an_item.wav +``` + +The use of `coproc` for playing sounds is suggested, otherwise the rofi process will wait for sounds to end playback before exiting. + +### Read aloud + +Here's an example bash script that reads aloud currently selected entries using `espeak`: + +```bash +#!/bin/bash + +killall espeak +echo "selected: $@" | espeak +``` diff --git a/mkdocs/docs/1.7.9/rofi-debugging.5.markdown b/mkdocs/docs/1.7.9/rofi-debugging.5.markdown new file mode 100644 index 00000000..4df15d52 --- /dev/null +++ b/mkdocs/docs/1.7.9/rofi-debugging.5.markdown @@ -0,0 +1,177 @@ +# rofi-debugging(5) + +## NAME + +Debugging rofi. + +When reporting an issue with rofi crashing, or misbehaving. It helps to do some +small test to help pin-point the problem. + +First try disabling your custom configuration: `-no-config` + +This disables the parsing of the configuration files. This runs rofi in *stock* +mode. + +If you run custom C plugins, you can disable the plugins using: `-no-plugins` + +## Get the relevant information for an issue + +Please pastebin the output of the following commands: + +```bash +rofi -help +rofi -dump-config +rofi -dump-theme +``` + +`rofi -help` provides us with the configuration files parsed, the exact +version, monitor layout and more useful information. + +The `rofi -dump-config` and `rofi -dump-theme` output gives us `rofi` +interpretation of your configuration and theme. + +Please check the output for identifiable information and remove this. + +## Timing traces + +To get a timing trace, enable the **Timings** debug domain. + +```bash +G_MESSAGES_DEBUG=Timings rofi -show drun +``` +It will show a trace with (useful) timing information at relevant points during +the execution. This will help debugging when rofi is slow to start. + +Example trace: + +```text +(process:14942): Timings-DEBUG: 13:47:39.335: 0.000000 (0.000000): Started +(process:14942): Timings-DEBUG: 13:47:39.335: 0.000126 (0.000126): ../source/rofi.c:main:786 +(process:14942): Timings-DEBUG: 13:47:39.335: 0.000163 (0.000037): ../source/rofi.c:main:819 +(process:14942): Timings-DEBUG: 13:47:39.336: 0.000219 (0.000056): ../source/rofi.c:main:826 Setup Locale +(process:14942): Timings-DEBUG: 13:47:39.337: 0.001235 (0.001016): ../source/rofi.c:main:828 Collect MODI +(process:14942): Timings-DEBUG: 13:47:39.337: 0.001264 (0.000029): ../source/rofi.c:main:830 Setup MODI +(process:14942): Timings-DEBUG: 13:47:39.337: 0.001283 (0.000019): ../source/rofi.c:main:834 Setup mainloop +(process:14942): Timings-DEBUG: 13:47:39.337: 0.001369 (0.000086): ../source/rofi.c:main:837 NK Bindings +(process:14942): Timings-DEBUG: 13:47:39.337: 0.001512 (0.000143): ../source/xcb.c:display_setup:1177 Open Display +(process:14942): Timings-DEBUG: 13:47:39.337: 0.001829 (0.000317): ../source/xcb.c:display_setup:1192 Setup XCB +(process:14942): Timings-DEBUG: 13:47:39.346: 0.010650 (0.008821): ../source/rofi.c:main:844 Setup Display +(process:14942): Timings-DEBUG: 13:47:39.346: 0.010715 (0.000065): ../source/rofi.c:main:848 Setup abe +(process:14942): Timings-DEBUG: 13:47:39.350: 0.015101 (0.004386): ../source/rofi.c:main:883 Load cmd config +(process:14942): Timings-DEBUG: 13:47:39.351: 0.015275 (0.000174): ../source/rofi.c:main:907 Setup Modi +(process:14942): Timings-DEBUG: 13:47:39.351: 0.015291 (0.000016): ../source/view.c:rofi_view_workers_initialize:1922 Setup Threadpool, start +(process:14942): Timings-DEBUG: 13:47:39.351: 0.015349 (0.000058): ../source/view.c:rofi_view_workers_initialize:1945 Setup Threadpool, done +(process:14942): Timings-DEBUG: 13:47:39.367: 0.032018 (0.016669): ../source/rofi.c:main:1000 Setup late Display +(process:14942): Timings-DEBUG: 13:47:39.367: 0.032080 (0.000062): ../source/rofi.c:main:1003 Theme setup +(process:14942): Timings-DEBUG: 13:47:39.367: 0.032109 (0.000029): ../source/rofi.c:startup:668 Startup +(process:14942): Timings-DEBUG: 13:47:39.367: 0.032121 (0.000012): ../source/rofi.c:startup:677 Grab keyboard +(process:14942): Timings-DEBUG: 13:47:39.368: 0.032214 (0.000093): ../source/view.c:__create_window:701 xcb create window +(process:14942): Timings-DEBUG: 13:47:39.368: 0.032235 (0.000021): ../source/view.c:__create_window:705 xcb create gc +(process:14942): Timings-DEBUG: 13:47:39.368: 0.033136 (0.000901): ../source/view.c:__create_window:714 create cairo surface +(process:14942): Timings-DEBUG: 13:47:39.369: 0.033286 (0.000150): ../source/view.c:__create_window:723 pango cairo font setup +(process:14942): Timings-DEBUG: 13:47:39.369: 0.033351 (0.000065): ../source/view.c:__create_window:761 configure font +(process:14942): Timings-DEBUG: 13:47:39.381: 0.045896 (0.012545): ../source/view.c:__create_window:769 textbox setup +(process:14942): Timings-DEBUG: 13:47:39.381: 0.045944 (0.000048): ../source/view.c:__create_window:781 setup window attributes +(process:14942): Timings-DEBUG: 13:47:39.381: 0.045955 (0.000011): ../source/view.c:__create_window:791 setup window fullscreen +(process:14942): Timings-DEBUG: 13:47:39.381: 0.045966 (0.000011): ../source/view.c:__create_window:797 setup window name and class +(process:14942): Timings-DEBUG: 13:47:39.381: 0.045974 (0.000008): ../source/view.c:__create_window:808 setup startup notification +(process:14942): Timings-DEBUG: 13:47:39.381: 0.045981 (0.000007): ../source/view.c:__create_window:810 done +(process:14942): Timings-DEBUG: 13:47:39.381: 0.045992 (0.000011): ../source/rofi.c:startup:679 Create Window +(process:14942): Timings-DEBUG: 13:47:39.381: 0.045999 (0.000007): ../source/rofi.c:startup:681 Parse ABE +(process:14942): Timings-DEBUG: 13:47:39.381: 0.046113 (0.000114): ../source/rofi.c:startup:684 Config sanity check +(process:14942): Timings-DEBUG: 13:47:39.384: 0.048229 (0.002116): ../source/dialogs/run.c:get_apps:216 start +(process:14942): Timings-DEBUG: 13:47:39.390: 0.054626 (0.006397): ../source/dialogs/run.c:get_apps:336 stop +(process:14942): Timings-DEBUG: 13:47:39.390: 0.054781 (0.000155): ../source/dialogs/drun.c:get_apps:634 Get Desktop apps (start) +(process:14942): Timings-DEBUG: 13:47:39.391: 0.055264 (0.000483): ../source/dialogs/drun.c:get_apps:641 Get Desktop apps (user dir) +(process:14942): Timings-DEBUG: 13:47:39.418: 0.082884 (0.027620): ../source/dialogs/drun.c:get_apps:659 Get Desktop apps (system dirs) +(process:14942): Timings-DEBUG: 13:47:39.418: 0.082944 (0.000060): ../source/dialogs/drun.c:get_apps_history:597 Start drun history +(process:14942): Timings-DEBUG: 13:47:39.418: 0.082977 (0.000033): ../source/dialogs/drun.c:get_apps_history:617 Stop drun history +(process:14942): Timings-DEBUG: 13:47:39.419: 0.083638 (0.000661): ../source/dialogs/drun.c:get_apps:664 Sorting done. +(process:14942): Timings-DEBUG: 13:47:39.419: 0.083685 (0.000047): ../source/view.c:rofi_view_create:1759 +(process:14942): Timings-DEBUG: 13:47:39.419: 0.083700 (0.000015): ../source/view.c:rofi_view_create:1783 Startup notification +(process:14942): Timings-DEBUG: 13:47:39.419: 0.083711 (0.000011): ../source/view.c:rofi_view_create:1786 Get active monitor +(process:14942): Timings-DEBUG: 13:47:39.420: 0.084693 (0.000982): ../source/view.c:rofi_view_refilter:1028 Filter start +(process:14942): Timings-DEBUG: 13:47:39.421: 0.085992 (0.001299): ../source/view.c:rofi_view_refilter:1132 Filter done +(process:14942): Timings-DEBUG: 13:47:39.421: 0.086090 (0.000098): ../source/view.c:rofi_view_update:982 +(process:14942): Timings-DEBUG: 13:47:39.421: 0.086123 (0.000033): ../source/view.c:rofi_view_update:1002 Background +(process:14942): Timings-DEBUG: 13:47:39.428: 0.092864 (0.006741): ../source/view.c:rofi_view_update:1008 widgets +``` + +## Debug domains + +To further debug the plugin, you can get a trace with (lots of) debug +information. This debug output can be enabled for multiple parts in rofi using +the glib debug framework. Debug domains can be enabled by setting the +G\_MESSAGES\_DEBUG environment variable. At the time of creation of this page, +the following debug domains exist: + +- all: Show debug information from all domains. +- X11Helper: The X11 Helper functions. +- View: The main window view functions. +- Widgets.Box: The Box widget. +- Modes.DMenu: The dmenu mode. +- Modes.Run: The run mode. +- Modes.DRun: The desktop file run mode. +- Modes.Window: The window mode. +- Modes.Script: The script mode. +- Modes.Combi: The script mode. +- Modes.Ssh: The ssh mode. +- Rofi: The main application. +- Timings: Get timing output. +- Theme: Theme engine debug output. (warning lots of output). +- Widgets.Icon: The Icon widget. +- Widgets.Box: The box widget. +- Widgets.Container: The container widget. +- Widgets.Window: The window widget. +- Helpers.IconFetcher: Information about icon lookup. + +For full list see `man rofi`. + +Example: `G_MESSAGES_DEBUG=Dialogs.DRun rofi -show drun` To get specific output +from the Desktop file run dialog. + +To redirect the debug output to a file (`~/rofi.log`) add: + +```bash +rofi -show drun -log ~/rofi.log +``` + +Specifying the logfile automatically enabled all log domains. +This can be useful when rofi is launched from a window manager. + +## Creating a backtrace + +First make sure you compile **rofi** with debug symbols: + +```bash +make CFLAGS="-O0 -g3" clean rofi +``` + +Getting a backtrace using GDB is not very handy. Because if rofi get stuck, it +grabs keyboard and mouse. So if it crashes in GDB you are stuck. The best way +to go is to enable core file. (ulimit -c unlimited in bash) then make rofi +crash. You can then load the core in GDB. + +```bash +gdb rofi core +``` + +Then type inside gdb: + +```bash +thread apply all bt +``` + +The output trace is useful when reporting crashes. + +Some distribution have `systemd-coredump`, this way you can easily get a +backtrace via `coredumpctl`. + +## SEE ALSO + +rofi-sensible-terminal(1), dmenu(1), rofi-theme(5), +rofi-script(5), rofi-keys(5),rofi-theme-selector(1) + +## AUTHOR + +* Qball Cow diff --git a/mkdocs/docs/1.7.9/rofi-dmenu.5.markdown b/mkdocs/docs/1.7.9/rofi-dmenu.5.markdown new file mode 100644 index 00000000..0a272c17 --- /dev/null +++ b/mkdocs/docs/1.7.9/rofi-dmenu.5.markdown @@ -0,0 +1,245 @@ +# rofi-dmenu(5) + +## NAME + +**rofi dmenu mode** - Rofi dmenu emulation + +## DESCRIPTION + +To integrate **rofi** into scripts as simple selection dialogs, +**rofi** supports emulating **dmenu(1)** (A dynamic menu for X11). + +The website for `dmenu` can be found [here](http://tools.suckless.org/dmenu/). + +**rofi** does not aim to be 100% compatible with `dmenu`. There are simply too +many flavors of `dmenu`. The idea is that the basic usage command-line flags +are obeyed, theme-related flags are not. Besides, **rofi** offers some extended +features (like multi-select, highlighting, message bar, extra key bindings). + +## BASIC CONCEPT + +In `dmenu` mode, **rofi** reads data from standard in, splits them into +separate entries and displays them. If the user selects a row, this is printed +out to standard out, allowing the script to process it further. + +By default separation of rows is done on new lines, making it easy to pipe the +output a one application into **rofi** and the output of rofi into the next. + +## USAGE + +By launching **rofi** with the `-dmenu` flag it will go into dmenu emulation +mode. + +```bash +ls | rofi -dmenu +``` + +### DMENU DROP-IN REPLACEMENT + +If `argv[0]` (calling command) is dmenu, **rofi** will start in dmenu mode. +This way, it can be used as a drop-in replacement for dmenu. Just copy or +symlink **rofi** to dmenu in `$PATH`. + +```bash +ln -s /usr/bin/rofi /usr/bin/dmenu +``` + +### DMENU VS SCRIPT MODE + +Script mode is used to extend **rofi**, dmenu mode is used to extend a script. +The two do share much of the same input format. Please see the +**rofi-script(5)** manpage for more information. + +### DMENU SPECIFIC COMMANDLINE FLAGS + +A lot of these options can also be modified by the script using special input. +See the **rofi-script(5)** manpage for more information about this syntax. + +`-sep` *separator* + +Separator for `dmenu`. Example: To show a list of 'a' to 'e' with '|' as a +separator: + +```bash +echo "a|b|c|d|e" | rofi -sep '|' -dmenu +``` + +`-p` *prompt* + +Specify the prompt to show in `dmenu` mode. For example, select 'monkey', +a,b,c,d, or e. + +```bash +echo "a|b|c|d|e" | rofi -sep '|' -dmenu -p "monkey" +``` + +Default: *dmenu* + +`-l` *number of lines to show* + +Maximum number of lines the menu may show before scrolling. + +```bash +rofi -dmenu -l 25 +``` + +Default: *15* + +`-i` + +Makes `dmenu` searches case-insensitive + +`-a` *X* + +Active row, mark *X* as active. Where *X* is a comma-separated list of +python(1)-style indices and ranges, e.g. indices start at 0, -1 refers to the +last row with -2 preceding it, ranges are left-open and right-close, and so on. +You can specify: + +- A single row: '5' +- A range of (last 3) rows: '-3:' +- 4 rows starting from row 7: '7:11' (or in legacy notation: '7-10') +- A set of rows: '2,0,-9' +- Or any combination: '5,-3:,7:11,2,0,-9' + +`-u` *X* + +Urgent row, mark *X* as urgent. See `-a` option for details. + +`-only-match` + +Only return a selected item, do not allow custom entry. +This mode always returns an entry. It will not return if no matching entry is +selected. + +`-no-custom` + +Only return a selected item, do not allow custom entry. +This mode returns directly when no entries given. + +`-format` *format* + +Allows the output of dmenu to be customized (N is the total number of input +entries): + +- 's' selected string +- 'i' index (0 - (N-1)) +- 'd' index (1 - N) +- 'q' quote string +- 'p' Selected string stripped from Pango markup (Needs to be a valid string) +- 'f' filter string (user input) +- 'F' quoted filter string (user input) + +Default: 's' + +`-select` *string* + +Select first line that matches the given string + +`-mesg` *string* + +Add a message line below the filter entry box. Supports Pango markup. For more +information on supported markup, see +[here](https://docs.gtk.org/Pango/pango_markup.html) + +`-dump` + +Dump the filtered list to stdout and quit. +This can be used to get the list as **rofi** would filter it. +Use together with `-filter` command. + +`-input` *file* + +Reads from *file* instead of stdin. + +`-password` + +Hide the input text. This should not be considered secure! + +`-markup-rows` + +Tell **rofi** that DMenu input is Pango markup encoded, and should be rendered. +See [here](https://docs.gtk.org/Pango/pango_markup.html) +for details about Pango markup. + +`-multi-select` + +Allow multiple lines to be selected. Adds a small selection indicator to the +left of each entry. + +`-sync` + +Force **rofi** mode to first read all data from stdin before showing the +selection window. This is original dmenu behavior. + +Note: the default asynchronous mode will also be automatically disabled if used +with conflicting options, +such as `-dump`, `-only-match` or `-auto-select`. + +`-window-title` *title* + +Set name used for the window title. Will be shown as Rofi - *title* + +`-w` *windowid* + +Position **rofi** over the window with the given X11 window ID. + +`-keep-right` + +Set ellipsize mode to start. So, the end of the string is visible. + +`-display-columns` + +A comma seperated list of columns to show. + +`-display-column-separator` + +The column separator. This is a regex. + +*default*: '\t' + +`-ballot-selected-str` *string* + +When multi-select is enabled, prefix this string when element is selected. + +*default*: "☑ " + +`-ballot-unselected-str` *string* + +When multi-select is enabled, prefix this string when element is not selected. + +*default*: "☐ " + +`-ellipsize-mode` (start|middle|end) + +Set ellipsize mode on the listview. + +*default* "end" + +## PARSING ROW OPTIONS + +Extra options for individual rows can be also set. See the **rofi-script(5)** +manpage for details; the syntax and supported features are identical. + +## RETURN VALUE + +- **0**: Row has been selected accepted by user. +- **1**: User cancelled the selection. +- **10-28**: Row accepted by custom keybinding. + +## SEE ALSO + +rofi(1), rofi-sensible-terminal(1), dmenu(1), rofi-theme(5), rofi-script(5), +rofi-theme-selector(1), ascii(7) + +## AUTHOR + +Qball Cow + +Rasmus Steinke + +Morgane Glidic + +Original code based on work by: Sean Pringle + +For a full list of authors, check the AUTHORS file. diff --git a/mkdocs/docs/1.7.9/rofi-keys.5.markdown b/mkdocs/docs/1.7.9/rofi-keys.5.markdown new file mode 100644 index 00000000..d664958a --- /dev/null +++ b/mkdocs/docs/1.7.9/rofi-keys.5.markdown @@ -0,0 +1,588 @@ +# rofi-keys(5) + +## NAME + +**rofi keys** - Rofi Key and Mouse bindings + +## DESCRIPTION + +**rofi** supports overriding of any of it key and mouse binding. + +## Setting binding + +Bindings can be done on the commandline (-{bindingname}): + +```bash +rofi -show run -kb-accept-entry 'Control+Shift+space' +``` + +or via the configuration file: + +```css +configuration { + kb-accept-entry: "Control+Shift+space"; +} +``` + +The key can be set by its name (see above) or its keycode: + +```css +configuration { + kb-accept-entry: "Control+Shift+[65]"; +} +``` + +An easy way to look up keycode is xev(1). + +Multiple keys can be specified for an action as a comma separated list: + +```css +configuration { + kb-accept-entry: "Control+Shift+space,Return"; +} +``` + +By Default **rofi** reacts on pressing, to act on the release of all keys +prepend the binding with `!`: + +```css +configuration { + kb-accept-entry: "!Control+Shift+space,Return"; +} +``` + +## Unsetting a binding + +To unset a binding, pass an empty string. + +```css +configuration { + kb-clear-line: ""; +} +``` + +## Keyboard Bindings + +`kb-primary-paste` + +Paste primary selection + +Default: Control+V,Shift+Insert + +`kb-secondary-paste` + +Paste clipboard + +Default: Control+v,Insert + +`kb-secondary-copy` + +Copy current selection to clipboard + +Default: Control+c + +`kb-clear-line` + +Clear input line + +Default: Control+w + +`kb-move-front` + +Beginning of line + +Default: Control+a + +`kb-move-end` + +End of line + +Default: Control+e + +`kb-move-word-back` + +Move back one word + +Default: Alt+b,Control+Left + +`kb-move-word-forward` + +Move forward one word + +Default: Alt+f,Control+Right + +`kb-move-char-back` + +Move back one char + +Default: Left,Control+b + +`kb-move-char-forward` + +Move forward one char + +Default: Right,Control+f + +`kb-remove-word-back` + +Delete previous word + +Default: Control+Alt+h,Control+BackSpace + +`kb-remove-word-forward` + +Delete next word + +Default: Control+Alt+d + +`kb-remove-char-forward` + +Delete next char + +Default: Delete,Control+d + +`kb-remove-char-back` + +Delete previous char + +Default: BackSpace,Shift+BackSpace,Control+h + +`kb-remove-to-eol` + +Delete till the end of line + +Default: Control+k + +`kb-remove-to-sol` + +Delete till the start of line + +Default: Control+u + +`kb-accept-entry` + +Accept entry + +Default: Control+j,Control+m,Return,KP\_Enter + +`kb-accept-custom` + +Use entered text as command (in ssh/run modes) + +Default: Control+Return + +`kb-accept-custom-alt` + +Use entered text as command (in ssh/run modes) + +Default: Control+Shift+Return + +`kb-accept-alt` + +Use alternate accept command. + +Default: Shift+Return + +`kb-delete-entry` + +Delete entry from history + +Default: Shift+Delete + +`kb-mode-next` + +Switch to the next mode. + +Default: Shift+Right,Control+Tab + +`kb-mode-previous` + +Switch to the previous mode. + +Default: Shift+Left,Control+ISO\_Left\_Tab + +`kb-mode-complete` + +Start completion for mode. + +Default: Control+l + +`kb-row-left` + +Go to the previous column + +Default: Control+Page\_Up + +`kb-row-right` + +Go to the next column + +Default: Control+Page\_Down + +`kb-row-up` + +Select previous entry + +Default: Up,Control+p + +`kb-row-down` + +Select next entry + +Default: Down,Control+n + +`kb-row-tab` + +Go to next row, if one left, accept it, if no left next mode. + +Default: + +`kb-element-next` + +Go to next row. + +Default: Tab + +`kb-element-prev` + +Go to previous row. + +Default: ISO\_Left\_Tab + +`kb-page-prev` + +Go to the previous page + +Default: Page\_Up + +`kb-page-next` + +Go to the next page + +Default: Page\_Down + +`kb-row-first` + +Go to the first entry + +Default: Home,KP\_Home + +`kb-row-last` + +Go to the last entry + +Default: End,KP\_End + +`kb-row-select` + +Set selected item as input text + +Default: Control+space + +`kb-screenshot` + +Take a screenshot of the rofi window + +Default: Alt+S + +`kb-ellipsize` + +Toggle between ellipsize modes for displayed data + +Default: Alt+period + +`kb-toggle-case-sensitivity` + +Toggle case sensitivity + +Default: grave,dead\_grave + +`kb-toggle-sort` + +Toggle filtered menu sort + +Default: Alt+grave + +`kb-cancel` + +Quit rofi + +Default: Escape,Control+g,Control+bracketleft + +`kb-custom-1` + +Custom keybinding 1 + +Default: Alt+1 + +`kb-custom-2` + +Custom keybinding 2 + +Default: Alt+2 + +`kb-custom-3` + +Custom keybinding 3 + +Default: Alt+3 + +`kb-custom-4` + +Custom keybinding 4 + +Default: Alt+4 + +`kb-custom-5` + +Custom Keybinding 5 + +Default: Alt+5 + +`kb-custom-6` + +Custom keybinding 6 + +Default: Alt+6 + +`kb-custom-7` + +Custom Keybinding 7 + +Default: Alt+7 + +`kb-custom-8` + +Custom keybinding 8 + +Default: Alt+8 + +`kb-custom-9` + +Custom keybinding 9 + +Default: Alt+9 + +`kb-custom-10` + +Custom keybinding 10 + +Default: Alt+0 + +`kb-custom-11` + +Custom keybinding 11 + +Default: Alt+exclam + +`kb-custom-12` + +Custom keybinding 12 + +Default: Alt+at + +`kb-custom-13` + +Custom keybinding 13 + +Default: Alt+numbersign + +`kb-custom-14` + +Custom keybinding 14 + +Default: Alt+dollar + +`kb-custom-15` + +Custom keybinding 15 + +Default: Alt+percent + +`kb-custom-16` + +Custom keybinding 16 + +Default: Alt+dead\_circumflex + +`kb-custom-17` + +Custom keybinding 17 + +Default: Alt+ampersand + +`kb-custom-18` + +Custom keybinding 18 + +Default: Alt+asterisk + +`kb-custom-19` + +Custom Keybinding 19 + +Default: Alt+parenleft + +`kb-select-1` + +Select row 1 + +Default: Super+1 + +`kb-select-2` + +Select row 2 + +Default: Super+2 + +`kb-select-3` + +Select row 3 + +Default: Super+3 + +`kb-select-4` + +Select row 4 + +Default: Super+4 + +`kb-select-5` + +Select row 5 + +Default: Super+5 + +`kb-select-6` + +Select row 6 + +Default: Super+6 + +`kb-select-7` + +Select row 7 + +Default: Super+7 + +`kb-select-8` + +Select row 8 + +Default: Super+8 + +`kb-select-9` + +Select row 9 + +Default: Super+9 + +`kb-select-10` + +Select row 10 + +Default: Super+0 + +`kb-entry-history-up` + +Go up in the entry history. + +Default: Control+Up + +`kb-entry-history-down` + +Go down in the entry history. + +Default: Control+Down + +`kb-matcher-up` + +Select the next matcher. + +Default: Super+equal + +`kb-matcher-down` + +Select the previous matcher. + +Default: Super+minus + +## Mouse Bindings + +`ml-row-left` + +Go to the previous column + +Default: ScrollLeft + +`ml-row-right` + +Go to the next column + +Default: ScrollRight + +`ml-row-up` + +Select previous entry + +Default: ScrollUp + +`ml-row-down` + +Select next entry + +Default: ScrollDown + +`me-select-entry` + +Select hovered row + +Default: MousePrimary + +`me-accept-entry` + +Accept hovered row + +Default: MouseDPrimary + +`me-accept-custom` + +Accept hovered row with custom action + +Default: Control+MouseDPrimary + +## Mouse key bindings + +The following mouse buttons can be bound: + +* `Primary`: Primary (Left) mouse button click. +* `Secondary`: Secondary (Right) mouse button click. +* `Middle`: Middle mouse button click. +* `Forward`: The forward mouse button. +* `Back`: The back mouse button. +* `ExtraN`: The N'the mouse button. (Depending on mouse support). + +The Identifier is constructed as follow: + +`Mouse