Coder Social home page Coder Social logo

bakkeby / dmenu-flexipatch Goto Github PK

View Code? Open in Web Editor NEW
172.0 11.0 72.0 88 KB

A dmenu build with preprocessor directives to decide which patches to include during build time

License: MIT License

Makefile 1.94% C 94.39% Roff 3.32% Shell 0.36%
flexipatch dmenu suckless

dmenu-flexipatch's Introduction

Similar to dwm-flexipatch this dmenu 5.3 (7be720c, 2024-03-19) project has a different take on patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched and the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.

For example to include the alpha patch then you would only need to flip this setting from 0 to 1 in patches.h:

#define ALPHA_PATCH 1

Once you have found out what works for you and what doesn't then you should be in a better position to choose patches should you want to start patching from scratch.

Alternatively if you have found the patches you want, but don't want the rest of the flexipatch entanglement on your plate then you may want to have a look at flexipatch-finalizer; a custom pre-processor tool that removes all the unused flexipatch code leaving you with a build that contains the patches you selected.

Refer to https://tools.suckless.org/dmenu/ for details on dmenu, how to install it and how it works.

Browsing patches? There is a map of patches diagram which tries to organise patches into categories.


Changelog:

2023-06-15 - Added the caret width patch

2022-09-05 - Removed the json patch due to maintenance and compatibility reasons, added the separator patch

2022-09-04 - Added the fzfexpect patch

2022-06-21 - Adding barpadding patch and relative input width patch

2022-03-02 - Bump to 5.1

2021-05-23 - Adding support for ctrl+v to paste and adding emoji-highlight patch

2021-05-17 - Added the restrict return, no sort, gridnav and plain-prompt (listfullwidth) patches

2021-05-15 - Added the tsv and printindex patches

2020-08-08 - Added the json, symbols, managed, morecolor, multi-selection and preselect patches

2020-08-05 - Added the grid, highlight, highpriority, dynamic options and numbers patches

2020-06-13 - Added the pango patch

2020-06-10 - Added the case-insensitive patch

