Repository navigation
Design check before any code: should nonselectable rows also be skipped by navigation?
#2348
guttermonk
started this conversation in
Ideas/Feature Requests
Replies: 1 comment 10 replies
|
I was able to get the concept working with a patch. Here's what an unselectable section header that gets skipped over when navigating looks like in action: rec-2026-11-01_16-26-39.mp4 |
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Thanks for rofi — it's the backbone of most of my desktop workflow.
I want to check a design question before writing anything, because this topic has
come up before and been answered, and I'd rather not hand you a PR against a call
you've already made.
What I'm actually after
A section divider in a dmenu list — a row that labels the group below it and is
inert.
nonselectablegets most of the way: the row can't be activated. But theselection still lands on it, so it renders with the full selected-row styling and
is a stop on the way past.
I can style my way out of the appearance (flag the row
urgent, restyle thatstate to a transparent background in a scoped
-theme-str), and that works well.What I can't do from outside is stop the cursor landing there.
Where this has been raised before
suppressing the highlight "is going to be very hard to disable", and that it
"does not fully fit the design of rofi".
nonselectablelanded, doing exactlythe activation half.
answer was "this is not possible".
Having read the code, I think both answers were right, and for a more specific
reason than "not supported".
Why it's genuinely hard today
The two halves never meet. Navigation is pure index arithmetic over
lv->selected—listview_nav_down_intconsultsreq_elementsandcycleandnothing else:
Meanwhile the per-row information only exists at paint time:
listview_set_statestamps the state onto the row as it's drawn, and
nonselectableitself lives inDmenuScriptEntryand is read solely at activation(
source/modes/script.c:405,source/modes/dmenu.c:887and:917).So the listview has no channel to per-row mode data at all. Skipping isn't a flag
someone forgot to add — it needs that channel to exist.
The shape I'd propose
There's already a precedent for exactly this channel:
listview_update_callback(include/widgets/listview.h:68), passed tolistview_create, whichview.cimplements by mapping the listview index ontothe real line via
state->line_map[index](source/view.c:741).A selectability callback could mirror it one-for-one:
listview: an optionallistview_is_selectable_callback(unsigned int entry, void *udata)plus a setter, and a bounded helper that advances pastunselectable rows.
view.c: implement it as a one-liner overstate->line_map[index].Mode: an optional function pointer, treated as "selectable" when NULL. Modesuse designated initializers, so the other eight mode files need no change.
dmenu/script: return!entry->nonselectable.That keeps the behaviour opt-in and leaves every existing mode byte-identical in
behaviour.
What I think the real risks are
I don't want to undersell this:
listview.c(the eight public ones plus_inthelpers and the page movers). Missing one leaves the row reachable fromthat direction, which is worse than today's consistent behaviour.
line_mapunderneath the selection, and interacts withpermanent.-me-select-entry) is separate from keyboard nav.-selected-rowhave to advance off a leadingunselectable row.
That's the part that makes me want your opinion first rather than after.
The question
Would you consider a PR along these lines against
next? And if thecallback-on-
Modeshape is the wrong one — if you'd rather this never reach themode layer, or be confined to dmenu/script, or not exist at all — I'd much rather
hear that now.
Happy to take "no" for an answer; I'd just like it to be an informed one before I
spend the weekend on it.
(Line references are against
next@ 8cf8134.)All reactions