Skip to content
Myr

Add margin (spacing relative the anchor point) support

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Closes #344

authored by Jordi Estrada · committed by Daniel Eklöf · parent 0086085 · Browse files · 10 files+77 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+77 added−0 removed

  • other:+77 added−0 removed

10 files+77 added−0 removed

modified:completions/fish/fuzzel.fish+2 added
22 unmodified lines
23# TODO: this currently doesn’t quote the completed argument24complete -c fuzzel -x -s T -l terminal -a "(__fish_complete_subcommand)" -d "terminal command, with arguments ($TERMINAL -e)"2526complete -c fuzzel -x -s a -l anchor -a "top-left top top-right left center right bottom-left bottom bottom-right" -d "set window anchor (center)"27complete -c fuzzel -x -l x-margin -d "horizontal margin away from the anchor point in pixels (0)"28complete -c fuzzel -x -l y-margin -d "vertical margin away from the anchor point in pixels (0)"29complete -c fuzzel -x -l select -d "select the first entry that matches the given string"30complete -c fuzzel -x -s l -l lines -d "maximum number of matches to displayh (15)"31complete -c fuzzel -x -s w -l width -d "window width, in characters (30)"32complete -c fuzzel -x -s x -l horizontal-pad -d "horizontal padding, in pixels (40)"
30 unmodified lines
modified:completions/zsh/_fuzzel+2 added
14 unmodified lines
15 '(-p --prompt)'{-p,--prompt}'[string to use as input prompt ("> ")]:()' \16 '--password[render all input using either "*", or the specified character]:()' \17 '(-T --terminal)'{-T,--terminal}'[terminal command, with arguments ($TERMINAL -e)]:terminal:_command_names -e' \18 '(-a --anchor)'{-a,--anchor}'[set window anchor (center)]:anchors:(top-left top top-right left center right bottom-left bottom bottom-right)' \19 '--x-margin[horizontal margin away from the anchor point in pixels (0)]:()' \20 '--y-margin[vertical margin away from the anchor point in pixels (0)]:()' \21 '--select[select the first entry that matches the given string]:()' \22 '(-l --lines)'{-l,--lines}'[maximum number of matches to display (15)]:()' \23 '(-w --width)'{-w,--width}'[window width, in characters (30)]:()' \24 '(-x --horizontal-pad)'{-x,--horizontal-pad}'[horizontal padding, in pixels (40)]:()' \
48 unmodified lines
modified:doc/fuzzel.1.scd+10 added
119 unmodified lines
120 - bottom-right121 122 Default: _center_123124*--x-margin*=_MARGIN_125 Horizontal margin away from the anchor point in pixels. Default: _0_.126127 Note: this option has no effect when anchor=center, top or bottom.128129*--y-margin*=_MARGIN_130 Vertical margin away from the anchor point in pixels. Default: _0_.131132 Note: this option has no effect when anchor=center, left or right.133134*select*=_STRING_135 Select the first entry that matches the given string (case136 insensitive).137
222 unmodified lines
modified:doc/fuzzel.ini.5.scd+10 added
172 unmodified lines
173 - bottom-right174 175 Default: _center_176177*x-margin*178 Horizontal margin away from the anchor point in pixels. Default: _0_.179180 Note: this option has no effect when anchor=center, top or bottom.181182*y-margin*183 Vertical margin away from the anchor point in pixels. Default: _0_.184185 Note: this option has no effect when anchor=center, left or right.186187*lines*188 Number of matches to show. Default: _15_.189190*width*
254 unmodified lines
modified:CHANGELOG.md+5 added
28 unmodified lines
29## Unreleased30### Added3132* Nanosvg updated to 93ce879dc4c04a3ef1758428ec80083c38610b1f33* New options `--x-margin` `--y-margin` which place the launcher some34 distance away from the anchor point, in pixels. Default to 035 ([#344][344]).3637[344]: https://codeberg.org/dnkl/fuzzel/issues/344383940### Changed4142* The cache now stores desktop file **IDs** instead of the application43 titles. This way, we do not store multiple cache entries with the
664 unmodified lines
modified:config.c+9 added
897 unmodified lines
898899 conf->anchor = anchor;900 return true;901 }902 else if (strcmp(key, "x-margin") == 0)903 return value_to_uint32(ctx, 10, &conf->margin.x);904 905 else if (strcmp(key, "y-margin") == 0)906 return value_to_uint32(ctx, 10, &conf->margin.y);907908 else if (strcmp(key, "lines") == 0)909 return value_to_uint32(ctx, 10, &conf->lines);910
637 unmodified lines
1548 .exit_immediately_if_empty = false,1549 .delim = '\n',1550 },1551 .anchor = ANCHOR_CENTER,1552 .margin = {1553 .x = 0,1554 .y = 0,1555 },1556 .lines = 15,1557 .chars = 30,1558 .tabs = 8,1559 .pad = {
103 unmodified lines
modified:config.h+5 added
129 unmodified lines
130 } dmenu;131132 enum anchors anchor;133134 struct {135 unsigned x;136 unsigned y;137 } margin;138139 unsigned lines;140 unsigned chars;141 unsigned tabs; /* Tab stop every number of #spaces */142
40 unmodified lines
modified:fuzzel.ini+2 added
12 unmodified lines
13# launch-prefix=<not set>14# list-executables-in-path=no1516# anchor=center17# x-margin=018# y-margin=019# lines=1520# width=3021# tabs=822# horizontal-pad=40
75 unmodified lines
modified:main.c+28 added
265 unmodified lines
266 " -T,--terminal terminal command to use when launching\n"267 " 'terminal' programs, e.g. \"xterm -e\".\n"268 " Not used in dmenu mode (not set)\n"269 " -a,--anchor window anchor (center)\n"270 " --x-margin=MARGIN horizontal margin, in pixels (0)\n"271 " --y-margin=MARGIN vertical margin, in pixels (0)\n"272 " --select=STRING select first entry that matches the given string\n"273 " -l,--lines number of matches to show\n"274 " -w,--width window width, in characters (margins and\n"275 " borders not included)\n"
298 unmodified lines
574 #define OPT_FILTER_DESKTOP 274575 #define OPT_CHECK_CONFIG 275576 #define OPT_SELECT 276577 #define OPT_LIST_EXECS_IN_PATH 277578 #define OPT_X_MARGIN 278579 #define OPT_Y_MARGIN 279580581 static const struct option longopts[] = {582 {"config", required_argument, 0, OPT_CONFIG},583 {"check-config", no_argument, 0, OPT_CHECK_CONFIG},
4 unmodified lines
588 {"no-icons", no_argument, 0, 'I'},589 {"fields", required_argument, 0, 'F'},590 {"password", optional_argument, 0, OPT_PASSWORD},591 {"anchor", required_argument, 0, 'a'},592 {"x-margin", required_argument, 0, OPT_X_MARGIN},593 {"y-margin", required_argument, 0, OPT_Y_MARGIN},594 {"select", required_argument, 0, OPT_SELECT},595 {"lines", required_argument, 0, 'l'},596 {"width", required_argument, 0, 'w'},597 {"tabs", required_argument, 0, OPT_TABS},
52 unmodified lines
650 bool dpi_aware_set:1;651 bool match_fields_set:1;652 bool icons_disabled_set:1;653 bool anchor_set:1;654 bool x_margin_set : 1;655 bool y_margin_set : 1;656 bool lines_set:1;657 bool chars_set:1;658 bool tabs_set:1;659 bool pad_x_set:1;
200 unmodified lines
860 cmdline_overrides.anchor_set = true;861 break;862 }863864 case OPT_X_MARGIN:865 if (sscanf(optarg, "%u", &cmdline_overrides.conf.margin.x) != 1) {866 fprintf(stderr, "%s: invalid horizontal margin\n", optarg);867 return EXIT_FAILURE;868 }869 cmdline_overrides.x_margin_set = true;870 break;871872 case OPT_Y_MARGIN:873 if (sscanf(optarg, "%u", &cmdline_overrides.conf.margin.y) != 1) {874 fprintf(stderr, "%s: invalid vertical margin\n", optarg);875 return EXIT_FAILURE;876 }877 cmdline_overrides.y_margin_set = true;878 break;879880 case OPT_SELECT:881 select = optarg;882 break;883
429 unmodified lines
1313 if (cmdline_overrides.icons_disabled_set)1314 conf.icons_enabled = cmdline_overrides.conf.icons_enabled;1315 if (cmdline_overrides.anchor_set)1316 conf.anchor = cmdline_overrides.conf.anchor;1317 if (cmdline_overrides.x_margin_set)1318 conf.margin.x = cmdline_overrides.conf.margin.x;1319 if (cmdline_overrides.y_margin_set)1320 conf.margin.y = cmdline_overrides.conf.margin.y;1321 if (cmdline_overrides.lines_set)1322 conf.lines = cmdline_overrides.conf.lines;1323 if (cmdline_overrides.chars_set)1324 conf.chars = cmdline_overrides.conf.chars;
275 unmodified lines
modified:wayland.c+4 added
1362 unmodified lines
13631364 zwlr_layer_surface_v1_set_size(1365 wayl->layer_surface, wayl->width / scale, wayl->height / scale);13661367 zwlr_layer_surface_v1_set_margin(1368 wayl->layer_surface, wayl->conf->margin.y, wayl->conf->margin.x,1369 wayl->conf->margin.y, wayl->conf->margin.x);13701371 zwlr_layer_surface_v1_set_anchor(1372 wayl->layer_surface, wayl->conf->anchor);13731374 /* Trigger a 'configure' event, after which we'll have the actual width+height */
1002 unmodified lines