mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
Adding gridnav patch
This commit is contained in:
parent
f469820531
commit
608fa3e837
@ -26,7 +26,7 @@ dmenu, how to install it and how it works.
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
2021-05-17 - Added the restrict return, no sort and plain-prompt (listfullwidth) patches
|
2021-05-17 - Added the restrict return, no sort, gridnav and plain-prompt (listfullwidth) patches
|
||||||
|
|
||||||
2021-05-15 - Added the tsv and printindex patches
|
2021-05-15 - Added the tsv and printindex patches
|
||||||
|
|
||||||
@ -92,6 +92,9 @@ dmenu, how to install it and how it works.
|
|||||||
number of grid columns
|
number of grid columns
|
||||||
- the `-g` and `-l` options can be used together to create a G columns * L lines grid
|
- the `-g` and `-l` options can be used together to create a G columns * L lines grid
|
||||||
|
|
||||||
|
- [gridnav](https://tools.suckless.org/dmenu/patches/gridnav/)
|
||||||
|
- adds the ability to move left and right through a grid (when using the grid patch)
|
||||||
|
|
||||||
- [highlight](https://tools.suckless.org/dmenu/patches/highlight/)
|
- [highlight](https://tools.suckless.org/dmenu/patches/highlight/)
|
||||||
- this patch highlights the individual characters of matched text for each dmenu list entry
|
- this patch highlights the individual characters of matched text for each dmenu list entry
|
||||||
|
|
||||||
|
48
dmenu.c
48
dmenu.c
@ -32,6 +32,9 @@
|
|||||||
|
|
||||||
#include "drw.h"
|
#include "drw.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#if GRIDNAV_PATCH
|
||||||
|
#include <stdbool.h>
|
||||||
|
#endif // GRIDNAV_PATCH
|
||||||
#if JSON_PATCH
|
#if JSON_PATCH
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
#endif // JSON_PATCH
|
#endif // JSON_PATCH
|
||||||
@ -775,6 +778,11 @@ keypress(XKeyEvent *ev)
|
|||||||
#endif // PREFIXCOMPLETION_PATCH
|
#endif // PREFIXCOMPLETION_PATCH
|
||||||
KeySym ksym;
|
KeySym ksym;
|
||||||
Status status;
|
Status status;
|
||||||
|
#if GRID_PATCH && GRIDNAV_PATCH
|
||||||
|
int i;
|
||||||
|
struct item *tmpsel;
|
||||||
|
bool offscreen = false;
|
||||||
|
#endif // GRIDNAV_PATCH
|
||||||
|
|
||||||
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
|
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -908,6 +916,26 @@ insert:
|
|||||||
calcoffsets();
|
calcoffsets();
|
||||||
break;
|
break;
|
||||||
case XK_Left:
|
case XK_Left:
|
||||||
|
#if GRID_PATCH && GRIDNAV_PATCH
|
||||||
|
if (columns > 1) {
|
||||||
|
if (!sel)
|
||||||
|
return;
|
||||||
|
tmpsel = sel;
|
||||||
|
for (i = 0; i < lines; i++) {
|
||||||
|
if (!tmpsel->left || tmpsel->left->right != tmpsel)
|
||||||
|
return;
|
||||||
|
if (tmpsel == curr)
|
||||||
|
offscreen = true;
|
||||||
|
tmpsel = tmpsel->left;
|
||||||
|
}
|
||||||
|
sel = tmpsel;
|
||||||
|
if (offscreen) {
|
||||||
|
curr = prev;
|
||||||
|
calcoffsets();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif // GRIDNAV_PATCH
|
||||||
if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
|
if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
|
||||||
cursor = nextrune(-1);
|
cursor = nextrune(-1);
|
||||||
break;
|
break;
|
||||||
@ -1005,6 +1033,26 @@ insert:
|
|||||||
#endif // MULTI_SELECTION_PATCH
|
#endif // MULTI_SELECTION_PATCH
|
||||||
break;
|
break;
|
||||||
case XK_Right:
|
case XK_Right:
|
||||||
|
#if GRID_PATCH && GRIDNAV_PATCH
|
||||||
|
if (columns > 1) {
|
||||||
|
if (!sel)
|
||||||
|
return;
|
||||||
|
tmpsel = sel;
|
||||||
|
for (i = 0; i < lines; i++) {
|
||||||
|
if (!tmpsel->right || tmpsel->right->left != tmpsel)
|
||||||
|
return;
|
||||||
|
tmpsel = tmpsel->right;
|
||||||
|
if (tmpsel == next)
|
||||||
|
offscreen = true;
|
||||||
|
}
|
||||||
|
sel = tmpsel;
|
||||||
|
if (offscreen) {
|
||||||
|
curr = next;
|
||||||
|
calcoffsets();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif // GRIDNAV_PATCH
|
||||||
if (text[cursor] != '\0') {
|
if (text[cursor] != '\0') {
|
||||||
cursor = nextrune(+1);
|
cursor = nextrune(+1);
|
||||||
break;
|
break;
|
||||||
|
@ -57,6 +57,12 @@
|
|||||||
*/
|
*/
|
||||||
#define GRID_PATCH 0
|
#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.
|
/* This patch highlights the individual characters of matched text for each dmenu list entry.
|
||||||
* The fuzzy highlight patch takes precedence over this patch.
|
* The fuzzy highlight patch takes precedence over this patch.
|
||||||
* https://tools.suckless.org/dmenu/patches/highlight/
|
* https://tools.suckless.org/dmenu/patches/highlight/
|
||||||
|
Loading…
Reference in New Issue
Block a user