Skip to content

feat(dmenu): implement auto-height based on item count#985

Open
Razuer wants to merge 1 commit into
vicinaehq:mainfrom
Razuer:feat/dmenu-auto-height
Open

feat(dmenu): implement auto-height based on item count#985
Razuer wants to merge 1 commit into
vicinaehq:mainfrom
Razuer:feat/dmenu-auto-height

Conversation

@Razuer
Copy link
Copy Markdown
Contributor

@Razuer Razuer commented Jan 20, 2026

Summary

  • Implements automatic window height calculation for dmenu mode based on the number of items.
  • Eliminates large empty space for short lists (e.g., 2-3 items).
  • Respects window constraints and configuration.

Details

  • Calculation: Header + (SectionHeader) + (Items * ItemHeight) + Footer + Margins
  • Constraints:
    • Minimum: 1 item
    • Maximum: 12 items (scrolls after that)
  • Margins: Accounts for clientSideDecorations.borderWidth from config and internal list margins.
  • Safety: Adds 1px buffer to prevent momentary scrollbar flickering on exact fits.
  • Override: Passing --height explicitly still takes precedence.

Usage

# Window will resize to fit these 2 items exactly
printf "Item 1\nItem 2" | vicinae dmenu

Example

image image

Calculates the window height dynamically for dmenu commands to fit the content exactly.

- Accounts for header, footer, section headers, and item counts
- Includes padding for window borders (from config) and list margins
- Clamps height between 1 and 12 items to prevent tiny or huge windows
- Adds 1px buffer to prevent scrollbar flickering
- --height flag still overrides this behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant