main.c
This file
Path
main.c
2,279 lines · 83.3 KiB · C
Last changed by
feat: border radius for selected entrieswisplbefore adoption9836d81
History of this fileTake it
The walk stopped after 200 commits: lines older than 99f03a9 point at it.
wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1–17why, one step back1#include <stdlib.h>2#include <stdio.h>3#include <stdbool.h>4#include <string.h>5#include <getopt.h>6#include <errno.h>7#include <threads.h>89#include <locale.h>10#include <libgen.h>1112#include <sys/types.h>13#include <sys/mman.h>14#include <sys/stat.h>15#include <sys/file.h>16#include <sys/epoll.h>17#include <sys/eventfd.h>debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
line 18why, one step back18#include <sys/time.h>wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 19–31why, one step back19#include <fcntl.h>20#include <dirent.h>2122#include <tllist.h>23#include <fcft/fcft.h>2425#define LOG_MODULE "fuzzel"26#define LOG_ENABLE_DBG 027#include "log.h"28#include "application.h"29#include "char32.h"30#include "config.h"31#include "dmenu.h"dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 32why, one step back32#include "event.h"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 33–35why, one step back33#include "fdm.h"34#include "key-binding.h"35#include "match.h"dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 36why, one step back36#include "path.h"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 37–41why, one step back37#include "render.h"38#include "shm.h"39#include "version.h"40#include "wayland.h"41#include "xdg.h"Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
lines 42–43why, one step back42#include "xmalloc.h"43#include "xsnprintf.h"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 44–45why, one step back4445#define max(x, y) ((x) > (y) ? (x) : (y))Add new --minimal-flag optionMark Stosbergbefore adoption6200008
line 46why, one step back46#define min(x, y) ((x) < (y) ? (x) : (y))wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 47–48why, one step back4748struct context {Add new --minimal-flag optionMark Stosbergbefore adoption6200008
line 49why, one step back49 struct config *conf;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 50–60why, one step back50 const char *cache_path;51 struct wayland *wayl;52 struct render *render;53 struct matches *matches;54 struct application_list *apps;5556 icon_theme_list_t *themes;57 int icon_size;58 mtx_t *icon_lock;5960 const char *select_initial;Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
line 61why, one step back61 const size_t select_initial_idx;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 62–64why, one step back6263 int event_fd;64 int dmenu_abort_fd;debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
lines 65–82why, one step back6566 struct {67 struct {68 struct timeval start;69 struct timeval stop;70 struct timeval diff;71 } apps;72 struct {73 struct timeval start;74 struct timeval stop;75 struct timeval diff;76 } icons_theme;77 struct {78 struct timeval start;79 struct timeval stop;80 struct timeval diff;81 } icons;82 } timing;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 83–108why, one step back83};8485struct cache_entry {86 char *id;87 char32_t *title;88 size_t count;89};9091static void92read_cache(const char *path, struct application_list *apps, bool dmenu)93{94 if (path == NULL && dmenu) {95 /* Don't thrash "normal" cache in dmenu mode */96 return;97 }9899 struct stat st;100 FILE *f = NULL;101102 if (path == NULL) {103 path = xdg_cache_dir();104 if (path == NULL) {105 LOG_WARN("failed to get cache directory: not saving popularity cache");106 return;107 }108main: open all FDs with O_CLOEXECDaniel Eklöfbefore adoptione7d074c
line 109why, one step back109 int cache_dir_fd = open(path, O_DIRECTORY | O_CLOEXEC);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 110–116why, one step back110 if (cache_dir_fd == -1) {111 LOG_ERRNO("%s: failed to open", path);112 return;113 }114115 int fd = -1;116 if (fstatat(cache_dir_fd, "fuzzel", &st, 0) < 0 ||main: open all FDs with O_CLOEXECDaniel Eklöfbefore adoptione7d074c
line 117why, one step back117 (fd = openat(cache_dir_fd, "fuzzel", O_RDONLY | O_CLOEXEC)) < 0 ||wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 118–129why, one step back118 (f = fdopen(fd, "r")) == NULL)119 {120 close(cache_dir_fd);121 if (fd >= 0)122 close(fd);123124 if (errno != ENOENT)125 LOG_ERRNO("%s/fuzzel: failed to open", path);126 return;127 }128 close(cache_dir_fd);129 } else {main: open all FDs with O_CLOEXECDaniel Eklöfbefore adoptione7d074c
line 130why, one step back130 if (stat(path, &st) < 0 || (f = fopen(path, "re")) == NULL)wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 131–175why, one step back131 {132 if (errno != ENOENT)133 LOG_ERRNO("%s: failed to open", path);134 return;135 }136 }137138 tll(struct cache_entry) cache_entries = tll_init();139140 size_t line_sz = 0;141 char *line = NULL;142143 while (true) {144 errno = 0;145 ssize_t bytes = getline(&line, &line_sz, f);146147 if (bytes < 0) {148 if (errno != 0) {149 LOG_ERRNO("failed to read cache");150 fclose(f);151 free(line);152 return;153 }154155 /* Done */156 break;157 }158159 if (line[bytes - 1] == '\n')160 line[bytes - 1] = '\0';161162 /* Parse each line ("<title>|<count>") */163 char *ptr = NULL;164 const char *id = strtok_r(line, "|", &ptr);165 const char *count_str = strtok_r(NULL, "|", &ptr);166167 if (id == NULL || count_str == NULL) {168 LOG_ERR("invalid cache entry (cache corrupt?): %s", line);169 continue;170 }171172 int count;173 sscanf(count_str, "%u", &count);174175 struct cache_entry entry = {Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 176why, one step back176 .id = dmenu ? NULL : xstrdup(id),wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 177–187why, one step back177 .title = dmenu ? ambstoc32(id) : NULL,178 .count = count,179 };180 tll_push_back(cache_entries, entry);181 }182183 free(line);184 fclose(f);185186 /* Loop all applications, and search for a matching cache entry */187 for (size_t i = 0; i < apps->count; i++) {dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 188why, one step back188 struct application *app = apps->v[i];wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 189–235why, one step back189190 if ((!dmenu && app->id == NULL) || (dmenu && app->title == NULL)) {191 continue;192 }193194 tll_foreach(cache_entries, it) {195 const struct cache_entry *e = &it->item;196 if ((!dmenu && e->id == NULL) || (dmenu && e->title == NULL))197 continue;198199 if ((!dmenu && strcmp(app->id, e->id) == 0) ||200 (dmenu && c32cmp(app->title, e->title) == 0))201 {202 app->count = e->count;203204 free(e->id);205 free(e->title);206 tll_remove(cache_entries, it);207 break;208 }209 }210 }211212 /* Free all un-matched cache entries */213 tll_foreach(cache_entries, it) {214 free(it->item.id);215 tll_remove(cache_entries, it);216 }217}218219static void220write_cache(const char *path, const struct application_list *apps, bool dmenu)221{222 if (path == NULL && dmenu) {223 /* Don't thrash "normal" cache in dmenu mode */224 return;225 }226227 int fd = -1;228229 if (path == NULL) {230 path = xdg_cache_dir();231 if (path == NULL) {232 LOG_WARN("failed to get cache directory: not saving popularity cache");233 return;234 }235main: open all FDs with O_CLOEXECDaniel Eklöfbefore adoptione7d074c
line 236why, one step back236 int cache_dir_fd = open(path, O_DIRECTORY | O_CLOEXEC);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 237–241why, one step back237 if (cache_dir_fd == -1) {238 LOG_ERRNO("%s: failed to open", path);239 return;240 }241main: open all FDs with O_CLOEXECDaniel Eklöfbefore adoptione7d074c
line 242why, one step back242 fd = openat(cache_dir_fd, "fuzzel", O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 243–244why, one step back243 close(cache_dir_fd);244 } else {main: open all FDs with O_CLOEXECDaniel Eklöfbefore adoptione7d074c
line 245why, one step back245 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 246–253why, one step back246 }247248 if (fd == -1) {249 LOG_ERRNO("%s/fuzzel: failed to open", path);250 return;251 }252253 for (size_t i = 0; i < apps->count; i++) {dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 254why, one step back254 if (apps->v[i]->count == 0)wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 255–256why, one step back255 continue;256dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 257why, one step back257 if (!apps->v[i]->visible)wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 258–259why, one step back258 continue;259main: write_cache(): ignore entries with NULL-idDaniel Eklöfbefore adoption0a68a8c
lines 260–266why, one step back260 if (!dmenu && apps->v[i]->id == NULL)261 continue;262263 if (dmenu && apps->v[i]->title == NULL)264 continue;265266 if (!dmenu) {dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 267why, one step back267 const char *id = apps->v[i]->id;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 268–274why, one step back268 const size_t id_len = strlen(id);269270 if (write(fd, id, id_len) != id_len) {271 LOG_ERRNO("failed to write cache");272 break;273 }274 } else {dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 275why, one step back275 const char32_t *title = apps->v[i]->title;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 276–289why, one step back276 char *u8_title = ac32tombs(title);277278 if (u8_title != NULL) {279 const size_t title_len = strlen(u8_title);280 if (write(fd, u8_title, title_len) != title_len) {281 LOG_ERRNO("failed to write cache");282 break;283 }284285 free(u8_title);286 }287 }288289 char count_as_str[11];xmalloc/xsnprintf: use x-wrapper functions in a few more placesCraig Barnesbefore adoptiondfed80e
lines 290–291why, one step back290 const size_t count_len = xsnprintf(291 count_as_str, sizeof(count_as_str), "%u", apps->v[i]->count);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 292–308why, one step back292293 if (write(fd, "|", 1) != 1 ||294 write(fd, count_as_str, count_len) != count_len ||295 write(fd, "\n", 1) != 1)296 {297 LOG_ERRNO("failed to write cache");298 break;299 }300 }301302 close(fd);303}304305static const char *306version_and_features(void)307{308 static char buf[256];Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 309why, one step back309 xsnprintf(buf, sizeof(buf), "version: %s %ccairo %cpng %csvg%s %cassertions",wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 310–342why, one step back310 FUZZEL_VERSION,311#if defined(FUZZEL_ENABLE_CAIRO)312 '+',313#else314 '-',315#endif316#if defined(FUZZEL_ENABLE_PNG_LIBPNG)317 '+',318#else319 '-',320#endif321#if defined(FUZZEL_ENABLE_SVG_NANOSVG)322 '+', "(nanosvg)",323#elif defined(FUZZEL_ENABLE_SVG_LIBRSVG)324 '+', "(librsvg)",325#else326 '-', "",327#endif328#if !defined(NDEBUG)329 '+'330#else331 '-'332#endif333 );334 return buf;335}336337static void338print_usage(const char *prog_name)339{340 printf("Usage: %s [OPTION]...\n", prog_name);341 printf("\n");342 printf("Options:\n");main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
lines 343–348why, one step back343 printf(" --config=PATH load configuration from PATH\n"344 " (XDG_CONFIG_HOME/fuzzel/fuzzel.ini)\n"345 " --check-config verify configuration, exit with 0 if ok,\n"346 " otherwise exit with 1\n"347 " --cache=PATH load most recently launched applications from\n"348 " PATH (XDG_CACHE_HOME/fuzzel)\n"wayland: allow setting namespace in config and from the command linefrostybefore adoption5255c0a
line 349why, one step back349 " -n,--namespace=NAMESPACE layer shell surface namespace\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 350–352why, one step back350 " -o,--output=OUTPUT output (monitor) to display on (none)\n"351 " -f,--font=FONT font name and style, in FontConfig format\n"352 " (monospace)\n"render: add support for rendering the selected entry in boldDaniel Eklöfbefore adoption8d77e69
line 353why, one step back353 " --use-bold allow fuzzel to use bold fonts\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 354why, one step back354 " -D,--dpi-aware=no|yes|auto enable or disable DPI aware rendering (auto)\n"config: change default icon theme from 'hicolor' to 'default'Daniel Eklöfbefore adoptionc24a0da
line 355why, one step back355 " --icon-theme=NAME icon theme name (\"default\")\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 356why, one step back356 " -I,--no-icons do not render any icons\n"Merge branch 'hide-when-prompt-empty'Mark Stosbergbefore adoptionc06d69e
line 357why, one step back357 " --hide-before-typing hide application list until something is typed\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 358–360why, one step back358 " -F,--fields=FIELDS comma separated list of XDG Desktop entry\n"359 " fields to match\n"360 " -p,--prompt=PROMPT string to use as input prompt (\"> \")\n"main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
lines 361–362why, one step back361 " --prompt-only=PROMPT same as --prompt, but in dmenu mode it does not\n"362 " wait for STDIN, and implies --lines=0\n"render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
line 363why, one step back363 " --placeholder=TEXT placeholder text in input box\n"main: add --search, letting you specify the initial search/filtering stringDaniel Eklöfbefore adoptionf74d4fb
line 364why, one step back364 " --search=TEXT initial search/filter string\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 365–371why, one step back365 " --password=[CHARACTER] render all input as CHARACTER ('*' by default)\n"366 " -T,--terminal terminal command to use when launching\n"367 " 'terminal' programs, e.g. \"xterm -e\".\n"368 " Not used in dmenu mode (not set)\n"369 " -a,--anchor window anchor (center)\n"370 " --x-margin=MARGIN horizontal margin, in pixels (0)\n"371 " --y-margin=MARGIN vertical margin, in pixels (0)\n"main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
lines 372–373why, one step back372 " --select=STRING select first entry that matches the given\n"373 " string\n"✨ Add --auto-select opt. When one entry is left, automatically select it.Mark Stosbergbefore adoption5751a65
lines 374–375why, one step back374 " --auto-select automatically select when only one match\n"375 " remains\n"Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
line 376why, one step back376 " --select-index=INDEX select the entry with index, not compatible with --select\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 377why, one step back377 " -l,--lines number of matches to show\n"Add new --minimal-flag optionMark Stosbergbefore adoption6200008
lines 378–380why, one step back378 " --minimal-lines adjust the number of lines to the\n"379 " minimum of --lines and the number\n"380 " of input lines (dmenu mode only)\n"✨ New Feature: Hide Input Line (#597)Mark Stosbergbefore adoption1ea0283
lines 381–382why, one step back381 " --hide-prompt hide the prompt line, making the window\n"382 " smaller (input still accepted)\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 383–389why, one step back383 " -w,--width window width, in characters (margins and\n"384 " borders not included)\n"385 " --tabs=INT number of spaces a tab is expanded to (8)\n"386 " -x,--horizontal-pad=PAD horizontal padding, in pixels (40)\n"387 " -y,--vertical-pad=PAD vertical padding, in pixels (8)\n"388 " -P,--inner-pad=PAD vertical padding between prompt and match list,\n"389 " in pixels (0)\n"config: remove transparency from default backgroundDaniel Eklöfbefore adoption93ac9fd
line 390why, one step back390 " -b,--background-color=HEX background color (fdf6e3ff)\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 391–392why, one step back391 " -t,--text-color=HEX text color of matched entries (657b83ff)\n"392 " --prompt-color=HEX text color of the prompt (586e75ff)\n"render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
line 393why, one step back393 " --placeholder-color=HEX text color of the placeholder text (93a1a1)\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 394–395why, one step back394 " --input-color=HEX text color of the input string (657b83ff)\n"395 " -m,--match-color=HEX color of matched substring (cb4b16ff)\n"config: remove transparency from default backgroundDaniel Eklöfbefore adoption93ac9fd
line 396why, one step back396 " -s,--selection-color=HEX background color of selected item (eee8d5ff)\n"config: change default selection text color to base01Daniel Eklöfbefore adoptionb1418ed
line 397why, one step back397 " -S,--selection-text-color=HEX text color of selected item (586e75ff)\n"main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
lines 398–399why, one step back398 " -M,--selection-match-color=HEX color of matched substring in selection\n"399 " (cb4b16ff)\n"feat: border radius for selected entrieswisplbefore adoption9836d81
line 400why, one step back400 " --selection-radius border radius of the selected entry (0)\n"config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
line 401why, one step back401 " --counter-color color of the match count (93a1a1)\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 402–405why, one step back402 " -B,--border-width=INT width of border, in pixels (1)\n"403 " -r,--border-radius=INT amount of corner \"roundness\" (10)\n"404 " -C,--border-color=HEX border color (002b36ff)\n"405 " --show-actions include desktop actions in the list\n"main: usage: --no-fuzzy -> --match-modeDaniel Eklöfbefore adoption5615f6d
line 406why, one step back406 " --match-mode=exact|fzf|fuzzy how to match what you type against the entries\n"main: usage: add missing --filter-desktopDaniel Eklöfbefore adoptionf6543d6
line 407why, one step back407 " --filter-desktop filter desktop entries based on XDG_CURRENT\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 408–413why, one step back408 " --fuzzy-min-length=VALUE search strings shorter than this will not be\n"409 " fuzzy matched (3)\n"410 " --fuzzy-max-length-discrepancy=VALUE maximum allowed length discrepancy\n"411 " between a fuzzy match and the search\n"412 " criteria. Larger values mean more\n"413 " fuzzy matches (2)\n"main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
line 414why, one step back414 " --fuzzy-max-distance=VALUE maximum levenshtein distance between a fuzzy\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 415–418why, one step back415 " match and the search criteria. Larger values\n"416 " mean more fuzzy matches\n"417 " --line-height=HEIGHT override line height from font metrics\n"418 " --letter-spacing=AMOUNT additional letter spacing\n"main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
lines 419–420why, one step back419 " --layer=top|overlay which layer to render the fuzzel window on\n"420 " (top)\n"Add `keyboard-focus=exclusive|on-demand` command line and config optionbbb651before adoption9a0a38d
line 421why, one step back421 " --keyboard-focus=exclusive|on-demand keyboard focus mode (exclusive)\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 422–423why, one step back422 " --no-exit-on-keyboard-focus-loss do not exit when losing keyboard focus\n"423 " --launch-prefix=COMMAND prefix to add before argv of executed program\n"main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
line 424why, one step back424 " --list-executables-in-path include executables from PATH in the list\n"match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
lines 425–426why, one step back425 " --render-workers=N number of threads to use for rendering\n"426 " --match-workers=N number of threads to use for matching\n"config: add --no-sortDaniel Eklöfbefore adoptiond9e817a
line 427why, one step back427 " --no-sort do not sort the result\n"config: disable match-counter by defaultDaniel Eklöfbefore adoption11ad859
line 428why, one step back428 " --counter display the match count\n"match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
lines 429–432why, one step back429 " --delayed-filter-ms=TIME_MS time in ms before refiltering after a keystroke\n"430 " (300)\n"431 " --delayed-filter-limit=N used delayed refiltering when the number of\n"432 " matches exceeds this number (10000)\n"config: add scaling-filter optionDaniel Eklöfbefore adoption3866f60
line 433why, one step back433 " --scaling-filter=FILTER filter to use when down scaling PNGs\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 434–438why, one step back434 " -d,--dmenu dmenu compatibility mode\n"435 " --dmenu0 like --dmenu, but input is NUL separated\n"436 " instead of newline separated\n"437 " --index print selected entry's index instead of of the \n"438 " entry's text (dmenu mode only)\n"Add --with-nth=N command line optionDaniel Eklöfbefore adoption36471ff
lines 439–440why, one step back439 " --with-nth=N display the N:th column (tab separated) of each\n"440 " input line (dmenu only)\n"Add `--accept-nth` command line option to select column to outputbbb651before adoption33c9b8e
lines 441–442why, one step back441 " --accept-nth=N output the N:th column (tab separated) of each\n"442 " input line (dmenu only)\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 443–450why, one step back443 " -R,--no-run-if-empty exit immediately without showing UI if stdin\n"444 " is empty (dmenu mode only)\n"445 " --log-level={info|warning|error|none}\n"446 " log level (warning)\n"447 " --log-colorize=[never|always|auto]\n"448 " enable/disable colorization of log output on\n"449 " stderr\n"450 " --log-no-syslog disable syslog logging\n"debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
lines 451–452why, one step back451 " --print-timing-info print timing information, to help debug\n"452 " performance issues\n"wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 453–464why, one step back453 " -v,--version show the version number and quit\n");454 printf("\n");455 printf("All colors are RGBA - i.e. 8-digit hex values, without prefix.\n");456}457458static void459font_reloaded(struct wayland *wayl, struct fcft_font *font, void *data)460{461 struct context *ctx = data;462 const struct config *conf = ctx->conf;463464 applications_flush_text_run_cache(ctx->apps);render: font-shape the input stringDaniel Eklöfbefore adoption3ba23e1
line 465why, one step back465 render_flush_text_run_cache(ctx->render);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 466–473why, one step back466467 mtx_lock(ctx->icon_lock);468 {469 ctx->icon_size = render_icon_size(ctx->render);470471 if (conf->icons_enabled) {472 icon_lookup_application_icons(473 *ctx->themes, ctx->icon_size, ctx->apps);dmenu: add support for fallbacks in icon metadatae-thobefore adoptionb789998
lines 474–477why, one step back474475 if (conf->dmenu.enabled) {476 dmenu_try_icon_list(ctx->apps, *ctx->themes, ctx->icon_size);477 }wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 478–525why, one step back478 }479 }480 mtx_unlock(ctx->icon_lock);481}482483static bool484pt_or_px_from_string(const char *s, struct pt_or_px *res)485{486 const size_t len = strlen(s);487 if (len >= 2 && s[len - 2] == 'p' && s[len - 1] == 'x') {488 errno = 0;489 char *end = NULL;490491 long value = strtol(s, &end, 10);492 if (!(errno == 0 && end == s + len - 2)) {493 fprintf(stderr, "%s: not a valid pixel value\n", s);494 return false;495 }496497 res->pt = 0;498 res->px = value;499 } else {500 errno = 0;501 char *end = NULL;502503 float value = strtof(s, &end);504 if (!(errno == 0 && *end == '\0')) {505 fprintf(stderr, "%s: not a valid point value\n", s);506 return false;507 }508 res->pt = value;509 res->px = 0;510 }511512 return true;513}514515static char *516lock_file_name(void)517{518 const char *xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");519 if (xdg_runtime_dir == NULL)520 xdg_runtime_dir = "/tmp";521522 const char *wayland_display = getenv("WAYLAND_DISPLAY");523 if (wayland_display == NULL)524 return NULL;525Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 526why, one step back526 char *path = xasprintf("%s/fuzzel-%s.lock", xdg_runtime_dir, wayland_display);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 527–536why, one step back527 LOG_DBG("lock file: %s", path);528 return path;529}530531static bool532acquire_file_lock(const char *path, int *fd)533{534 *fd = open(path, O_WRONLY | O_CREAT | O_CLOEXEC, 0644);535 if (*fd < 0) {536 /* Warn, but allow running anyway */path/xdg/main: include errno(3) description in more LOG_WARN() messagesCraig Barnesbefore adoptionab9a3dc
line 537why, one step back537 LOG_WARN("%s: failed to create lock file: %s", path, strerror(errno));wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 538–573why, one step back538 return true;539 }540541 if (flock(*fd, LOCK_EX | LOCK_NB) < 0) {542 if (errno == EWOULDBLOCK) {543 /* The file is locked and the LOCK_NB flag was selected */544 LOG_ERR("%s: failed to acquire lock: fuzzel already running?", path);545 return false;546 }547 }548549 return true;550}551552/* THREAD */553static int554populate_apps(void *_ctx)555{556 struct context *ctx = _ctx;557 const char *cache_path = ctx->cache_path;558 struct application_list *apps = ctx->apps;559 const struct config *conf = ctx->conf;560 const char *icon_theme = conf->icon_theme;561 const char *terminal = conf->terminal;562 bool actions_enabled = conf->actions_enabled;563 bool dmenu_enabled = conf->dmenu.enabled;564 bool icons_enabled = conf->icons_enabled;565 char dmenu_delim = conf->dmenu.delim;566 bool filter_desktop = conf->filter_desktop;567 bool list_exec_in_path = conf->list_executables_in_path;568 char_list_t desktops = tll_init();569 char *saveptr = NULL;570571 if (filter_desktop) {572 char *xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP");573 if (xdg_current_desktop && strlen(xdg_current_desktop) != 0) {Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 574why, one step back574 xdg_current_desktop = xstrdup(xdg_current_desktop);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 575–578why, one step back575 for (char *desktop = strtok_r(xdg_current_desktop, ":", &saveptr);576 desktop != NULL;577 desktop = strtok_r(NULL, ":", &saveptr))578 {Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 579why, one step back579 tll_push_back(desktops, xstrdup(desktop));wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 580–585why, one step back580 }581 free(xdg_current_desktop);582 }583 }584585 if (dmenu_enabled) {main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
line 586why, one step back586 if (!conf->prompt_only) {dmenu: --with-nth: don't match "other" columnsDaniel Eklöfbefore adoption56526e8
lines 587–588why, one step back587 dmenu_load_entries(apps, dmenu_delim, conf->dmenu.render_column,588 ctx->event_fd, ctx->dmenu_abort_fd);main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
lines 589–590why, one step back589 read_cache(cache_path, apps, true);590 }wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 591why, one step back591 } else {debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
line 592why, one step back592 gettimeofday(&ctx->timing.apps.start, NULL);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 593–596why, one step back593 xdg_find_programs(terminal, actions_enabled, filter_desktop, &desktops, apps);594 if (list_exec_in_path)595 path_find_programs(apps);596 read_cache(cache_path, apps, false);debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
lines 597–598why, one step back597 gettimeofday(&ctx->timing.apps.stop, NULL);598 timersub(&ctx->timing.apps.stop, &ctx->timing.apps.start, &ctx->timing.apps.diff);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 599–601why, one step back599 }600 tll_free_and_free(desktops, free);601dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 602why, one step back602 int r = send_event(ctx->event_fd, EVENT_APPS_ALL_LOADED);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 603–606why, one step back603 if (r != 0)604 return r;605606 if (icons_enabled) {debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
line 607why, one step back607 gettimeofday(&ctx->timing.icons_theme.start, NULL);icon: in application mode (not dmenu), filter out non-application icon theme dirsDaniel Eklöfbefore adoption40964b5
line 608why, one step back608 icon_theme_list_t icon_themes = icon_load_theme(icon_theme, !dmenu_enabled);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 609–612why, one step back609 if (tll_length(icon_themes) > 0)610 LOG_INFO("theme: %s", tll_front(icon_themes).name);611 else612 LOG_WARN("%s: icon theme not found", icon_theme);debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
lines 613–614why, one step back613 gettimeofday(&ctx->timing.icons_theme.stop, NULL);614 timersub(&ctx->timing.icons_theme.stop, &ctx->timing.icons_theme.start, &ctx->timing.icons_theme.diff);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 615why, one step back615debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
line 616why, one step back616 gettimeofday(&ctx->timing.icons.start, NULL);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 617–622why, one step back617 mtx_lock(ctx->icon_lock);618 {619 *ctx->themes = icon_themes;620 if (ctx->icon_size > 0) {621 icon_lookup_application_icons(622 *ctx->themes, ctx->icon_size, apps);dmenu: add support for fallbacks in icon metadatae-thobefore adoptionb789998
lines 623–626why, one step back623624 if (dmenu_enabled) {625 dmenu_try_icon_list(apps, *ctx->themes, ctx->icon_size);626 }wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 627–629why, one step back627 }628 }629 mtx_unlock(ctx->icon_lock);debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
lines 630–631why, one step back630 gettimeofday(&ctx->timing.icons.stop, NULL);631 timersub(&ctx->timing.icons.stop, &ctx->timing.icons.start, &ctx->timing.icons.diff);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 632–641why, one step back632633 r = send_event(ctx->event_fd, EVENT_ICONS_LOADED);634 if (r != 0)635 return r;636 }637638 return 0;639}640641static booldmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 642why, one step back642process_event(struct context *ctx, enum event_type event)wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 643why, one step back643{config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
line 644why, one step back644 const struct config *conf = ctx->conf;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 645–648why, one step back645 struct wayland *wayl = ctx->wayl;646 struct application_list *apps = ctx->apps;647 struct matches *matches = ctx->matches;648 const char *select = ctx->select_initial;Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
line 649why, one step back649 const size_t select_idx = ctx->select_initial_idx;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 650–651why, one step back650651 switch (event) {dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
lines 652–653why, one step back652 case EVENT_APPS_SOME_LOADED:653 case EVENT_APPS_ALL_LOADED: {debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
lines 654–658why, one step back654 if (event == EVENT_APPS_ALL_LOADED && conf->print_timing_info) {655 LOG_WARN("apps loaded in %llus %lluµs",656 (unsigned long long)ctx->timing.apps.diff.tv_sec,657 (unsigned long long)ctx->timing.apps.diff.tv_usec);658 }wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 659–660why, one step back659 /* Update matches list, then refresh the GUI */660 matches_set_applications(matches, apps);dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 661why, one step back661main: --no-run-if-empty: display window as soon as we see _some_ inputDaniel Eklöfbefore adoptionc6d38f6
line 662why, one step back662 if (event == EVENT_APPS_ALL_LOADED) {wayland: dmenu: prevent window from being displayed until we have loaded at least one entryDaniel Eklöfbefore adoption63cd8ea
line 663why, one step back663 if (conf->dmenu.exit_immediately_if_empty && apps->count == 0)main: --no-run-if-empty: display window as soon as we see _some_ inputDaniel Eklöfbefore adoptionc6d38f6
line 664why, one step back664 return false;Add new --minimal-flag optionMark Stosbergbefore adoption6200008
line 665why, one step back665dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 666why, one step back666 matches_all_applications_loaded(matches);Add new --minimal-flag optionMark Stosbergbefore adoption6200008
lines 667–674why, one step back667668 if (conf->dmenu.enabled && conf->minimal_lines) {669 const size_t effective_lines = min(apps->count, conf->lines);670 matches_max_matches_per_page_set(matches, effective_lines);671 ctx->conf->lines = effective_lines;672 wayl_resized(wayl);673 }674wayland: dmenu: prevent window from being displayed until we have loaded at least one entryDaniel Eklöfbefore adoption63cd8ea
line 675why, one step back675 wayl_ready_to_display(wayl);main: --no-run-if-empty: display window as soon as we see _some_ inputDaniel Eklöfbefore adoptionc6d38f6
line 676why, one step back676 }dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
lines 677–680why, one step back677678 const size_t match_count = matches_get_count(matches);679 const size_t matches_per_page = matches_max_matches_per_page(matches);680config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
lines 681–684why, one step back681 if (conf->match_counter ||682 event == EVENT_APPS_ALL_LOADED ||683 match_count < matches_per_page)684 {dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
lines 685–686why, one step back685 /*686 * Only update matches ifconfig: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
lines 687–689why, one step back687 * a) we're displaying a match counter688 * b) all applications have been loaded689 * c) a partial load will cause more matches to be displayeddmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
lines 690–691why, one step back690 */691 matches_update_no_delay(matches);Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
lines 692–699why, one step back692 if (select_idx != 0) {693 if (!matches_selected_set(matches, select_idx)) {694 LOG_ERR("couldn't select entry at index %zu", select_idx);695 return false;696 }697 }698 else699 matches_selected_select(matches, select);Add new --minimal-flag optionMark Stosbergbefore adoption6200008
line 700why, one step back700 }wayland: dmenu: prevent window from being displayed until we have loaded at least one entryDaniel Eklöfbefore adoption63cd8ea
line 701why, one step back701Add new --minimal-flag optionMark Stosbergbefore adoption6200008
lines 702–716why, one step back702 /*703 * Allow displaying the menu if:704 * --no-run-if-empty is NOT enabled, OR we have at least one entry705 * AND706 * --minimal-lines is NOT enabled, OR we have at least --lines number of entries707 *708 * In short, display the window as soon as we are sure we709 * won't exit automatically (due to --no-run-if-empty), and we710 * know its final size.711 */712 if ((!conf->dmenu.exit_immediately_if_empty || apps->count > 0) &&713 (!(conf->dmenu.enabled && conf->minimal_lines) ||714 apps->count >= conf->lines))715 {716 wayl_ready_to_display(wayl);dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 717why, one step back717 }wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 718why, one step back718 break;dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
line 719why, one step back719 }wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 720–722why, one step back720721 case EVENT_ICONS_LOADED:722 /* Just need to refresh the GUI */debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
lines 723–730why, one step back723 if (conf->print_timing_info) {724 LOG_WARN("icon themes loaded in %llus %lluµs",725 (unsigned long long)ctx->timing.icons_theme.diff.tv_sec,726 (unsigned long long)ctx->timing.icons_theme.diff.tv_usec);727 LOG_WARN("icon paths resolved in %llus %lluµs",728 (unsigned long long)ctx->timing.icons.diff.tv_sec,729 (unsigned long long)ctx->timing.icons.diff.tv_usec);730 }wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 731–742why, one step back731 matches_icons_loaded(matches);732 break;733734 default:735 LOG_ERR("unknown event: %llx", (long long)event);736 return false;737 }738739 wayl_refresh(wayl);740 return true;741}742dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
lines 743–755why, one step back743/*744 * Called when the application list has been populated745 */746static bool747fdm_apps_populated(struct fdm *fdm, int fd, int events, void *data)748{749 struct context *ctx = data;750 uint64_t last_event = EVENT_INVALID;751 uint64_t event = EVENT_INVALID;752753 while (true) {754 ssize_t bytes = read(fd, &event, sizeof(event));755 if (bytes == 0) {main: --no-run-if-empty: display window as soon as we see _some_ inputDaniel Eklöfbefore adoptionc6d38f6
lines 756–759why, one step back756 if (event != EVENT_INVALID) {757 if (!process_event(ctx, event))758 return false;759 }dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
lines 760–765why, one step back760 break;761 }762763 if (bytes != (ssize_t)sizeof(event)) {764 if (bytes < 0) {765 if (errno == EAGAIN) {main: --no-run-if-empty: display window as soon as we see _some_ inputDaniel Eklöfbefore adoptionc6d38f6
lines 766–769why, one step back766 if (event != EVENT_INVALID) {767 if (!process_event(ctx, event))768 return false;769 }dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
lines 770–779why, one step back770 break;771 }772 LOG_ERRNO("failed to read event FD");773 } else774 LOG_ERR("partial read from event FD");775 return false;776 }777778 /* Coalesce multiple, identical events */779 if (last_event != EVENT_INVALID) {main: --no-run-if-empty: display window as soon as we see _some_ inputDaniel Eklöfbefore adoptionc6d38f6
lines 780–783why, one step back780 if (event != last_event) {781 if (!process_event(ctx, last_event))782 return false;783 }dmenu: start rendering input before STDIN has been closedDaniel Eklöfbefore adoptionb69ba92
lines 784–791why, one step back784 }785786 last_event = event;787 }788789 return true;790}791wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 792–809why, one step back792int793main(int argc, char *const *argv)794{795 #define OPT_LETTER_SPACING 256796 #define OPT_LAUNCH_PREFIX 257797 #define OPT_SHOW_ACTIONS 258798 #define OPT_MATCH_MODE 259799 #define OPT_FUZZY_MIN_LENGTH 260800 #define OPT_FUZZY_MAX_LENGTH_DISCREPANCY 261801 #define OPT_FUZZY_MAX_DISTANCE 262802 #define OPT_DMENU_INDEX 263803 #define OPT_LOG_LEVEL 264804 #define OPT_LOG_COLORIZE 265805 #define OPT_LOG_NO_SYSLOG 266806 #define OPT_PASSWORD 267807 #define OPT_CONFIG 268808 #define OPT_LAYER 269809 #define OPT_ICON_THEME 270Add `keyboard-focus=exclusive|on-demand` command line and config optionbbb651before adoption9a0a38d
lines 810–838why, one step back810 #define OPT_KEYBOARD_FOCUS 271811 #define OPT_NO_EXIT_ON_KB_LOSS 272812 #define OPT_TABS 273813 #define OPT_DMENU_NULL 274814 #define OPT_FILTER_DESKTOP 275815 #define OPT_CHECK_CONFIG 276816 #define OPT_SELECT 277817 #define OPT_SELECT_INDEX 278818 #define OPT_LIST_EXECS_IN_PATH 279819 #define OPT_X_MARGIN 280820 #define OPT_Y_MARGIN 281821 #define OPT_CACHE 282822 #define OPT_RENDER_WORKERS 283823 #define OPT_PROMPT_COLOR 284824 #define OPT_INPUT_COLOR 285825 #define OPT_PROMPT_ONLY 286826 #define OPT_COUNTER_COLOR 287827 #define OPT_USE_BOLD 288828 #define OPT_MATCH_WORKERS 289829 #define OPT_NO_SORT 290830 #define OPT_DELAYED_FILTER_MS 291831 #define OPT_DELAYED_FILTER_LIMIT 292832 #define OPT_PLACEHOLDER 293833 #define OPT_PLACEHOLDER_COLOR 294834 #define OPT_SEARCH_TEXT 295835 #define OPT_COUNTER 296836 #define OPT_HIDE_WHEN_PROMPT_EMPTY 297837 #define OPT_DMENU_WITH_NTH 298838 #define OPT_DMENU_ACCEPT_NTH 299Implement gamma-correct blendingDaniel Eklöfbefore adoption2d19826
line 839why, one step back839 #define OPT_GAMMA_CORRECT 300debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
line 840why, one step back840 #define OPT_PRINT_TIMINGS 301config: add scaling-filter optionDaniel Eklöfbefore adoption3866f60
line 841why, one step back841 #define OPT_SCALING_FILTER 302Add new --minimal-flag optionMark Stosbergbefore adoption6200008
line 842why, one step back842 #define OPT_MINIMAL_LINES 303✨ New Feature: Hide Input Line (#597)Mark Stosbergbefore adoption1ea0283
line 843why, one step back843 #define OPT_HIDE_PROMPT 304✨ Add --auto-select opt. When one entry is left, automatically select it.Mark Stosbergbefore adoption5751a65
line 844why, one step back844 #define OPT_AUTO_SELECT 305feat: border radius for selected entrieswisplbefore adoption9836d81
line 845why, one step back845 #define OPT_SELECTION_RADIUS 306wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 846–849why, one step back846847 static const struct option longopts[] = {848 {"config", required_argument, 0, OPT_CONFIG},849 {"check-config", no_argument, 0, OPT_CHECK_CONFIG},wayland: allow setting namespace in config and from the command linefrostybefore adoption5255c0a
line 850why, one step back850 {"namespace", required_argument, 0, 'n'},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 851–853why, one step back851 {"cache", required_argument, 0, OPT_CACHE},852 {"output" , required_argument, 0, 'o'},853 {"font", required_argument, 0, 'f'},render: add support for rendering the selected entry in boldDaniel Eklöfbefore adoption8d77e69
line 854why, one step back854 {"use-bold", no_argument, 0, OPT_USE_BOLD},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 855why, one step back855 {"dpi-aware", required_argument, 0, 'D'},Implement gamma-correct blendingDaniel Eklöfbefore adoption2d19826
line 856why, one step back856 {"gamma-correct", no_argument, 0, OPT_GAMMA_CORRECT},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 857–858why, one step back857 {"icon-theme", required_argument, 0, OPT_ICON_THEME},858 {"no-icons", no_argument, 0, 'I'},Merge branch 'hide-when-prompt-empty'Mark Stosbergbefore adoptionc06d69e
line 859why, one step back859 {"hide-before-typing", no_argument, 0, OPT_HIDE_WHEN_PROMPT_EMPTY},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 860–865why, one step back860 {"fields", required_argument, 0, 'F'},861 {"password", optional_argument, 0, OPT_PASSWORD},862 {"anchor", required_argument, 0, 'a'},863 {"x-margin", required_argument, 0, OPT_X_MARGIN},864 {"y-margin", required_argument, 0, OPT_Y_MARGIN},865 {"select", required_argument, 0, OPT_SELECT},Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
line 866why, one step back866 {"select-index", required_argument, 0, OPT_SELECT_INDEX},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 867why, one step back867 {"lines", required_argument, 0, 'l'},Add new --minimal-flag optionMark Stosbergbefore adoption6200008
line 868why, one step back868 {"minimal-lines", no_argument, 0, OPT_MINIMAL_LINES},✨ New Feature: Hide Input Line (#597)Mark Stosbergbefore adoption1ea0283
line 869why, one step back869 {"hide-prompt", no_argument, 0, OPT_HIDE_PROMPT},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 870–877why, one step back870 {"width", required_argument, 0, 'w'},871 {"tabs", required_argument, 0, OPT_TABS},872 {"horizontal-pad", required_argument, 0, 'x'},873 {"vertical-pad", required_argument, 0, 'y'},874 {"inner-pad", required_argument, 0, 'P'},875 {"background-color", required_argument, 0, 'b'},876 {"text-color", required_argument, 0, 't'},877 {"prompt-color", required_argument, 0, OPT_PROMPT_COLOR},render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
line 878why, one step back878 {"placeholder-color", required_argument, 0, OPT_PLACEHOLDER_COLOR},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 879–883why, one step back879 {"input-color", required_argument, 0, OPT_INPUT_COLOR},880 {"match-color", required_argument, 0, 'm'},881 {"selection-color", required_argument, 0, 's'},882 {"selection-text-color", required_argument, 0, 'S'},883 {"selection-match-color",required_argument, 0, 'M'},feat: border radius for selected entrieswisplbefore adoption9836d81
line 884why, one step back884 {"selection-radius", required_argument, 0, OPT_SELECTION_RADIUS},config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
line 885why, one step back885 {"counter-color", required_argument, 0, OPT_COUNTER_COLOR},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 886–889why, one step back886 {"border-width", required_argument, 0, 'B'},887 {"border-radius", required_argument, 0, 'r'},888 {"border-color", required_argument, 0, 'C'},889 {"prompt", required_argument, 0, 'p'},main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
line 890why, one step back890 {"prompt-only", required_argument, 0, OPT_PROMPT_ONLY},render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
line 891why, one step back891 {"placeholder", required_argument, 0, OPT_PLACEHOLDER},main: add --search, letting you specify the initial search/filtering stringDaniel Eklöfbefore adoptionf74d4fb
line 892why, one step back892 {"search", required_argument, 0, OPT_SEARCH_TEXT},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 893–895why, one step back893 {"terminal", required_argument, 0, 'T'},894 {"show-actions", no_argument, 0, OPT_SHOW_ACTIONS},895 {"match-mode", required_argument, 0, OPT_MATCH_MODE},main: usage: add missing --filter-desktopDaniel Eklöfbefore adoptionf6543d6
line 896why, one step back896 {"filter-desktop", optional_argument, 0, OPT_FILTER_DESKTOP},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 897–903why, one step back897 {"fuzzy-min-length", required_argument, 0, OPT_FUZZY_MIN_LENGTH},898 {"fuzzy-max-length-discrepancy", required_argument, 0, OPT_FUZZY_MAX_LENGTH_DISCREPANCY},899 {"fuzzy-max-distance", required_argument, 0, OPT_FUZZY_MAX_DISTANCE},900 {"line-height", required_argument, 0, 'H'},901 {"letter-spacing", required_argument, 0, OPT_LETTER_SPACING},902 {"launch-prefix", required_argument, 0, OPT_LAUNCH_PREFIX},903 {"layer", required_argument, 0, OPT_LAYER},Add `keyboard-focus=exclusive|on-demand` command line and config optionbbb651before adoption9a0a38d
lines 904–906why, one step back904 {"keyboard-focus", required_argument, 0, OPT_KEYBOARD_FOCUS},905 {"no-exit-on-keyboard-focus-loss", no_argument, 0, OPT_NO_EXIT_ON_KB_LOSS},906 {"list-executables-in-path", no_argument, 0, OPT_LIST_EXECS_IN_PATH},match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
lines 907–909why, one step back907 {"render-workers", required_argument, 0, OPT_RENDER_WORKERS},908 {"match-workers", required_argument, 0, OPT_MATCH_WORKERS},909 {"no-sort", no_argument, 0, OPT_NO_SORT},config: disable match-counter by defaultDaniel Eklöfbefore adoption11ad859
line 910why, one step back910 {"counter", no_argument, 0, OPT_COUNTER},match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
lines 911–912why, one step back911 {"delayed-filter-ms", required_argument, 0, OPT_DELAYED_FILTER_MS},912 {"delayed-filter-limit", required_argument, 0, OPT_DELAYED_FILTER_LIMIT},config: add scaling-filter optionDaniel Eklöfbefore adoption3866f60
line 913why, one step back913 {"scaling-filter", required_argument, 0, OPT_SCALING_FILTER},✨ Add --auto-select opt. When one entry is left, automatically select it.Mark Stosbergbefore adoption5751a65
line 914why, one step back914 {"auto-select", no_argument, 0, OPT_AUTO_SELECT},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 915–920why, one step back915916 /* dmenu mode */917 {"dmenu", no_argument, 0, 'd'},918 {"dmenu0", no_argument, 0, OPT_DMENU_NULL},919 {"no-run-if-empty", no_argument, 0, 'R'},920 {"index", no_argument, 0, OPT_DMENU_INDEX},Add --with-nth=N command line optionDaniel Eklöfbefore adoption36471ff
line 921why, one step back921 {"with-nth", required_argument, 0, OPT_DMENU_WITH_NTH},Add `--accept-nth` command line option to select column to outputbbb651before adoption33c9b8e
line 922why, one step back922 {"accept-nth", required_argument, 0, OPT_DMENU_ACCEPT_NTH},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 923–928why, one step back923924 /* Misc */925 {"log-level", required_argument, 0, OPT_LOG_LEVEL},926 {"log-colorize", optional_argument, 0, OPT_LOG_COLORIZE},927 {"log-no-syslog", no_argument, 0, OPT_LOG_NO_SYSLOG},928 {"version", no_argument, 0, 'v'},debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
line 929why, one step back929 {"print-timing-info", no_argument, 0, OPT_PRINT_TIMINGS},wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 930–939why, one step back930 {"help", no_argument, 0, 'h'},931 {NULL, no_argument, 0, 0},932 };933934 bool check_config = false;935 const char *config_path = NULL;936 enum log_class log_level = LOG_CLASS_WARNING;937 enum log_colorize log_colorize = LOG_COLORIZE_AUTO;938 bool log_syslog = true;939 const char *select = NULL;Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
line 940why, one step back940 size_t select_idx = 0;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 941–945why, one step back941942 struct {943 struct config conf;944945 bool dpi_aware_set:1;Implement gamma-correct blendingDaniel Eklöfbefore adoption2d19826
line 946why, one step back946 bool gamma_correct_set:1;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 947–948why, one step back947 bool match_fields_set:1;948 bool icons_disabled_set:1;Merge branch 'hide-when-prompt-empty'Mark Stosbergbefore adoptionc06d69e
line 949why, one step back949 bool hide_when_prompt_empty_set:1;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 950–953why, one step back950 bool anchor_set:1;951 bool x_margin_set : 1;952 bool y_margin_set : 1;953 bool lines_set:1;Add new --minimal-flag optionMark Stosbergbefore adoption6200008
line 954why, one step back954 bool minimal_lines_set:1;✨ New Feature: Hide Input Line (#597)Mark Stosbergbefore adoption1ea0283
line 955why, one step back955 bool hide_prompt_set:1;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 956–968why, one step back956 bool chars_set:1;957 bool tabs_set:1;958 bool pad_x_set:1;959 bool pad_y_set:1;960 bool pad_inner_set:1;961 bool background_color_set:1;962 bool text_color_set:1;963 bool prompt_color_set:1;964 bool input_color_set:1;965 bool match_color_set:1;966 bool selection_color_set:1;967 bool selection_text_color_set:1;968 bool selection_match_color_set:1;feat: border radius for selected entrieswisplbefore adoption9836d81
line 969why, one step back969 bool selection_border_radius_set:1;config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
line 970why, one step back970 bool counter_color_set:1;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 971–985why, one step back971 bool border_color_set:1;972 bool border_size_set:1;973 bool border_radius_set:1;974 bool actions_enabled_set:1;975 bool filter_desktop_set:1;976 bool match_mode_set:1;977 bool fuzzy_min_length_set:1;978 bool fuzzy_max_length_discrepancy_set:1;979 bool fuzzy_max_distance_set:1;980 bool line_height_set:1;981 bool letter_spacing_set:1;982 bool dmenu_enabled_set:1;983 bool dmenu_mode_set:1;984 bool dmenu_exit_immediately_if_empty_set:1;985 bool dmenu_delim_set:1;Add --with-nth=N command line optionDaniel Eklöfbefore adoption36471ff
line 986why, one step back986 bool dmenu_with_nth_set:1;Add `--accept-nth` command line option to select column to outputbbb651before adoption33c9b8e
line 987why, one step back987 bool dmenu_accept_nth_set:1;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 988why, one step back988 bool layer_set:1;Add `keyboard-focus=exclusive|on-demand` command line and config optionbbb651before adoption9a0a38d
line 989why, one step back989 bool keyboard_focus_set:1;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 990why, one step back990 bool no_exit_on_keyboard_focus_loss_set:1;match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
lines 991–992why, one step back991 bool render_workers_set:1;992 bool match_workers_set:1;main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
line 993why, one step back993 bool prompt_only_set:1;render: add support for rendering the selected entry in boldDaniel Eklöfbefore adoption8d77e69
line 994why, one step back994 bool use_bold_set:1;config: add --no-sortDaniel Eklöfbefore adoptiond9e817a
line 995why, one step back995 bool no_sort_set:1;match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
lines 996–997why, one step back996 bool delayed_filter_ms_set:1;997 bool delayed_filter_limit_set:1;render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
line 998why, one step back998 bool placeholder_color_set:1;config: disable match-counter by defaultDaniel Eklöfbefore adoption11ad859
line 999why, one step back999 bool counter_set:1;debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
line 1000why, one step back1000 bool print_timing_info_set:1;config: add scaling-filter optionDaniel Eklöfbefore adoption3866f60
line 1001why, one step back1001 bool scaling_filter_set:1;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1002–1008why, one step back1002 } cmdline_overrides = {{0}};10031004 setlocale(LC_CTYPE, "");1005 setlocale(LC_MESSAGES, "");10061007 /* Auto-enable dmenu mode if invoked through a ‘dmenu’ symlink */1008 if (argv[0] != NULL) {Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
lines 1009–1013why, one step back1009 char *copy = xstrdup(argv[0]);1010 const char *name = basename(copy);1011 if (name != NULL && strcmp(name, "dmenu") == 0) {1012 cmdline_overrides.conf.dmenu.enabled = true;1013 cmdline_overrides.dmenu_enabled_set = true;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 1014why, one step back1014 }Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
lines 1015–1016why, one step back10151016 free(copy);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1017–1019why, one step back1017 }10181019 while (true) {wayland: allow setting namespace in config and from the command linefrostybefore adoption5255c0a
line 1020why, one step back1020 int c = getopt_long(argc, argv, ":n:o:f:D:IF:ia:l:w:x:y:p:P:b:t:m:s:S:M:B:r:C:T:dRvh", longopts, NULL);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1021–1032why, one step back1021 if (c == -1)1022 break;10231024 switch (c) {1025 case OPT_CONFIG:1026 config_path = optarg;1027 break;10281029 case OPT_CHECK_CONFIG:1030 check_config = true;1031 break;1032wayland: allow setting namespace in config and from the command linefrostybefore adoption5255c0a
lines 1033–1036why, one step back1033 case 'n':1034 cmdline_overrides.conf.namespace = optarg;1035 break;1036wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 1037why, one step back1037 case OPT_CACHE:config: add 'cache' optionDaniel Eklöfbefore adoption035532e
line 1038why, one step back1038 cmdline_overrides.conf.cache_path = optarg;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1039–1048why, one step back1039 break;10401041 case 'o':1042 cmdline_overrides.conf.output = optarg;1043 break;10441045 case 'f':1046 cmdline_overrides.conf.font = optarg;1047 break;1048render: add support for rendering the selected entry in boldDaniel Eklöfbefore adoption8d77e69
lines 1049–1053why, one step back1049 case OPT_USE_BOLD:1050 cmdline_overrides.conf.use_bold = true;1051 cmdline_overrides.use_bold_set = true;1052 break;1053wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1054–1071why, one step back1054 case 'D':1055 if (strcmp(optarg, "auto") == 0)1056 cmdline_overrides.conf.dpi_aware = DPI_AWARE_AUTO;1057 else if (strcmp(optarg, "no") == 0)1058 cmdline_overrides.conf.dpi_aware = DPI_AWARE_NO;1059 else if (strcmp(optarg, "yes") == 0)1060 cmdline_overrides.conf.dpi_aware = DPI_AWARE_YES;1061 else {1062 fprintf(1063 stderr,1064 "%s: invalid value for dpi-aware: "1065 "must be one of 'auto', 'no', or 'yes'\n",1066 optarg);1067 return EXIT_FAILURE;1068 }1069 cmdline_overrides.dpi_aware_set = true;1070 break;1071Implement gamma-correct blendingDaniel Eklöfbefore adoption2d19826
lines 1072–1076why, one step back1072 case OPT_GAMMA_CORRECT:1073 cmdline_overrides.conf.gamma_correct = true;1074 cmdline_overrides.gamma_correct_set = true;1075 break;1076wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1077–1090why, one step back1077 case 'i':1078 /* Ignore (this flag means case insensitive search in1079 * other fuzzel-like utilities) */1080 break;10811082 case OPT_ICON_THEME:1083 cmdline_overrides.conf.icon_theme = optarg;1084 break;10851086 case 'I':1087 cmdline_overrides.conf.icons_enabled = false;1088 cmdline_overrides.icons_disabled_set = true;1089 break;1090Merge branch 'hide-when-prompt-empty'Mark Stosbergbefore adoptionc06d69e
lines 1091–1095why, one step back1091 case OPT_HIDE_WHEN_PROMPT_EMPTY:1092 cmdline_overrides.conf.hide_when_prompt_empty = true;1093 cmdline_overrides.hide_when_prompt_empty_set = true;1094 break;1095wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1096–1116why, one step back1096 case 'F': {1097 static const struct {1098 const char *name;1099 enum match_fields value;1100 } map[] = {1101 {"filename", MATCH_FILENAME},1102 {"name", MATCH_NAME},1103 {"generic", MATCH_GENERIC},1104 {"exec", MATCH_EXEC},1105 {"categories", MATCH_CATEGORIES},1106 {"keywords", MATCH_KEYWORDS},1107 {"comment", MATCH_COMMENT},1108 };11091110 cmdline_overrides.conf.match_fields = 0;1111 for (const char *f = strtok(optarg, ", ");1112 f != NULL;1113 f = strtok(NULL, ", "))1114 {1115 enum match_fields field = 0;1116Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 1117why, one step back1117 for (size_t i = 0; i < ALEN(map); i++) {wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1118–1127why, one step back1118 if (strcmp(f, map[i].name) == 0) {1119 field = map[i].value;1120 break;1121 }1122 }11231124 if (field > 0)1125 cmdline_overrides.conf.match_fields |= field;1126 else {1127 char valid_names[128] = {0};Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
lines 1128–1130why, one step back1128 size_t idx = 0;1129 for (size_t i = 0; i < ALEN(map); i++) {1130 idx += xsnprintf(wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1131–1221why, one step back1131 &valid_names[idx], sizeof(valid_names) - idx,1132 "'%s', ", map[i].name);1133 }11341135 valid_names[idx - 2] = '\0';11361137 fprintf(1138 stderr,1139 "%s: invalid field name: must be one of %s\n",1140 f, valid_names);1141 return EXIT_FAILURE;1142 }1143 }1144 cmdline_overrides.match_fields_set = true;1145 break;1146 }11471148 case OPT_PASSWORD: {1149 char32_t password_char = U'\0';1150 if (optarg != NULL) {1151 char32_t *wide_optarg = ambstoc32(optarg);1152 if (wide_optarg == NULL){1153 fprintf(stderr, "%s: invalid password character\n", optarg);1154 return EXIT_FAILURE;1155 }11561157 if (c32len(wide_optarg) > 1) {1158 fprintf(1159 stderr,1160 "%s: password character must be a single character\n",1161 optarg);1162 free(wide_optarg);1163 return EXIT_FAILURE;1164 }11651166 password_char = wide_optarg[0];1167 free(wide_optarg);1168 cmdline_overrides.conf.password_mode.character_set = true;1169 }11701171 cmdline_overrides.conf.password_mode.enabled = true;1172 cmdline_overrides.conf.password_mode.character = password_char;1173 break;1174 }11751176 case 'T':1177 cmdline_overrides.conf.terminal = optarg;1178 break;11791180 case 'a': {1181 enum anchors anchor;1182 bool valid_anchor = false;11831184 for (size_t i = 0; anchors_map[i].name != NULL; i++) {1185 if (strcmp(optarg, anchors_map[i].name) == 0) {1186 anchor = anchors_map[i].value;1187 valid_anchor = true;1188 break;1189 }1190 }11911192 if (!valid_anchor) {1193 fprintf(stderr, "%s: invalid anchor\n", optarg);1194 return EXIT_FAILURE;1195 }11961197 cmdline_overrides.conf.anchor = anchor;1198 cmdline_overrides.anchor_set = true;1199 break;1200 }12011202 case OPT_X_MARGIN:1203 if (sscanf(optarg, "%u", &cmdline_overrides.conf.margin.x) != 1) {1204 fprintf(stderr, "%s: invalid horizontal margin\n", optarg);1205 return EXIT_FAILURE;1206 }1207 cmdline_overrides.x_margin_set = true;1208 break;12091210 case OPT_Y_MARGIN:1211 if (sscanf(optarg, "%u", &cmdline_overrides.conf.margin.y) != 1) {1212 fprintf(stderr, "%s: invalid vertical margin\n", optarg);1213 return EXIT_FAILURE;1214 }1215 cmdline_overrides.y_margin_set = true;1216 break;12171218 case OPT_SELECT:1219 select = optarg;1220 break;1221Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
lines 1222–1231why, one step back1222 case OPT_SELECT_INDEX:1223 if (sscanf(optarg, "%zu", &select_idx) != 1) {1224 fprintf(1225 stderr,1226 "%s: invalid selected index (must be an integer)\n",1227 optarg);1228 return EXIT_FAILURE;1229 }1230 break;1231wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1232–1239why, one step back1232 case 'l':1233 if (sscanf(optarg, "%u", &cmdline_overrides.conf.lines) != 1) {1234 fprintf(stderr, "%s: invalid line count\n", optarg);1235 return EXIT_FAILURE;1236 }1237 cmdline_overrides.lines_set = true;1238 break;1239Add new --minimal-flag optionMark Stosbergbefore adoption6200008
lines 1240–1244why, one step back1240 case OPT_MINIMAL_LINES:1241 cmdline_overrides.conf.minimal_lines = true;1242 cmdline_overrides.minimal_lines_set = true;1243 break;1244✨ New Feature: Hide Input Line (#597)Mark Stosbergbefore adoption1ea0283
lines 1245–1249why, one step back1245 case OPT_HIDE_PROMPT:1246 cmdline_overrides.conf.hide_prompt = true;1247 cmdline_overrides.hide_prompt_set = true;1248 break;1249wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1250–1300why, one step back1250 case 'w':1251 if (sscanf(optarg, "%u", &cmdline_overrides.conf.chars) != 1) {1252 fprintf(stderr, "%s: invalid width\n", optarg);1253 return EXIT_FAILURE;1254 }1255 cmdline_overrides.chars_set = true;1256 break;12571258 case OPT_TABS:1259 if (sscanf(optarg, "%u", &cmdline_overrides.conf.tabs) != 1) {1260 fprintf(stderr, "%s: invalid tab count\n", optarg);1261 return EXIT_FAILURE;1262 }1263 cmdline_overrides.tabs_set = true;1264 break;12651266 case 'x':1267 if (sscanf(optarg, "%u", &cmdline_overrides.conf.pad.x) != 1) {1268 fprintf(stderr, "%s: invalid padding\n", optarg);1269 return EXIT_FAILURE;1270 }1271 cmdline_overrides.pad_x_set = true;1272 break;12731274 case 'y':1275 if (sscanf(optarg, "%u", &cmdline_overrides.conf.pad.y) != 1) {1276 fprintf(stderr, "%s: invalid padding\n", optarg);1277 return EXIT_FAILURE;1278 }1279 cmdline_overrides.pad_y_set = true;1280 break;12811282 case 'P':1283 if (sscanf(optarg, "%u", &cmdline_overrides.conf.pad.inner) != 1) {1284 fprintf(stderr, "%s: invalid padding\n", optarg);1285 return EXIT_FAILURE;1286 }1287 cmdline_overrides.pad_inner_set = true;1288 break;12891290 case 'p':1291 free(cmdline_overrides.conf.prompt);1292 cmdline_overrides.conf.prompt = ambstoc32(optarg);12931294 if (cmdline_overrides.conf.prompt == NULL) {1295 fprintf(stderr, "%s: invalid prompt\n", optarg);1296 return EXIT_FAILURE;1297 }12981299 break;1300main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
lines 1301–1313why, one step back1301 case OPT_PROMPT_ONLY:1302 free(cmdline_overrides.conf.prompt);1303 cmdline_overrides.conf.prompt = ambstoc32(optarg);13041305 if (cmdline_overrides.conf.prompt == NULL) {1306 fprintf(stderr, "%s: invalid prompt\n", optarg);1307 return EXIT_FAILURE;1308 }13091310 cmdline_overrides.prompt_only_set = true;1311 cmdline_overrides.conf.prompt_only = true;1312 break;1313render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
lines 1314–1324why, one step back1314 case OPT_PLACEHOLDER:1315 free(cmdline_overrides.conf.placeholder);1316 cmdline_overrides.conf.placeholder = ambstoc32(optarg);13171318 if (cmdline_overrides.conf.placeholder == NULL) {1319 fprintf(stderr, "%s: invalid placeholder\n", optarg);1320 return EXIT_FAILURE;1321 }13221323 break;1324main: add --search, letting you specify the initial search/filtering stringDaniel Eklöfbefore adoptionf74d4fb
lines 1325–1335why, one step back1325 case OPT_SEARCH_TEXT:1326 free(cmdline_overrides.conf.search_text);1327 cmdline_overrides.conf.search_text = ambstoc32(optarg);13281329 if (cmdline_overrides.conf.search_text == NULL) {1330 fprintf(stderr, "%s: invalid search text\n", optarg);1331 return EXIT_FAILURE;1332 }13331334 break;1335wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1336–1388why, one step back1336 case 'b': {1337 const char *clr_start = optarg;1338 if (clr_start[0] == '#')1339 clr_start++;13401341 errno = 0;1342 char *end = NULL;1343 uint32_t background = strtoul(clr_start, &end, 16);1344 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1345 fprintf(stderr, "background-color: %s: invalid color\n",1346 optarg);1347 return EXIT_FAILURE;1348 }1349 cmdline_overrides.conf.colors.background =1350 conf_hex_to_rgba(background);1351 cmdline_overrides.background_color_set = true;1352 break;1353 }13541355 case 't': {1356 const char *clr_start = optarg;1357 if (clr_start[0] == '#')1358 clr_start++;13591360 errno = 0;1361 char *end = NULL;1362 uint32_t text_color = strtoul(clr_start, &end, 16);1363 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1364 fprintf(stderr, "text-color: %s: invalid color\n", optarg);1365 return EXIT_FAILURE;1366 }1367 cmdline_overrides.conf.colors.text = conf_hex_to_rgba(text_color);1368 cmdline_overrides.text_color_set = true;1369 break;1370 }13711372 case OPT_PROMPT_COLOR: {1373 const char *clr_start = optarg;1374 if (clr_start[0] == '#')1375 clr_start++;13761377 errno = 0;1378 char *end = NULL;1379 uint32_t prompt_color = strtoul(clr_start, &end, 16);1380 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1381 fprintf(stderr, "prompt-color: %s: invalid color\n", optarg);1382 return EXIT_FAILURE;1383 }1384 cmdline_overrides.conf.colors.prompt = conf_hex_to_rgba(prompt_color);1385 cmdline_overrides.prompt_color_set = true;1386 break;1387 }1388render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
lines 1389–1405why, one step back1389 case OPT_PLACEHOLDER_COLOR: {1390 const char *clr_start = optarg;1391 if (clr_start[0] == '#')1392 clr_start++;13931394 errno = 0;1395 char *end = NULL;1396 uint32_t placeholder_color = strtoul(clr_start, &end, 16);1397 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1398 fprintf(stderr, "placeholder-color: %s: invalid color\n", optarg);1399 return EXIT_FAILURE;1400 }1401 cmdline_overrides.conf.colors.placeholder = conf_hex_to_rgba(placeholder_color);1402 cmdline_overrides.placeholder_color_set = true;1403 break;1404 }1405wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1406–1477why, one step back1406 case OPT_INPUT_COLOR: {1407 const char *clr_start = optarg;1408 if (clr_start[0] == '#')1409 clr_start++;14101411 errno = 0;1412 char *end = NULL;1413 uint32_t input_color = strtoul(clr_start, &end, 16);1414 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1415 fprintf(stderr, "prompt-color: %s: invalid color\n", optarg);1416 return EXIT_FAILURE;1417 }1418 cmdline_overrides.conf.colors.input = conf_hex_to_rgba(input_color);1419 cmdline_overrides.input_color_set = true;1420 break;1421 }14221423 case 'm': {1424 const char *clr_start = optarg;1425 if (clr_start[0] == '#')1426 clr_start++;14271428 errno = 0;1429 char *end = NULL;1430 uint32_t match_color = strtoul(clr_start, &end, 16);1431 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1432 fprintf(stderr, "match-color: %s: invalid color\n", optarg);1433 return EXIT_FAILURE;1434 }1435 cmdline_overrides.conf.colors.match =1436 conf_hex_to_rgba(match_color);1437 cmdline_overrides.match_color_set = true;1438 break;1439 }14401441 case 's': {1442 const char *clr_start = optarg;1443 if (clr_start[0] == '#')1444 clr_start++;14451446 errno = 0;1447 char *end = NULL;1448 uint32_t selection_color = strtoul(clr_start, &end, 16);1449 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1450 fprintf(stderr, "selection-color: %s: invalid color\n", optarg);1451 return EXIT_FAILURE;1452 }1453 cmdline_overrides.conf.colors.selection =1454 conf_hex_to_rgba(selection_color);1455 cmdline_overrides.selection_color_set = true;1456 break;1457 }14581459 case 'S': {1460 const char *clr_start = optarg;1461 if (clr_start[0] == '#')1462 clr_start++;14631464 errno = 0;1465 char *end = NULL;1466 uint32_t selection_text_color = strtoul(clr_start, &end, 16);1467 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1468 fprintf(stderr, "selection-text-color: %s: invalid color\n",1469 optarg);1470 return EXIT_FAILURE;1471 }1472 cmdline_overrides.conf.colors.selection_text =1473 conf_hex_to_rgba(selection_text_color);1474 cmdline_overrides.selection_text_color_set = true;1475 break;1476 }1477feat: border radius for selected entrieswisplbefore adoption9836d81
lines 1478–1487why, one step back1478 case OPT_SELECTION_RADIUS: {1479 if (sscanf(optarg, "%u", &cmdline_overrides.conf.selection_border.radius) != 1) {1480 fprintf(stderr, "%s: invalid selection border radius (must be an integer)\n",1481 optarg);1482 return EXIT_FAILURE;1483 }1484 cmdline_overrides.selection_border_radius_set = true;1485 break;1486 }1487wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1488–1506why, one step back1488 case 'M': {1489 const char *clr_start = optarg;1490 if (clr_start[0] == '#')1491 clr_start++;14921493 errno = 0;1494 char *end = NULL;1495 uint32_t selection_match_color = strtoul(clr_start, &end, 16);1496 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1497 fprintf(stderr, "selection-match-color: %s: invalid color\n",1498 optarg);1499 return EXIT_FAILURE;1500 }1501 cmdline_overrides.conf.colors.selection_match =1502 conf_hex_to_rgba(selection_match_color);1503 cmdline_overrides.selection_match_color_set = true;1504 break;1505 }1506config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
line 1507why, one step back1507 case OPT_COUNTER_COLOR: {render: display match+total entry countDaniel Eklöfbefore adoptionb32836d
lines 1508–1515why, one step back1508 const char *clr_start = optarg;1509 if (clr_start[0] == '#')1510 clr_start++;15111512 errno = 0;1513 char *end = NULL;1514 uint32_t count_color = strtoul(clr_start, &end, 16);1515 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
line 1516why, one step back1516 fprintf(stderr, "counter-color: %s: invalid color\n",render: display match+total entry countDaniel Eklöfbefore adoptionb32836d
lines 1517–1519why, one step back1517 optarg);1518 return EXIT_FAILURE;1519 }config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
lines 1520–1521why, one step back1520 cmdline_overrides.conf.colors.counter = conf_hex_to_rgba(count_color);1521 cmdline_overrides.counter_color_set = true;render: display match+total entry countDaniel Eklöfbefore adoptionb32836d
lines 1522–1525why, one step back1522 break;1523 }15241525wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1526–1575why, one step back1526 case 'B':1527 if (sscanf(optarg, "%u", &cmdline_overrides.conf.border.size) != 1) {1528 fprintf(1529 stderr,1530 "%s: invalid border width (must be an integer)\n", optarg);1531 return EXIT_FAILURE;1532 }1533 cmdline_overrides.border_size_set = true;1534 break;15351536 case 'r':1537 if (sscanf(optarg, "%u", &cmdline_overrides.conf.border.radius) != 1) {1538 fprintf(stderr, "%s: invalid border radius (must be an integer)\n",1539 optarg);1540 return EXIT_FAILURE;1541 }1542 cmdline_overrides.border_radius_set = true;1543 break;15441545 case 'C': {1546 const char *clr_start = optarg;1547 if (clr_start[0] == '#')1548 clr_start++;15491550 errno = 0;1551 char *end = NULL;1552 uint32_t border_color = strtoul(clr_start, &end, 16);1553 if (errno != 0 || end == NULL || *end != '\0' || (end - clr_start) != 8) {1554 fprintf(stderr, "border-color: %s: invalid color\n", optarg);1555 return EXIT_FAILURE;1556 }1557 cmdline_overrides.conf.colors.border =1558 conf_hex_to_rgba(border_color);1559 cmdline_overrides.border_color_set = true;1560 break;1561 }15621563 case OPT_SHOW_ACTIONS:1564 cmdline_overrides.actions_enabled_set = true;1565 cmdline_overrides.conf.actions_enabled = true;1566 break;15671568 case OPT_MATCH_MODE:1569 if (strcmp(optarg, "exact") == 0)1570 cmdline_overrides.conf.match_mode = MATCH_MODE_EXACT;1571 else if (strcmp(optarg, "fzf") == 0)1572 cmdline_overrides.conf.match_mode = MATCH_MODE_FZF;1573 else if (strcmp(optarg, "fuzzy") == 0)1574 cmdline_overrides.conf.match_mode = MATCH_MODE_FUZZY;1575 else {diagnostics: Provide a hint when match-mode is invalidMark Stosbergbefore adoption229a5d5
line 1576why, one step back1576 fprintf(stderr, "%s: invalid match-mode. Must be 'exact', 'fuzzy' or 'fzf'\n", optarg);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1577–1582why, one step back1577 return EXIT_FAILURE;1578 }15791580 cmdline_overrides.match_mode_set = true;1581 break;1582render: display match+total entry countDaniel Eklöfbefore adoptionb32836d
lines 1583–1594why, one step back1583 case OPT_FILTER_DESKTOP:1584 cmdline_overrides.filter_desktop_set = true;1585 if (optarg != NULL && strcasecmp(optarg, "no") == 0)1586 cmdline_overrides.conf.filter_desktop = false;1587 else if (optarg != NULL) {1588 fprintf(stderr, "%s: invalid filter-desktop option\n", optarg);1589 return EXIT_FAILURE;1590 }1591 else1592 cmdline_overrides.conf.filter_desktop = true;1593 break;1594wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1595–1665why, one step back1595 case OPT_FUZZY_MIN_LENGTH:1596 if (sscanf(optarg, "%zu", &cmdline_overrides.conf.fuzzy.min_length) != 1) {1597 fprintf(1598 stderr,1599 "%s: invalid fuzzy min length (must be an integer)\n",1600 optarg);1601 return EXIT_FAILURE;1602 }1603 cmdline_overrides.fuzzy_min_length_set = true;1604 break;16051606 case OPT_FUZZY_MAX_LENGTH_DISCREPANCY:1607 if (sscanf(optarg, "%zu", &cmdline_overrides.conf.fuzzy.max_length_discrepancy) != 1) {1608 fprintf(1609 stderr,1610 "%s: invalid fuzzy max length discrepancy "1611 "(must be an integer)\n", optarg);1612 return EXIT_FAILURE;1613 }1614 cmdline_overrides.fuzzy_max_length_discrepancy_set = true;1615 break;16161617 case OPT_FUZZY_MAX_DISTANCE:1618 if (sscanf(optarg, "%zu", &cmdline_overrides.conf.fuzzy.max_distance) != 1) {1619 fprintf(1620 stderr,1621 "%s: invalid fuzzy max distance (must be an integer)\n",1622 optarg);1623 return EXIT_FAILURE;1624 }1625 cmdline_overrides.fuzzy_max_distance_set = true;1626 break;16271628 case OPT_LIST_EXECS_IN_PATH:1629 cmdline_overrides.conf.list_executables_in_path = true;1630 break;16311632 case 'H': { /* line-height */1633 if (!pt_or_px_from_string(optarg, &cmdline_overrides.conf.line_height))1634 return EXIT_FAILURE;1635 cmdline_overrides.line_height_set = true;1636 break;1637 }16381639 case OPT_LETTER_SPACING: {1640 if (!pt_or_px_from_string(optarg, &cmdline_overrides.conf.letter_spacing))1641 return EXIT_FAILURE;1642 cmdline_overrides.letter_spacing_set = true;1643 break;1644 }16451646 case OPT_LAUNCH_PREFIX: {1647 cmdline_overrides.conf.launch_prefix = optarg;1648 break;1649 }16501651 case OPT_LAYER:1652 if (strcasecmp(optarg, "top") == 0)1653 cmdline_overrides.conf.layer = ZWLR_LAYER_SHELL_V1_LAYER_TOP;1654 else if (strcasecmp(optarg, "overlay") == 0)1655 cmdline_overrides.conf.layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY;1656 else {1657 fprintf(1658 stderr,1659 "%s: invalid layer. Must be one of 'top', 'overlay'\n",1660 optarg);1661 return EXIT_FAILURE;1662 }1663 cmdline_overrides.layer_set = true;1664 break;1665Add `keyboard-focus=exclusive|on-demand` command line and config optionbbb651before adoption9a0a38d
lines 1666–1680why, one step back1666 case OPT_KEYBOARD_FOCUS:1667 if (strcasecmp(optarg, "exclusive") == 0)1668 cmdline_overrides.conf.keyboard_focus = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;1669 else if (strcasecmp(optarg, "on-demand") == 0)1670 cmdline_overrides.conf.keyboard_focus = ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND;1671 else {1672 fprintf(1673 stderr,1674 "%s: invalid keyboard-focus. Must be one of 'exclusive', 'on-demand'\n",1675 optarg);1676 return EXIT_FAILURE;1677 }1678 cmdline_overrides.keyboard_focus_set = true;1679 break;1680wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1681–1707why, one step back1681 case OPT_NO_EXIT_ON_KB_LOSS:1682 cmdline_overrides.conf.exit_on_kb_focus_loss = false;1683 cmdline_overrides.no_exit_on_keyboard_focus_loss_set = true;1684 break;16851686 case 'd':1687 cmdline_overrides.conf.dmenu.enabled = true;1688 cmdline_overrides.dmenu_enabled_set = true;1689 break;16901691 case OPT_DMENU_NULL:1692 cmdline_overrides.conf.dmenu.enabled = true;1693 cmdline_overrides.conf.dmenu.delim = '\0';1694 cmdline_overrides.dmenu_enabled_set = true;1695 cmdline_overrides.dmenu_delim_set = true;1696 break;16971698 case 'R':1699 cmdline_overrides.conf.dmenu.exit_immediately_if_empty = true;1700 cmdline_overrides.dmenu_exit_immediately_if_empty_set = true;1701 break;17021703 case OPT_DMENU_INDEX:1704 cmdline_overrides.conf.dmenu.mode = DMENU_MODE_INDEX;1705 cmdline_overrides.dmenu_mode_set = true;1706 break;1707Add --with-nth=N command line optionDaniel Eklöfbefore adoption36471ff
lines 1708–1718why, one step back1708 case OPT_DMENU_WITH_NTH:1709 if (sscanf(optarg, "%u", &cmdline_overrides.conf.dmenu.render_column) != 1) {1710 fprintf(1711 stderr,1712 "%s: invalid with-nth value (must be an integer)\n",1713 optarg);1714 return EXIT_FAILURE;1715 }1716 cmdline_overrides.dmenu_with_nth_set = true;1717 break;1718Add `--accept-nth` command line option to select column to outputbbb651before adoption33c9b8e
lines 1719–1729why, one step back1719 case OPT_DMENU_ACCEPT_NTH:1720 if (sscanf(optarg, "%u", &cmdline_overrides.conf.dmenu.output_column) != 1) {1721 fprintf(1722 stderr,1723 "%s: invalid accept-nth value (must be an integer)\n",1724 optarg);1725 return EXIT_FAILURE;1726 }1727 cmdline_overrides.dmenu_accept_nth_set = true;1728 break;1729wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1730–1759why, one step back1730 case OPT_LOG_LEVEL: {1731 int lvl = log_level_from_string(optarg);1732 if (lvl < 0) {1733 fprintf(1734 stderr,1735 "--log-level: %s: argument must be one of %s\n",1736 optarg, log_level_string_hint());1737 return EXIT_FAILURE;1738 }1739 log_level = lvl;1740 break;1741 }17421743 case OPT_LOG_COLORIZE:1744 if (optarg == NULL || strcmp(optarg, "auto") == 0)1745 log_colorize = LOG_COLORIZE_AUTO;1746 else if (strcmp(optarg, "never") == 0)1747 log_colorize = LOG_COLORIZE_NEVER;1748 else if (strcmp(optarg, "always") == 0)1749 log_colorize = LOG_COLORIZE_ALWAYS;1750 else {1751 fprintf(stderr, "--log-colorize: %s: argument must be one of 'never', 'always' or 'auto'\n", optarg);1752 return EXIT_FAILURE;1753 }1754 break;17551756 case OPT_LOG_NO_SYSLOG:1757 log_syslog = false;1758 break;1759match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
line 1760why, one step back1760 case OPT_RENDER_WORKERS:render: render match list using multiple rendering threadsDaniel Eklöfbefore adoption20e0530
lines 1761–1763why, one step back1761 if (sscanf(optarg, "%hu", &cmdline_overrides.conf.render_worker_count) != 1) {1762 fprintf(1763 stderr,match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
line 1764why, one step back1764 "%s: invalid value for render-workers (must be an integer)\n",render: render match list using multiple rendering threadsDaniel Eklöfbefore adoption20e0530
lines 1765–1768why, one step back1765 optarg);1766 return EXIT_FAILURE;1767 }1768match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
line 1769why, one step back1769 cmdline_overrides.render_workers_set = true;render: render match list using multiple rendering threadsDaniel Eklöfbefore adoption20e0530
lines 1770–1771why, one step back1770 break;1771match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
lines 1772–1783why, one step back1772 case OPT_MATCH_WORKERS:1773 if (sscanf(optarg, "%hu", &cmdline_overrides.conf.match_worker_count) != 1) {1774 fprintf(1775 stderr,1776 "%s: invalid value for match-workers (must be an integer)\n",1777 optarg);1778 return EXIT_FAILURE;1779 }17801781 cmdline_overrides.match_workers_set = true;1782 break;1783config: add --no-sortDaniel Eklöfbefore adoptiond9e817a
lines 1784–1788why, one step back1784 case OPT_NO_SORT:1785 cmdline_overrides.conf.sort_result = false;1786 cmdline_overrides.no_sort_set = true;1787 break;1788config: disable match-counter by defaultDaniel Eklöfbefore adoption11ad859
lines 1789–1791why, one step back1789 case OPT_COUNTER:1790 cmdline_overrides.conf.match_counter = true;1791 cmdline_overrides.counter_set = true;config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
lines 1792–1793why, one step back1792 break;1793match: do matching/filtering using a thread poolDaniel Eklöfbefore adoption0c3be18
lines 1794–1811why, one step back1794 case OPT_DELAYED_FILTER_MS:1795 if (sscanf(optarg, "%u", &cmdline_overrides.conf.delayed_filter_ms) != 1) {1796 fprintf(stderr, "%s: invalid delayed-filter-ms (must be an integer)\n",1797 optarg);1798 return EXIT_FAILURE;1799 }1800 cmdline_overrides.delayed_filter_ms_set = true;1801 break;18021803 case OPT_DELAYED_FILTER_LIMIT:1804 if (sscanf(optarg, "%u", &cmdline_overrides.conf.delayed_filter_limit) != 1) {1805 fprintf(stderr, "%s: invalid delayed-filter-limit (must be an integer)\n",1806 optarg);1807 return EXIT_FAILURE;1808 }1809 cmdline_overrides.delayed_filter_limit_set = true;1810 break;1811config: add scaling-filter optionDaniel Eklöfbefore adoption3866f60
lines 1812–1837why, one step back1812 case OPT_SCALING_FILTER:1813 if (strcmp(optarg, "none") == 0)1814 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_NONE;1815 else if (strcmp(optarg, "nearest") == 0)1816 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_NEAREST;1817 else if (strcmp(optarg, "bilinear") == 0)1818 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_BILINEAR;1819 else if (strcmp(optarg, "box") == 0)1820 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_BOX;1821 else if (strcmp(optarg, "linear") == 0)1822 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_LINEAR;1823 else if (strcmp(optarg, "cubic") == 0)1824 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_CUBIC;1825 else if (strcmp(optarg, "lanczos2") == 0)1826 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_LANCZOS2;1827 else if (strcmp(optarg, "lanczos3") == 0)1828 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_LANCZOS3;1829 else if (strcmp(optarg, "lanczos3-stretched") == 0)1830 cmdline_overrides.conf.png_scaling_filter = SCALING_FILTER_LANCZOS3_STRETCHED;1831 else {1832 fprintf(stderr, "%s: invalid scaling-filter", optarg);1833 return EXIT_FAILURE;1834 }1835 cmdline_overrides.scaling_filter_set = true;1836 break;1837debug: add a --print-timing-info command line optionDaniel Eklöfbefore adoption1ea01b1
lines 1838–1842why, one step back1838 case OPT_PRINT_TIMINGS:1839 cmdline_overrides.conf.print_timing_info = true;1840 cmdline_overrides.print_timing_info_set = true;1841 break;1842✨ Add --auto-select opt. When one entry is left, automatically select it.Mark Stosbergbefore adoption5751a65
lines 1843–1846why, one step back1843 case OPT_AUTO_SELECT:1844 cmdline_overrides.conf.auto_select = true;1845 break;1846wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1847–1869why, one step back1847 case 'v':1848 printf("fuzzel %s\n", version_and_features());1849 return EXIT_SUCCESS;18501851 case 'h':1852 print_usage(argv[0]);1853 return EXIT_SUCCESS;18541855 case ':':1856 fprintf(stderr, "error: %s: missing required argument\n", argv[optind-1]);1857 return EXIT_FAILURE;18581859 case '?':1860 fprintf(stderr, "error: %s: invalid option\n", argv[optind-1]);1861 return EXIT_FAILURE;1862 }1863 }18641865 log_init(log_colorize, log_syslog, LOG_FACILITY_USER, log_level);1866 LOG_INFO("%s", version_and_features());18671868 int ret = EXIT_FAILURE;1869Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
line 1870why, one step back1870 if (select != NULL && select_idx) {✨ New Feature: Hide Input Line (#597)Mark Stosbergbefore adoption1ea0283
lines 1871–1872why, one step back1871 LOG_ERRNO("--select and --select-index cannot be used at the same time");1872 return ret;Add --select-index=INDEX command line optionWekuzbefore adoptiona798c80
lines 1873–1874why, one step back1873 }1874✨ New Feature: Hide Input Line (#597)Mark Stosbergbefore adoption1ea0283
lines 1875–1880why, one step back1875 if (cmdline_overrides.prompt_only_set && cmdline_overrides.conf.hide_prompt) {1876 LOG_ERRNO("--prompt-only and --hide-prompt cannot be used at the same time");1877 config_free(&cmdline_overrides.conf);1878 return ret;1879 }1880wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1881–1884why, one step back1881 struct config conf = {0};1882 bool conf_successful = config_load(&conf, config_path, NULL, check_config);1883 if (!conf_successful) {1884 config_free(&conf);main: fix possible memory leak(s) when failing to load configDaniel Eklöfbefore adoption0d0e65f
line 1885why, one step back1885 config_free(&cmdline_overrides.conf);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1886–1890why, one step back1886 return ret;1887 }18881889 if (check_config) {1890 config_free(&conf);main: fix possible memory leak(s) when failing to load configDaniel Eklöfbefore adoption0d0e65f
line 1891why, one step back1891 config_free(&cmdline_overrides.conf);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1892–1897why, one step back1892 return EXIT_SUCCESS;1893 }18941895 /* Apply command line overrides */1896 if (cmdline_overrides.conf.output != NULL) {1897 free(conf.output);Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 1898why, one step back1898 conf.output = xstrdup(cmdline_overrides.conf.output);wayland: allow setting namespace in config and from the command linefrostybefore adoption5255c0a
lines 1899–1902why, one step back1899 }1900 if (cmdline_overrides.conf.namespace != NULL) {1901 free(conf.namespace);1902 conf.namespace = xstrdup(cmdline_overrides.conf.namespace);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1903–1906why, one step back1903 }1904 if (cmdline_overrides.conf.prompt != NULL) {1905 free(conf.prompt);1906 conf.prompt = cmdline_overrides.conf.prompt;main: add --prompt-onlyDaniel Eklöfbefore adoptionfd76db4
lines 1907–1908why, one step back1907 if (cmdline_overrides.prompt_only_set)1908 conf.prompt_only = cmdline_overrides.conf.prompt_only;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 1909why, one step back1909 }render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
lines 1910–1912why, one step back1910 if (cmdline_overrides.conf.placeholder != NULL) {1911 free(conf.placeholder);1912 conf.placeholder = cmdline_overrides.conf.placeholder;main: add --search, letting you specify the initial search/filtering stringDaniel Eklöfbefore adoptionf74d4fb
lines 1913–1916why, one step back1913 }1914 if (cmdline_overrides.conf.search_text != NULL) {1915 free(conf.search_text);1916 conf.search_text = cmdline_overrides.conf.search_text;render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
line 1917why, one step back1917 }wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1918–1928why, one step back1918 if (cmdline_overrides.conf.password_mode.enabled) {1919 conf.password_mode.enabled = true;1920 conf.password_mode.character =1921 cmdline_overrides.conf.password_mode.character_set1922 ? cmdline_overrides.conf.password_mode.character1923 : conf.password_mode.character_set1924 ? conf.password_mode.character1925 : U'*';1926 }1927 if (cmdline_overrides.conf.terminal != NULL) {1928 free(conf.terminal);Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 1929why, one step back1929 conf.terminal = xstrdup(cmdline_overrides.conf.terminal);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1930–1932why, one step back1930 }1931 if (cmdline_overrides.conf.launch_prefix != NULL) {1932 free(conf.launch_prefix);Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 1933why, one step back1933 conf.launch_prefix = xstrdup(cmdline_overrides.conf.launch_prefix);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1934–1936why, one step back1934 }1935 if (cmdline_overrides.conf.font != NULL) {1936 free(conf.font);Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 1937why, one step back1937 conf.font = xstrdup(cmdline_overrides.conf.font);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
line 1938why, one step back1938 }render: add support for rendering the selected entry in boldDaniel Eklöfbefore adoption8d77e69
lines 1939–1940why, one step back1939 if (cmdline_overrides.use_bold_set)1940 conf.use_bold = cmdline_overrides.conf.use_bold;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1941–1942why, one step back1941 if (cmdline_overrides.conf.icon_theme != NULL) {1942 free(conf.icon_theme);Add xmalloc.h and xsnprintf.h and use to improve/simplify error handlingCraig Barnesbefore adoption539d514
line 1943why, one step back1943 conf.icon_theme = xstrdup(cmdline_overrides.conf.icon_theme);wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1944–1946why, one step back1944 }1945 if (cmdline_overrides.dpi_aware_set)1946 conf.dpi_aware = cmdline_overrides.conf.dpi_aware;Implement gamma-correct blendingDaniel Eklöfbefore adoption2d19826
lines 1947–1948why, one step back1947 if (cmdline_overrides.gamma_correct_set)1948 conf.gamma_correct = cmdline_overrides.conf.gamma_correct;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1949–1952why, one step back1949 if (cmdline_overrides.match_fields_set)1950 conf.match_fields = cmdline_overrides.conf.match_fields;1951 if (cmdline_overrides.icons_disabled_set)1952 conf.icons_enabled = cmdline_overrides.conf.icons_enabled;Merge branch 'hide-when-prompt-empty'Mark Stosbergbefore adoptionc06d69e
lines 1953–1954why, one step back1953 if (cmdline_overrides.hide_when_prompt_empty_set)1954 conf.hide_when_prompt_empty = cmdline_overrides.conf.hide_when_prompt_empty;✨ New Feature: Hide Input Line (#597)Mark Stosbergbefore adoption1ea0283
lines 1955–1956why, one step back1955 if (cmdline_overrides.hide_prompt_set)1956 conf.hide_prompt = cmdline_overrides.conf.hide_prompt;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1957–1964why, one step back1957 if (cmdline_overrides.anchor_set)1958 conf.anchor = cmdline_overrides.conf.anchor;1959 if (cmdline_overrides.x_margin_set)1960 conf.margin.x = cmdline_overrides.conf.margin.x;1961 if (cmdline_overrides.y_margin_set)1962 conf.margin.y = cmdline_overrides.conf.margin.y;1963 if (cmdline_overrides.lines_set)1964 conf.lines = cmdline_overrides.conf.lines;Add new --minimal-flag optionMark Stosbergbefore adoption6200008
lines 1965–1966why, one step back1965 if (cmdline_overrides.minimal_lines_set)1966 conf.minimal_lines = cmdline_overrides.conf.minimal_lines;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1967–1982why, one step back1967 if (cmdline_overrides.chars_set)1968 conf.chars = cmdline_overrides.conf.chars;1969 if (cmdline_overrides.tabs_set)1970 conf.tabs = cmdline_overrides.conf.tabs;1971 if (cmdline_overrides.pad_x_set)1972 conf.pad.x = cmdline_overrides.conf.pad.x;1973 if (cmdline_overrides.pad_y_set)1974 conf.pad.y = cmdline_overrides.conf.pad.y;1975 if (cmdline_overrides.pad_inner_set)1976 conf.pad.inner = cmdline_overrides.conf.pad.inner;1977 if (cmdline_overrides.background_color_set)1978 conf.colors.background = cmdline_overrides.conf.colors.background;1979 if (cmdline_overrides.text_color_set)1980 conf.colors.text = cmdline_overrides.conf.colors.text;1981 if (cmdline_overrides.prompt_color_set)1982 conf.colors.prompt = cmdline_overrides.conf.colors.prompt;render: add support for a placeholder text, in the input boxDaniel Eklöfbefore adoption9e615ce
lines 1983–1984why, one step back1983 if (cmdline_overrides.placeholder_color_set)1984 conf.colors.placeholder = cmdline_overrides.conf.colors.placeholder;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1985–1994why, one step back1985 if (cmdline_overrides.input_color_set)1986 conf.colors.input = cmdline_overrides.conf.colors.input;1987 if (cmdline_overrides.match_color_set)1988 conf.colors.match = cmdline_overrides.conf.colors.match;1989 if (cmdline_overrides.selection_color_set)1990 conf.colors.selection = cmdline_overrides.conf.colors.selection;1991 if (cmdline_overrides.selection_text_color_set)1992 conf.colors.selection_text = cmdline_overrides.conf.colors.selection_text;1993 if (cmdline_overrides.selection_match_color_set)1994 conf.colors.selection_match = cmdline_overrides.conf.colors.selection_match;feat: border radius for selected entrieswisplbefore adoption9836d81
lines 1995–1996why, one step back1995 if (cmdline_overrides.selection_border_radius_set)1996 conf.selection_border.radius = cmdline_overrides.conf.selection_border.radius;config: add 'match-counter' option, allowing you to disable the match counterDaniel Eklöfbefore adoption6a99846
lines 1997–1998why, one step back1997 if (cmdline_overrides.counter_color_set)1998 conf.colors.counter = cmdline_overrides.conf.colors.counter;wayland: performance: render frames on-demand, rather than eagrlyDaniel Eklöfbefore adoption99f03a9
lines 1999–2022why, one step back1999 if (cmdline_overrides.border_color_set)2000 conf.colors.border = cmdline_overrides.conf.colors.border;The first 2,000 of 2,279 lines.