2020-05-29 - Added the alpha patch (derived from Baitinq's build) and the color emoji patch

2020-04-05 - Added fuzzyhighlight patch

2020-02-09 - Added revised border patch (adding command line parameter for setting border width)

2019-12-29 - Added xresources patch

2019-10-16 - Introduced flexipatch-finalizer

2019-09-18 - Added border, center, fuzzymatch, incremental, initialtext, instant, line-height, mouse-support, navhistory, non-blocking-stdin, password, pipeout, printinputtext, rejectnomatch, scroll, vertfull, wmtype and xyw patches

Patches included:

  • alpha

    • adds transparency for the dmenu window
  • barpadding

    • adds padding for dmenu in similar fashion to the barpadding patch for dwm
  • border

    • adds a border around the dmenu window
  • caret-width

    • makes the caret width configurable and overridable via a command line option
  • case-insensitive

    • makes dmenu case-insensitive by default, replacing the case-insensitive -i option with a case sensitive -s option
  • center

    • this patch centers dmenu in the middle of the screen
  • color_emoji

    • enables color emoji in dmenu by removing a workaround for a BadLength error in the Xft library when color glyphs are used
    • enabling this will crash dmenu on encountering such glyphs unless you also have an updated Xft library that can handle them
  • dynamic_options

    • adds a flag (-dy) which makes dmenu run the command given to it whenever input is changed with the current input as the last argument and update the option list according to the output of that command
  • emoji-highlight

    • this patch will allow for emojis on the left side with a colored background when selected
  • fuzzyhighlight

    • intended to be combined with the fuzzymatch patch, this makes it so that fuzzy matches are highlighted
  • fuzzymatch

    • adds support for fuzzy-matching to dmenu, allowing users to type non-consecutive portions of the string to be matched
  • fzfexpect

    • adds fzf expect functionality in dmenu
  • grid

    • allows dmenu's entries to be rendered in a grid by adding a new -g flag to specify the number of grid columns
    • the -g and -l options can be used together to create a G columns * L lines grid
  • gridnav

    • adds the ability to move left and right through a grid (when using the grid patch)
  • highlight

    • this patch highlights the individual characters of matched text for each dmenu list entry
  • highpriority

    • this patch will automatically sort the search result so that high priority items are shown first
  • incremental

    • this patch causes dmenu to print out the current text each time a key is pressed
  • initialtext

    • adds an option to provide preselected text
  • instant

    • adds a flag that will cause dmenu to select an item immediately if there is only one matching option left
  • json

    • adds basic support for json files
  • line-height

    • adds a -h option which sets the minimum height of a dmenu line
    • this helps integrate dmenu with other UI elements that require a particular vertical size
  • managed

    • adds a -wm flag which sets override_redirect to false; thus letting your window manager manage the dmenu window
    • this may be helpful in contexts where you don't want to exclusively bind dmenu or want to treat dmenu more as a "window" rather than as an overlay
  • morecolor

    • adds an additional color scheme for highlighting entries adjacent to the current selection
  • mouse-support

    • adds basic mouse support for dmenu
  • multi-selection

    • without this patch when you press Ctrl+Enter dmenu just outputs current item and it is not possible to undo that
    • with this patch dmenu will output all selected items only on exit
    • it is also possible to deselect any selected item
  • navhistory

    • provides dmenu the ability for history navigation similar to that of bash
  • no-sort

    • adds the -S option to disable sorting menu items after matching
    • useful, for example, when menu items are sorted by their frequency of use (using an external cache) and the most frequently selected items should always appear first regardless of how they were exact, prefix, or substring matches
  • non-blocking-stdin

    • this is a patch to have dmenu read stdin in a non blocking way, making it wait for input both from stdin and from X
    • this means that you can continue feeding dmenu while you type
    • the patch is meant to be used along with the incremental patch in order to use stdout to feed stdin
  • numbers

    • adds text which displays the number of matched and total items in the top right corner of dmenu
  • pango

    • adds simple markup for dmenu using pango markup
  • password

    • with this patch dmenu will not directly display the keyboard input, but instead replace it with dots
    • all data from stdin will be ignored
  • pipeout

    • this patch allows the selected text to be piped back out with dmenu
    • this can be useful if you want to display the output of a command on the screen
  • plain-prompt

    • simple change that avoids colors for the prompt by making it use the same style as the rest of the input field
  • prefix-completion

    • changes the behaviour of matched items and the Tab key to allow tab completion
  • preselect

    • adds an option -ps to preselect an item by providing the index that should be pre-selected
  • printindex

    • allows dmenu to print out the 0-based index of matched text instead of the matched text itself
    • this can be useful in cases where you would like to select entries from one array of text but index into another, or when you are selecting from an ordered list of non-unique items
  • printinputtext

    • this patch adds a flag -t which makes Return key ignore selection and print the input text to stdout
    • the flag basically swaps the functions of Return and Shift+Return hotkeys
  • rejectnomatch

    • adds a new flag to dmenu with which text input will be rejected if it would result in no matching item
  • relative_input_width

    • prior to commit e1e1de7 the input width was calculated based on the input options
    • this feature was removed in favour of hardcoding the input width to always take up 1/3rd of the available space
    • this patch adds that feature back in with some bespoke performance optimisations at the cost of accuracy and correctness
  • restrict-return

    • adds a -1 option which disables Shift-Return and Ctrl-Return
    • this guarantees that dmenu will only output one item, and that item was read from stdin
  • scroll

    • this patch adds support for text scrolling
    • it doesn't append ... for long input anymore as it can handle long text
  • separator

    • adds -d and -D flags which separates the input into two halves; one half to be displayed in dmenu and the other to be printed to stdout
  • symbols

    • allows the symbols, which are printed in dmenu to indicate that either the input is too long or there are too many options to be shown in dmenu in one line, to be defined
  • tsv

    • makes dmenu split input lines at first tab character and only display first part, but it will perform matching on and output full lines as usual
    • can be useful if you want to separate data and representation
  • vertfull

    • prevents dmenu from indenting items at the same level as the prompt length
  • wmtype

    • adds extended window manager hints such as _NET_WM_WINDOW_TYPE and _NET_WM_WINDOW_TYPE_DOCK
  • xresources

    • allows dmenu to read font and colors from Xresources
    • note that with this patch the Xresources settings takes precedence over command line arguments
  • xyw

    • adds options for specifying dmenu window position and width

dmenu-flexipatch's People

Contributors

bakkeby avatar johnnymast avatar monosans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dmenu-flexipatch's Issues

Conflict between printindex patch and multiselection patch

I designed the following experiment:
Created 3 directories with dmenu-flexipatch:

  • dmenu-flexipatch ($ git clone https://github.com/bakkeby/dmenu-flexipatch)
  • dmenu-flexipatch-index ($ git clone https://github.com/bakkeby/dmenu-flexipatch dmenu-flexipatch-index)
  • dmenu-flexipatch-index-conflict ($ git clone https://github.com/bakkeby/dmenu-flexipatch dmenu-flexipatch-index-conflict)

dmenu-flexipatch doesn't have enabled patches. It is compiled right after cloning the repo. I just typed
$ make

dmenu-flexipatch-index only has printindex patch enabled:
#define PRINTINDEX_PATCH 1

dmenu-flexipatch-index-conflict has printindex and multiselection patches enabled:
#define MULTI_SELECTION_PATCH 1
#define PRINTINDEX_PATCH 1

Then after compiling everything I run the following commands:

For dmenu-flexipatch:
$ echo -e "Hello\nWorld\nfoo" | ./dmenu-flexipatch/dmenu
Press Enter
OUTPUT:
Hello
dmenu-flexipatch works as expected

For dmenu-flexipatch-index:
$ echo -e "Hello\nWorld\nfoo" | ./dmenu-flexipatch-index/dmenu
Press Enter
OUTPUT:
Hello
dmenu-flexipatch-index works as expected with no option
$ echo -e "Hello\nWorld\nfoo" | ./dmenu-flexipatch-index/dmenu -ix
Press Enter
OUTPUT:
0
dmenu-flexipatch-index works as expected with ix option

For dmenu-flexipatch-index-conflict:
$ echo -e "Hello\nWorld\nfoo" | ./dmenu-flexipatch-index-conflict/dmenu
Press Enter
OUTPUT:
0
dmenu-flexipatch-index-conflict is not working as expected
$ echo -e "Hello\nWorld\nfoo" | ./dmenu-flexipatch-index-conflict/dmenu -ix
Press Enter
OUTPUT:
0
dmenu-flexipatch-index-conflict is not working as expected, with ix option

I don't know if it is a bug but in the description of PRINTINDEX_PATCH there is no mention of an option or flag, so I am not sure if this is intended to be working this way

/* This patch allows dmenu to print out the 0-based index of matched text instead of the matched

Looks like ALPHA_PATCH's `-o` option does nothing

I tried to find the use of the ALPHA_PATCH's variable opacity after reading
its value from argv, but I couldn't find anything. Is it dangling?

Also, as far as I understand, this is not the same patch from suckless
(although it does not know how to read the value from argv at all).

I ask you to fix this because transparency in st forces the use of transparency
in dmenu to be used when using with EXTERNALPIPE_PATCH. In total,
everything works, but transparent embedded dmenu with transparent st look
about weird...

image

instant patch doesn't work

It works if I run it like this echo -ne "alskdjf\nlaksdjf\n" | dmenu

If I select a link, it doesn't work echo -ne "alskdjf\nlaksdjf\nhttps://examples.xyz" | dmenu

dmenu_run doesn't work as well.

This isn't just flexipatch but in vanilla version as well. at least mine (version = 5.2;
patches: dmenu-caseinsensitive-5.0.diff
dmenu-fuzzymatch-4.9.diff
dmenu-highlight-20201211-fcdc159.diff
dmenu-xresources-4.9.diff).

Highlight patch messes with multi-selection colouring

I just noticed that when the highlight patch is applied and a search is being made, any entries added to a multi-selection only use the colours defined in SchemeNorm rather than the colours defined in SchemeOut. This also seems to happen irrespectively of the multi-selection patch.

An example of an entry normally added to a multi-selection, currently in orange
image

Whereas here, st is another selected entry but does not also show in orange during searching.
image
image

What might a potential fix for this look like or involve?

Fuzzy Highlighting has small graphical glitches

I've noticed for a while now that the dmenu highlighting is a bit glitchy, specifically with certain letters, e.g:
image
If you look carefully there is a blue line just before every highlighted M, which is weird.

How do I make the font bold?

I am working on a patch which underlines matches instead of highlighting them. However, because I am not used to the Xft lib, I am stuck on how to make the font bold for matches.

Could you please help me with this?

dmenu PATH = trouble

run dmenu_run and write:

echo $PATH > /tmp/path

And:

cat /tmp/path

/usr/local/bin:/usr/bin:/bin:/usr/games

dmenu not load user PATH. And If I run emacs/some_program. In program PATH=/usr/local/bin:/usr/bin:/bin:/usr/games. This bit trouble. Rofi run emacs/some_program correctly. If I make menu with scripts from which I will launch applications will also have an wrong $PATH

border patch smushes the font

when i apply border patch and try to add border width to a greater number the dmenu hight doesnot increase instead it tries to fit that border width in same window size and as result fonts either get cut out or they get stretched in like they are compressed and widens

Prefix completion conflicts with fuzzy match

Hello again!

I was trying to use the prefix-completion patch and it wasn't working. I figured it was a conflict with another patch somewhere, so with a clean build I went through and enabled each patch individually to see which was the culprit. None were. It turns out, installing dmenu with sudo make install the prefix command doesn't work; i.e., it removes what was entered so far. If I just run make and run dmenu in the same directory, so something like echo -e "test\ninput" | ./dmenu" the completion works. I have no idea what would cause this. Do you have any ideas @bakkeby?

XResources Patch - munmap_chunck(): Invalid Pointer

Hey bakkeby.
Actually i don´t think this is bug, but it comes down to asking if xresources is initialized or not.

The Issue:
If you have the XRESOURCES Patch activated and you run dmenu without ever ( in the current X session ) having called xrdb with a corresponding .xresources, you get an munmap_chunck(): Invalid Pointer and dmenu stops running.

EDIT: .xresource file can be totally empty or have everything commented.

Can you confirm this?

Maybe i´m totally misunderstanding something in case there is a reason behind this situation.

Have a good one.

can't change colors

I changed colors in config.h, but it keeps using the default colors. Also tried to change them in config.def.h, but didn't help either. I don't find any patch that mess with that, and default dmenu works as expected, so it's an issue with flexipatch.
Here are my config.h and patches.h

config.h

/* See LICENSE file for copyright and license details. */
/* Default settings; can be overriden by command line. */

static int topbar = 1;                      /* -b  option; if 0, dmenu appears at bottom */
#if ALPHA_PATCH
static int opacity = 1;                     /* -o  option; if 0, then alpha is disabled */
#endif // ALPHA_PATCH
#if CARET_WIDTH_PATCH
static int caret_width = 2;                 /* -cw option; set default caret width */
#endif // CARET_WIDTH_PATCH
#if FUZZYMATCH_PATCH
static int fuzzy = 1;                       /* -F  option; if 0, dmenu doesn't use fuzzy matching */
#endif // FUZZYMATCH_PATCH
#if INCREMENTAL_PATCH
static int incremental = 0;                 /* -r  option; if 1, outputs text each time a key is pressed */
#endif // INCREMENTAL_PATCH
#if INSTANT_PATCH
static int instant = 1;                     /* -n  option; if 1, selects matching item without the need to press enter */
#endif // INSTANT_PATCH
#if CENTER_PATCH
static int center = 1;                      /* -c  option; if 0, dmenu won't be centered on the screen */
static int min_width = 500;                 /* minimum width when centered */
#endif // CENTER_PATCH
#if BARPADDING_PATCH
static const int vertpad = 10;              /* vertical padding of bar */
static const int sidepad = 10;              /* horizontal padding of bar */
#endif // BARPADDING_PATCH
#if RESTRICT_RETURN_PATCH
static int restrict_return = 0;             /* -1 option; if 1, disables shift-return and ctrl-return */
#endif // RESTRICT_RETURN_PATCH
/* -fn option overrides fonts[0]; default X11 font or font set */
#if PANGO_PATCH
static char font[] = "monospace 10";
#else
#if XRESOURCES_PATCH
static char *fonts[] =
#else
static const char *fonts[] =
#endif // XRESOURCES_PATCH
{
	"SpaceMono Nerd Font:size=10"
};
#endif // PANGO_PATCH
#if MANAGED_PATCH
static char *prompt            = NULL;      /* -p  option; prompt to the left of input field */
#else
static const char *prompt      = NULL;      /* -p  option; prompt to the left of input field */
#endif // MANAGED_PATCH
#if DYNAMIC_OPTIONS_PATCH
static const char *dynamic     = NULL;      /* -dy option; dynamic command to run on input change */
#endif // DYNAMIC_OPTIONS_PATCH
#if SYMBOLS_PATCH
static const char *symbol_1 = "<";
static const char *symbol_2 = ">";
#endif // SYMBOLS_PATCH

#if ALPHA_PATCH
static const unsigned int baralpha = 0xd0;
static const unsigned int borderalpha = OPAQUE;
static const unsigned int alphas[][3]      = {
	/*               fg      bg        border     */
	[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
	[SchemeSel]  = { OPAQUE, baralpha, borderalpha },
	#if BORDER_PATCH
	[SchemeBorder] = { OPAQUE, OPAQUE, OPAQUE },
	#endif // BORDER_PATCH
	#if MORECOLOR_PATCH
	[SchemeMid] = { OPAQUE, baralpha, borderalpha },
	#endif // MORECOLOR_PATCH
	#if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH
	[SchemeSelHighlight] = { OPAQUE, baralpha, borderalpha },
	[SchemeNormHighlight] = { OPAQUE, baralpha, borderalpha },
	#endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH
	#if HIGHPRIORITY_PATCH
	[SchemeHp] = { OPAQUE, baralpha, borderalpha },
	#endif // HIGHPRIORITY_PATCH
	#if EMOJI_HIGHLIGHT_PATCH
	[SchemeHover] = { OPAQUE, baralpha, borderalpha },
	[SchemeGreen] = { OPAQUE, baralpha, borderalpha },
	[SchemeRed] = { OPAQUE, baralpha, borderalpha },
	[SchemeYellow] = { OPAQUE, baralpha, borderalpha },
	[SchemeBlue] = { OPAQUE, baralpha, borderalpha },
	[SchemePurple] = { OPAQUE, baralpha, borderalpha },
	#endif // EMOJI_HIGHLIGHT_PATCH
};
#endif // ALPHA_PATCH

static
#if !XRESOURCES_PATCH
const
#endif // XRESOURCES_PATCH
char *colors[][2] = {
	/*               fg         bg       */
	[SchemeNorm] = { "#f8f8f8", "#262335" },
	[SchemeSel]  = { "#f8f8f8", "#005577" },
	[SchemeOut]  = { "#493465", "#af6df9" },
	#if BORDER_PATCH
	[SchemeBorder] = { "#000000", "#005577" },
	#endif // BORDER_PATCH
	#if MORECOLOR_PATCH
	[SchemeMid]  = { "#eeeeee", "#770000" },
	#endif // MORECOLOR_PATCH
	#if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH
	[SchemeSelHighlight]  = { "#ffcc00", "#005557" },
	[SchemeNormHighlight] = { "#ffcc00", "#262335" },
	#endif // HIGHLIGHT_PATCH | FUZZYHIGHLIGHT_PATCH
	#if HIGHPRIORITY_PATCH
	[SchemeHp]   = { "#bbbbbb", "#333333" },
	#endif // HIGHPRIORITY_PATCH
	#if EMOJI_HIGHLIGHT_PATCH
	[SchemeHover]  = { "#ffffff", "#353D4B" },
	[SchemeGreen]  = { "#ffffff", "#52E067" },
	[SchemeRed]    = { "#ffffff", "#e05252" },
	[SchemeYellow] = { "#ffffff", "#e0c452" },
	[SchemeBlue]   = { "#ffffff", "#5280e0" },
	[SchemePurple] = { "#ffffff", "#9952e0" },
	#endif // EMOJI_HIGHLIGHT_PATCH
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines      = 0;
#if GRID_PATCH
/* -g option; if nonzero, dmenu uses a grid comprised of columns and lines */
static unsigned int columns    = 0;
#endif // GRID_PATCH
#if LINE_HEIGHT_PATCH
static unsigned int lineheight = 8;         /* -h option; minimum height of a menu line     */
static unsigned int min_lineheight = 8;
#endif // LINE_HEIGHT_PATCH
#if NAVHISTORY_PATCH
static unsigned int maxhist    = 15;
static int histnodup           = 1;	/* if 0, record repeated histories */
#endif // NAVHISTORY_PATCH

/*
 * Characters not considered part of a word while deleting words
 * for example: " /?\"&[]"
 */
#if PIPEOUT_PATCH
static const char startpipe[] = "#";
#endif // PIPEOUT_PATCH
static const char worddelimiters[] = " ";

#if BORDER_PATCH
/* Size of the window border */
static unsigned int border_width = 2;
#endif // BORDER_PATCH

#if PREFIXCOMPLETION_PATCH
/*
 * Use prefix matching by default; can be inverted with the -x flag.
 */
static int use_prefix = 1;
#endif // PREFIXCOMPLETION_PATCH

patches.h

/* Patches */

/* The alpha patch adds transparency for the dmenu window.
 * You need to uncomment the corresponding line in config.mk to use the -lXrender library
 * when including this patch.
 * https://github.com/bakkeby/patches/blob/master/dmenu/dmenu-alpha-5.0_20210725_523aa08.diff
 */
#define ALPHA_PATCH 0

/* This adds padding for dmenu in similar fashion to the similarly named patch for dwm. The idea
 * is to have dmenu appear on top of the bar when using said patch in dwm.
 * https://github.com/bakkeby/patches/wiki/barpadding
 */
#define BARPADDING_PATCH 0

/* This patch adds a border around the dmenu window. It is intended to be used with the center
 * or xyw patches, to make the menu stand out from similarly coloured windows.
 * http://tools.suckless.org/dmenu/patches/border/
 */
#define BORDER_PATCH 1

/* By default the caret in dmenu has a width of 2 pixels. This patch makes that configurable
 * as well as overridable via a command line option.
 * https://github.com/DarkSamus669/dmenu-patches/blob/main/dmenu-caretwidth-5.2.diff
 */
#define CARET_WIDTH_PATCH 0

/* This patch makes dmenu case-insensitive by default, replacing the
 * case-insensitive -i option with a case sensitive -s option.
 * http://tools.suckless.org/dmenu/patches/case-insensitive/
 */
#define CASEINSENSITIVE_PATCH 0

/* This patch centers dmenu in the middle of the screen.
 * https://tools.suckless.org/dmenu/patches/center/
 */
#define CENTER_PATCH 1

/* Minor patch to enable the use of Ctrl+v (XA_PRIMARY) and Ctrl+Shift+v (CLIPBOARD) to paste.
 * By default dmenu only supports Ctrl+y and Ctrl+Shift+y to paste.
 */
#define CTRL_V_TO_PASTE_PATCH 0

/* This patch adds a flag (-dy) which makes dmenu run the command given to it whenever input
 * is changed with the current input as the last argument and update the option list according
 * to the output of that command.
 * https://tools.suckless.org/dmenu/patches/dynamicoptions/
 */
#define DYNAMIC_OPTIONS_PATCH 0

/* This patch will allow for emojis on the left side with a colored background when selected.
 * To test this try running:
 *    $ echo -e ":b here\n:p there\n:r and here" | ./dmenu -p "Search..." -W 400 -l 20 -i -h -1
 * NB: the original patch came embedded with the the xyw patch, the morecolors patch and the
 * line height patch and as such is intended to be combined with these.
 * https://tools.suckless.org/dmenu/patches/emoji-highlight/
 */
#define EMOJI_HIGHLIGHT_PATCH 0

/* This patch make it so that fuzzy matches gets highlighted and is therefore meant
 * to be used together with the fuzzymatch patch.
 * https://tools.suckless.org/dmenu/patches/fuzzyhighlight/
 */
#define FUZZYHIGHLIGHT_PATCH 1

/* This patch adds support for fuzzy-matching to dmenu, allowing users to type non-consecutive
 * portions of the string to be matched.
 * https://tools.suckless.org/dmenu/patches/fuzzymatch/
 */
#define FUZZYMATCH_PATCH 1

/* Adds fzf-like functionality for dmenu.
 * Refer to https://github.com/DAFF0D11/dafmenu/ for documentation and example use cases.
 * https://github.com/DAFF0D11/dafmenu/blob/master/patches/dmenu-fzfexpect-5.1.diff
 */
#define FZFEXPECT_PATCH 0

/* Allows dmenu's entries to be rendered in a grid by adding a new -g flag to specify
 * the number of grid columns. The -g and -l options can be used together to create a
 * G columns * L lines grid.
 * https://tools.suckless.org/dmenu/patches/grid/
 */
#define GRID_PATCH 0

/* This patch adds the ability to move left and right through a grid.
 * This patch depends on the grid patch.
 * https://tools.suckless.org/dmenu/patches/gridnav/
 */
#define GRIDNAV_PATCH 0

/* This patch highlights the individual characters of matched text for each dmenu list entry.
 * The fuzzy highlight patch takes precedence over this patch.
 * https://tools.suckless.org/dmenu/patches/highlight/
 */
#define HIGHLIGHT_PATCH 0

/* This will automatically sort the search result so that high priority items are shown first.
 * https://tools.suckless.org/dmenu/patches/highpriority/
 */
#define HIGHPRIORITY_PATCH 0

/* This patch causes dmenu to print out the current text each time a key is pressed.
 * https://tools.suckless.org/dmenu/patches/incremental/
 */
#define INCREMENTAL_PATCH 0

/* This patch adds an option to provide preselected text.
 * https://tools.suckless.org/dmenu/patches/initialtext/
 */
#define INITIALTEXT_PATCH 0

/* This patch adds a flag which will cause dmenu to select an item immediately if there
 * is only one matching option left.
 * https://tools.suckless.org/dmenu/patches/instant/
 */
#define INSTANT_PATCH 1

/* This patch adds a '-h' option which sets the minimum height of a dmenu line. This helps
 * integrate dmenu with other UI elements that require a particular vertical size.
 * http://tools.suckless.org/dmenu/patches/line-height/
 */
#define LINE_HEIGHT_PATCH 1

/* This patch adds a -wm flag which sets override_redirect to false; thus letting your window
 * manager manage the dmenu window.
 *
 * This may be helpful in contexts where you don't want to exclusively bind dmenu or want to
 * treat dmenu more as a "window" rather than as an overlay.
 * https://tools.suckless.org/dmenu/patches/managed/
 */
#define MANAGED_PATCH 0

/* This patch adds an additional color scheme for highlighting entries adjacent to the current
 * selection.
 * https://tools.suckless.org/dmenu/patches/morecolor/
 */
#define MORECOLOR_PATCH 0

/* This patch adds basic mouse support for dmenu.
 * https://tools.suckless.org/dmenu/patches/mouse-support/
 */
#define MOUSE_SUPPORT_PATCH 0

/* Without this patch when you press Ctrl+Enter dmenu just outputs current item and it is not
 * possible to undo that.
 * With this patch dmenu will output all selected items only on exit. It is also possible to
 * deselect any selected item.
 * Also refer to the dmenu_run replacement on the below URL that supports multiple selections.
 *
 * This patch is not compatible with, and takes precedence over, the json, printinputtext,
 * pipeout and non-blocking stdin patches.
 *
 * https://tools.suckless.org/dmenu/patches/multi-selection/
 */
#define MULTI_SELECTION_PATCH 0

/* This patch provides dmenu the ability for history navigation similar to that of bash.
 *
 * If you take this patch then it is recommended that you also uncomment the line in the
 * dmenu_run script which replaces the exec command.
 *
 * https://tools.suckless.org/dmenu/patches/navhistory/
 */
#define NAVHISTORY_PATCH 0

/* This patch adds back in the workaround for a BadLength error in the Xft library when color
 * glyphs are used. This is for systems that do not have an updated version of the Xft library
 * (or generally prefer monochrome fonts).
 */
#define NO_COLOR_EMOJI_PATCH 0

/* Adds the -S option to disable sorting menu items after matching. Useful, for example, when menu
 * items are sorted by their frequency of use (using an external cache) and the most frequently
 * selected items should always appear first regardless of how they were exact, prefix, or
 * substring matches.
 * https://tools.suckless.org/dmenu/patches/no-sort/
 */
#define NO_SORT_PATCH 0

/* This is a patch to have dmenu read stdin in a non blocking way, making it wait for input both
 * from stdin and from X. This means that you can continue feeding dmenu while you type.
 * This patch is meant to be used along with the incremental patch, so that you can use stdout
 * to feed stdin.
 *
 * This patch is not compatible with the json and multi-selection patches, both of which takes
 * precedence over this patch.
 *
 * https://tools.suckless.org/dmenu/patches/non_blocking_stdin/
 */
#define NON_BLOCKING_STDIN_PATCH 0

/* Adds text which displays the number of matched and total items in the top right corner of dmenu.
 * https://tools.suckless.org/dmenu/patches/numbers/
 */
#define NUMBERS_PATCH 0

/* This patch adds simple markup for dmenu using pango markup.
 * This depends on the pango library v1.44 or greater.
 * You need to uncomment the corresponding lines in config.mk to use the pango libraries
 * when including this patch.
 *
 * Note that the pango patch is incompatible with the scroll patch and will result in
 * compilation errors if both are enabled.
 *
 * Note that the pango patch does not protect against the BadLength error from Xft
 * when color glyphs are used, which means that dmenu will crash if color emoji is used.
 *
 * If you need color emoji then you may want to install this patched library from the AUR:
 * https://aur.archlinux.org/packages/libxft-bgra/
 *
 * A long term fix for the libXft library is pending approval of this pull request:
 * https://gitlab.freedesktop.org/xorg/lib/libxft/-/merge_requests/1
 *
 * Also see:
 * https://developer.gnome.org/pygtk/stable/pango-markup-language.html
 * https://github.com/StillANixRookie/dmenu-pango
 */
#define PANGO_PATCH 0

/* With this patch dmenu will not directly display the keyboard input, but instead replace
 * it with dots. All data from stdin will be ignored.
 * https://tools.suckless.org/dmenu/patches/password/
 */
#define PASSWORD_PATCH 0

/* This patch allows the selected text to be piped back out with dmenu. This can be useful if you
 * want to display the output of a command on the screen.
 * Only text starting with the character '#' is piped out by default.
 *
 * This patch is not compatible with the json and multi-select patches, both of which takes
 * precedence over this one.
 *
 * https://tools.suckless.org/dmenu/patches/pipeout/
 */
#define PIPEOUT_PATCH 0

/* Lifted from the listfullwidth patch this simple change just avoids colors for the prompt (with
 * the -p option or in config.h) by making it use the same style as the rest of the input field.
 * The rest of the listfullwidth patch is covered by the vertfull patch.
 * https://tools.suckless.org/dmenu/patches/listfullwidth/
 */
#define PLAIN_PROMPT_PATCH 0

/* This patch changes the behaviour of matched items and the Tab key to allow tab completion.
 * https://tools.suckless.org/dmenu/patches/prefix-completion/
 */
#define PREFIXCOMPLETION_PATCH 0

/* This patch adds an option -ps to specify an item by providing the index that should be
 * pre-selected.
 * https://tools.suckless.org/dmenu/patches/preselect/
 */
#define PRESELECT_PATCH 0

/* This patch allows dmenu to print out the 0-based index of matched text instead of the matched
 * text itself. This can be useful in cases where you would like to select entries from one array
 * of text but index into another, or when you are selecting from an ordered list of non-unique
 * items.
 * https://tools.suckless.org/dmenu/patches/printindex/
 */
#define PRINTINDEX_PATCH 0

/* This patch adds a flag (-t) which makes Return key to ignore selection and print the input
 * text to stdout. The flag basically swaps the functions of Return and Shift+Return hotkeys.
 *
 * This patch is not compatible with the multi-select and json patches, both of which takes
 * precedence over this one.
 *
 * https://tools.suckless.org/dmenu/patches/printinputtext/
 */
#define PRINTINPUTTEXT_PATCH 0

/* This patch adds a new flag to dmenu with which text input will be rejected if it would
 * result in no matching item.
 * https://tools.suckless.org/dmenu/patches/reject-no-match/
 */
#define REJECTNOMATCH_PATCH 0

/* The input width used to be relative to the input options prior to commit e1e1de7:
 * https://git.suckless.org/dmenu/commit/e1e1de7b3b8399cba90ddca9613f837b2dbef7b9.html
 *
 * This had a performance hit when using large data sets and was removed in favour of having the
 * input width take up 1/3rd of the available space.
 *
 * This option adds that feature back in with some performance optimisations at the cost of
 * accuracy and correctness.
 */
#define RELATIVE_INPUT_WIDTH_PATCH 0

/* This patch adds a '-1' option which disables Shift-Return and Ctrl-Return.
 * This guarantees that dmenu will only output one item, and that item was read from stdin.
 * The original patch used '-r'. This was changed to '-1' to avoid conflict with the incremental
 * patch.
 * https://tools.suckless.org/dmenu/patches/restrict-return/
 */
#define RESTRICT_RETURN_PATCH 0

/* This patch adds support for text scrolling and no longer appends '...' for long input as
 * it can handle long text.
 * https://tools.suckless.org/dmenu/patches/scroll/
 */
#define SCROLL_PATCH 0

/* This patch adds -d and -D flags which separates the input into two halves; one half to be
 * displayed in dmenu and the other to be printed to stdout. This patch takes precedence over
 * the TSV patch.
 * https://tools.suckless.org/dmenu/patches/separator/
 */
#define SEPARATOR_PATCH 0

/* This patch allows the symbols, which are printed in dmenu to indicate that either the input
 * is too long or there are too many options to be shown in dmenu in one line, to be defined.
 * https://tools.suckless.org/dmenu/patches/symbols/
 */
#define SYMBOLS_PATCH 0

/* With this patch dmenu will split input lines at first tab character and only display first
 * part, but it will perform matching on and output full lines as usual.
 *
 * This can be useful if you want to separate data and representation, for example, a music
 * player wrapper can display only a track title to user, but still supply full filename to
 * the underlying script.
 * https://tools.suckless.org/dmenu/patches/tsv/
 */
#define TSV_PATCH 0

/* This patch prevents dmenu from indenting items at the same level as the prompt length.
 * https://tools.suckless.org/dmenu/patches/vertfull/
 */
#define VERTFULL_PATCH 0

/* Adds extended window manager hints such as _NET_WM_WINDOW_TYPE and _NET_WM_WINDOW_TYPE_DOCK.
 * https://github.com/Baitinq/dmenu/blob/master/patches/dmenu-wm_type.diff
 */
#define WMTYPE_PATCH 0

/* This patch adds the ability to configure dmenu via Xresources. At startup, dmenu will read and
 * apply the resources named below:
 *    dmenu.font          : font or font set
 *    dmenu.background    : normal background color
 *    dmenu.foreground    : normal foreground color
 *    dmenu.selbackground : selected background color
 *    dmenu.selforeground : selected foreground color
 *
 * See patch/xresources.c for more color settings.
 *
 * https://tools.suckless.org/dmenu/patches/xresources/
 */
#define XRESOURCES_PATCH 0

/* This patch adds options for specifying dmenu window position and width.
 * The center patch takes precedence over the XYW patch if enabled.
 * https://tools.suckless.org/dmenu/patches/xyw/
 */
#define XYW_PATCH 0

dynamic options gives error

When having these patches applied, I have no problems

#define ALPHA_PATCH 1
#define BORDER_PATCH 1
#define CENTER_PATCH 1
#define CTRL_V_TO_PASTE_PATCH 1
#define FUZZYMATCH_PATCH 1
#define GRID_PATCH 1
#define GRIDNAV_PATCH 1
#define LINE_HEIGHT_PATCH 1
#define MOUSE_SUPPORT_PATCH 1
#define MULTI_SELECTION_PATCH 1
#define PREFIXCOMPLETION_PATCH 1
#define PRESELECT_PATCH 1
#define SYMBOLS_PATCH 1
#define TSV_PATCH 1
#define WMTYPE_PATCH 1
#define XRESOURCES_PATCH 1
#define XYW_PATCH 1

When I add to these DYNAMIC_OPTIONS_PATCH I get

rm -f dmenu stest drw.o dmenu.o stest.o util.o dmenu-5.0.tar.gz
dmenu build options:
CFLAGS   = -std=c99 -pedantic -Wall -Os -I/usr/X11R6/include -I/usr/include/freetype2   -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION="5.0" -DXINERAMA 
LDFLAGS  = -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft  -lm -lXrender 
CC       = cc
cc -c -std=c99 -pedantic -Wall -Os -I/usr/X11R6/include -I/usr/include/freetype2   -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"5.0\" -DXINERAMA  dmenu.c
In file included from patch/include.c:5,
                 from dmenu.c:211:
patch/dynamicoptions.c: In function ‘readstream’:
patch/dynamicoptions.c:36:25: error: ‘struct item’ has no member named ‘out’
   36 |                 items[i].out = 0;
      |                         ^
make: *** [Makefile:18: dmenu.o] Error 1

Not only happens on my old build I just testet with a fresh one and same problem.

Can I change the sb color when there is nothing piped into dmenu?

When piping echo into dmenu with borderpatch the selbackground of this empty field has the same color as border color, or better said it's the other way around.
as
I find the empty selection field pretty annoying with this color and would rather have it the same color0 as the rest there, when there is nothing to be selected.
changing sb color sadly also changes the background color of the border...
Is there any quickfix for that maybe or would this be too much work to separete selbackground and bordercolor?

fuzzyhighlight: Invalid UTF-8 passed to drw_text

If the fuzzy highlight patch is used along with Pango (maybe an issue with Xft too?) and emojis or non-English characters are highlighted, invalid UTF-8 is passed to the drw_text function. Looking at the function though I'm pretty sure this is because it doesn't properly handle Unicode made up of multiple characters when drawing each character. Not only does this result in the text not drawing properly, Pango will output many warnings about it.

I don't really have the time to fix this (and I'm really not familiar with encoding) but I thought I'd report the issue anyway.

multiselect.c missing?

Hi, when compiling with multiselect patch set to 1 I get error that multiselect.c is missing. And there is no multiselect.c in the patches folder..

Patch manpage as well

I presume this isn't possible with the current system, but it'd be nice if it was possible to also patch the dmenu.1 manpage (maybe there's something weird that can be done with the preprocessor?). A possible alternative would be to include all settings for all patches in the manpage by default, along with a message in each saying that it's only available if that patch was enabled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.