diff --git a/MANUAL.md b/MANUAL.md index 3ebcf26..21dc280 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -27,7 +27,7 @@ This manual covers flashing, operating, and customizing **Bananarchy Linux** (`v - **Cross-compiled Xlibre (`X11Libre/xserver` 25.2.0)**: compiled specifically for ARMv7 Cortex-A7 (`-O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -fno-plt -fomit-frame-pointer`) with all 3D/GLX/Glamor/VGA/DGA/XVideo bloat stripped out, rootless `elogind` device management, and `modesetting` KMS + `ShadowFB` (`drmModeDirtyFB` partial rectangle SPI updates) with automatic software cursor fallback on `/dev/dri/card0` (`panel-mipi-dbi`). - **Non-Nerd `Fira Code` with OpenType ligatures**: `Fira Code` (`font-fira-code`) is configured as the primary system and terminal font across Fontconfig, Xft, `st`, `dmenu`, `dwm`, `conky`, and `dunst`, with `DejaVu SansM Nerd Font` used strictly as a fallback for Private Use Area icon glyphs. - **Patched `sxmo-st` (`st`) with HarfBuzz ligatures & XIM**: patched with `libharfbuzz` (`hb.c`/`hb.h`) shaping (`liga`, `calt`, `clig`, `dlig`) so multi-character programming operators (`->`, `=>`, `!=`, `<=`, `>=`, `===`, `::`, `//`, `/*`) render as continuous ligatures at `pixelsize=18`, alongside full `XIM` (`fcitx5-t9`) input support. - - **Patched `sxmo-dmenu` (`dmenu`) (`< 15 ms` startup)**: full-width `240x320` 9-line vertical menu (`lineheight = 26`, positioned flush at `Y = 24` right below the 24px `dwm` bar) with a `#383838` top search bar, `#005577` prompt badge, `#1c1c1c` item list, `XIM` (`XSetLocaleModifiers("")`, `XSetICFocus`, `Xutf8LookupString`) for live `fcitx5-t9` search filtering and `#` mode switching, C-level focus preservation (`prevfocuswin`), and direct Nokia keypad bindings. + - **Patched `sxmo-dmenu` (`dmenu`) (`< 15 ms` startup)**: full-screen `240x296` 10-line vertical menu (positioned flush at `Y = 24..320` right below the 24px `dwm` bar, with a `26px` search bar and ten `27px` item rows) with a `#383838` top search bar, `#005577` prompt badge, `#1c1c1c` item list, `XIM` (`XSetLocaleModifiers("")`, `XSetICFocus`, `Xutf8LookupString`) for live `fcitx5-t9` search filtering and `#` mode switching, C-level focus preservation (`prevfocuswin`), and direct Nokia keypad bindings. - **Patched `sxmo-dwm` (`dwm`) (`< 2 ms` display wake/unlock & native plugin system)**: configured for `240x320` (`bh = 24`, `#323232` top bar, `#005577` active tag/border, vertical `bstack` layout default, overflow-protected Pango status bar rendering keeping the right-aligned clock always visible, and a transparent-backgrounded bottom desktop softkey bar displaying `"Menu"` and `"Names"` over the wallpaper). Directly polls `/dev/input/by-path/platform-gpio-keys-event` (`SW_LID`) and intercepts locked-state wake keys (`XF86PowerOff`, `XF86PickupPhone`, `XF86KbdLcdMenu1`, `XF86KbdLcdMenu2`) in C to toggle `/sys/class/backlight/backlight/brightness` and `/sys/class/leds/white:kbd_backlight/brightness` in `< 2 ms` before running Sxmo state hooks asynchronously. - **Preloaded DWM plugins (`src/dwm-plugins/` & `src/xdrawer/`, `< 10 ms` FIFO wakeup)**: `dwm` dynamically loads `.so` plugins from `/usr/lib/dwm/plugins/` and `~/.local/lib/dwm/plugins/` (`xdrawer.so`, `dialer.so`, `calllog.so`, `contacts.so`) and preloads them as resident background daemons (`dwm-plugin --preload`) at startup. Each daemon keeps its X11 window, offscreen `Pixmap`, Xft/Pango layouts (`15px` `Fira Code, DejaVuSansM Nerd Font`), and `stat()`-cached Sxmo TSV state initialized in memory while sleeping at 0% CPU on `/tmp/dwm_plugin_.fifo`. 2. **Multi-mode `fcitx5-t9` keypad engine (`src/fcitx5-t9/`)**: diff --git a/README.md b/README.md index 400cd24..a4ff3ac 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Bananarchy targets an ultra-lightweight **Sxmo X11 (`sxmo-de-dwm`)** environment - **`Dialer` (`dialer.so` / `xdialer`)**: opens automatically from the idle desktop when pressing any **`0`–`9`, `*`, or `#` key** (inserting that character immediately), with live T9/number contact filtering, hold-`0` for `+`, and single-press **Call** dialing. - **`Call Log` (`calllog.so` / `xcalllog`)**: opens automatically from the idle desktop when pressing the **Call (green)** button, with `All` / `Missed` / `In` / `Out` tabs, contact resolution, call durations, and instant redial. - **`Contacts` (`contacts.so` / `xcontacts`)**: full-featured phonebook application opened from the idle desktop via the **Right softkey (`Names`)** or from the Sxmo menu, integrated with `~/.config/sxmo/contacts.tsv` (live T9/number search, call/SMS/dialer actions, built-in contact editor with keypad multi-tap name entry and recent-caller number picker, and contact deletion). -- **Patched `sxmo-dmenu`**: `240x320` full-width 9-line vertical menu flush below the 24px top bar with a `#383838` search bar, `#005577` prompt badge, and `XIM` `fcitx5-t9` text input in `< 15 ms`. +- **Patched `sxmo-dmenu`**: `240x320` full-screen 10-line vertical menu (`240x296` flush below the 24px top bar) with a `#383838` search bar, `#005577` prompt badge, and `XIM` `fcitx5-t9` text input in `< 15 ms`. - **Patched `sxmo-st` terminal (`pixelsize=18`)**: **HarfBuzz (`libharfbuzz`) OpenType ligature shaping** (`liga`, `calt`, `clig`, `dlig`) and `XIM` support. - **Typography**: non-Nerd **`Fira Code` (`font-fira-code`) with ligatures** as the primary system and terminal font (with `DejaVu SansM Nerd Font` used strictly as an icon fallback). - **Custom 6-mode `fcitx5-t9` input engine**: fixed bottom candidate bar (`X=1, Y=290, W=238, H=30`) with a constant 28-character monospace preedit layout supporting lowercase, one-shot Shift, Caps Lock, all 32 ASCII punctuation symbols, terminal control codes (`^A`-`^Z`, `Esc`, `Tab`, `F1`-`F12`), and direct numeric entry with live top-bar mode indication (`[abc]`, `[Abc]`, `[ABC]`, `[Sym]`, `[Ctl]`, `[123]`). @@ -92,7 +92,7 @@ bananarchy/ │ ├── sxmo-dwm/ # Patched sxmo-dwm (240x320 bstack, Pango bar, desktop softkey bar & plugin API) │ ├── dwm-plugins/ # DWM plugins (dialer.so, calllog.so, contacts.so), shared phone/TSV lib & runner │ ├── xdrawer/ # XDrawer global phone controls DWM plugin (xdrawer.so / xdrawer) -│ ├── sxmo-dmenu/ # Patched sxmo-dmenu (240x320 vertical 9-line menu, #383838 search bar, XIM fcitx5-t9) +│ ├── sxmo-dmenu/ # Patched sxmo-dmenu (240x320 full-screen 10-line menu, #383838 search bar, XIM fcitx5-t9) │ ├── sxmo-st/ # Patched sxmo-st terminal with HarfBuzz Fira Code ligature shaping & XIM │ ├── xf86-input-libinput/ # X11Libre xf86-input-libinput DDX driver │ ├── xf86-video-fbdev/ # X11Libre xf86-video-fbdev fallback DDX driver diff --git a/overlay/rootfs/etc/profile.d/fcitx5-t9.sh b/overlay/rootfs/etc/profile.d/fcitx5-t9.sh index 73bfa74..c924637 100644 --- a/overlay/rootfs/etc/profile.d/fcitx5-t9.sh +++ b/overlay/rootfs/etc/profile.d/fcitx5-t9.sh @@ -5,5 +5,5 @@ export SXMO_WM=dwm export SXMO_MENU=dmenu export SXMO_TERMINAL=st export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=12 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 diff --git a/overlay/rootfs/etc/skel/.config/sxmo/profile b/overlay/rootfs/etc/skel/.config/sxmo/profile index 4047777..60bf311 100755 --- a/overlay/rootfs/etc/skel/.config/sxmo/profile +++ b/overlay/rootfs/etc/skel/.config/sxmo/profile @@ -84,7 +84,7 @@ export SXMO_WM="dwm" export SXMO_MENU="dmenu" export SXMO_TERMINAL="st" export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=9 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 export SXMO_DISABLE_LEDS=1 export SXMO_NO_VIRTUAL_KEYBOARD=1 diff --git a/overlay/rootfs/etc/skel/.profile b/overlay/rootfs/etc/skel/.profile index 207f7c6..d5d0832 100644 --- a/overlay/rootfs/etc/skel/.profile +++ b/overlay/rootfs/etc/skel/.profile @@ -13,7 +13,7 @@ export SXMO_WM=dwm export SXMO_MENU=dmenu export SXMO_TERMINAL=st export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=9 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 export SXMO_DISABLE_LEDS=1 export SXMO_NO_VIRTUAL_KEYBOARD=1 diff --git a/overlay/rootfs/home/user/.config/sxmo/profile b/overlay/rootfs/home/user/.config/sxmo/profile index 4047777..60bf311 100755 --- a/overlay/rootfs/home/user/.config/sxmo/profile +++ b/overlay/rootfs/home/user/.config/sxmo/profile @@ -84,7 +84,7 @@ export SXMO_WM="dwm" export SXMO_MENU="dmenu" export SXMO_TERMINAL="st" export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=9 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 export SXMO_DISABLE_LEDS=1 export SXMO_NO_VIRTUAL_KEYBOARD=1 diff --git a/overlay/rootfs/home/user/.profile b/overlay/rootfs/home/user/.profile index 207f7c6..d5d0832 100644 --- a/overlay/rootfs/home/user/.profile +++ b/overlay/rootfs/home/user/.profile @@ -13,7 +13,7 @@ export SXMO_WM=dwm export SXMO_MENU=dmenu export SXMO_TERMINAL=st export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=9 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 export SXMO_DISABLE_LEDS=1 export SXMO_NO_VIRTUAL_KEYBOARD=1 diff --git a/overlay/rootfs/usr/bin/dmenu b/overlay/rootfs/usr/bin/dmenu index f60e220..dbc9eb8 100755 Binary files a/overlay/rootfs/usr/bin/dmenu and b/overlay/rootfs/usr/bin/dmenu differ diff --git a/overlay/rootfs/usr/bin/sxmo_appmenu.sh b/overlay/rootfs/usr/bin/sxmo_appmenu.sh index e335062..7f425e8 100755 --- a/overlay/rootfs/usr/bin/sxmo_appmenu.sh +++ b/overlay/rootfs/usr/bin/sxmo_appmenu.sh @@ -23,7 +23,7 @@ confirm() { run_dmenu() { if [ "${SXMO_WM:-dwm}" = "dwm" ] && command -v dmenu >/dev/null 2>&1; then - dmenu -c -l "${SXMO_DMENU_PORTRAIT_LINES:-9}" "$@" + dmenu -c -l "${SXMO_DMENU_PORTRAIT_LINES:-10}" "$@" else sxmo_dmenu.sh "$@" fi @@ -150,7 +150,7 @@ fast_sys_choices() { " fi fi - CHOICES="$icon_trm St^0^st -e ${SHELL:-/bin/sh} + CHOICES="$icon_trm Terminal^0^st -e ${SHELL:-/bin/sh} $icon_grd Apps^0^sxmo_appmenu.sh applications $icon_grd Scripts^0^sxmo_appmenu.sh scripts $icon_dir Files^0^sxmo_files.sh diff --git a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,argon.sh b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,argon.sh index d6dac28..ce64564 100755 --- a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,argon.sh +++ b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,argon.sh @@ -23,5 +23,5 @@ export SXMO_NO_VIRTUAL_KEYBOARD=1 export SXMO_DISABLE_LEDS=1 export KEYBOARD_ARGS="-H 1 -L 1" export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=12 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 diff --git a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,beatles.sh b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,beatles.sh index d6dac28..ce64564 100755 --- a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,beatles.sh +++ b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,beatles.sh @@ -23,5 +23,5 @@ export SXMO_NO_VIRTUAL_KEYBOARD=1 export SXMO_DISABLE_LEDS=1 export KEYBOARD_ARGS="-H 1 -L 1" export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=12 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 diff --git a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,coconut.sh b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,coconut.sh index d6dac28..ce64564 100755 --- a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,coconut.sh +++ b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,coconut.sh @@ -23,5 +23,5 @@ export SXMO_NO_VIRTUAL_KEYBOARD=1 export SXMO_DISABLE_LEDS=1 export KEYBOARD_ARGS="-H 1 -L 1" export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=12 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 diff --git a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,leo.sh b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,leo.sh index d6dac28..ce64564 100755 --- a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,leo.sh +++ b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,leo.sh @@ -23,5 +23,5 @@ export SXMO_NO_VIRTUAL_KEYBOARD=1 export SXMO_DISABLE_LEDS=1 export KEYBOARD_ARGS="-H 1 -L 1" export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=12 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 diff --git a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,sparkler.sh b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,sparkler.sh index d6dac28..ce64564 100755 --- a/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,sparkler.sh +++ b/overlay/rootfs/usr/bin/sxmo_deviceprofile_nokia,sparkler.sh @@ -23,5 +23,5 @@ export SXMO_NO_VIRTUAL_KEYBOARD=1 export SXMO_DISABLE_LEDS=1 export KEYBOARD_ARGS="-H 1 -L 1" export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=12 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 diff --git a/overlay/rootfs/usr/bin/sxmo_dmenu.sh b/overlay/rootfs/usr/bin/sxmo_dmenu.sh index 36d9b23..cd6062e 100755 --- a/overlay/rootfs/usr/bin/sxmo_dmenu.sh +++ b/overlay/rootfs/usr/bin/sxmo_dmenu.sh @@ -26,6 +26,6 @@ if [ -n "$SHOW_OVER_LOCKSCREEN_FLAG" ]; then fi fi -lines="${SXMO_DMENU_PORTRAIT_LINES:-9}" +lines="${SXMO_DMENU_PORTRAIT_LINES:-10}" # shellcheck disable=SC2086 exec dmenu -i $SXMO_DMENU_OPTS -l "$lines" "$@" diff --git a/overlay/rootfs/usr/share/sxmo/appcfg/profile_template b/overlay/rootfs/usr/share/sxmo/appcfg/profile_template index 4047777..60bf311 100755 --- a/overlay/rootfs/usr/share/sxmo/appcfg/profile_template +++ b/overlay/rootfs/usr/share/sxmo/appcfg/profile_template @@ -84,7 +84,7 @@ export SXMO_WM="dwm" export SXMO_MENU="dmenu" export SXMO_TERMINAL="st" export DMENU_WRAP_AROUND=1 -export SXMO_DMENU_PORTRAIT_LINES=9 +export SXMO_DMENU_PORTRAIT_LINES=10 export SXMO_DMENU_LANDSCAPE_LINES=8 export SXMO_DISABLE_LEDS=1 export SXMO_NO_VIRTUAL_KEYBOARD=1 diff --git a/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh b/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh index 5f429ad..74ad90c 100755 --- a/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh +++ b/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh @@ -763,7 +763,7 @@ case "$WMCLASS" in *) # Default system menu (no matches) CHOICES=" - $icon_trm St ^ 0 ^ st -e ${SHELL:-/bin/sh} + $icon_trm Terminal ^ 0 ^ st -e ${SHELL:-/bin/sh} $icon_grd Apps ^ 0 ^ sxmo_appmenu.sh applications $icon_grd Scripts ^ 0 ^ sxmo_appmenu.sh scripts $icon_dir Files ^ 0 ^ sxmo_files.sh diff --git a/prebuilt/sxmo-x11/usr/bin/dmenu b/prebuilt/sxmo-x11/usr/bin/dmenu index f60e220..dbc9eb8 100755 Binary files a/prebuilt/sxmo-x11/usr/bin/dmenu and b/prebuilt/sxmo-x11/usr/bin/dmenu differ diff --git a/src/sxmo-dmenu/config.def.h b/src/sxmo-dmenu/config.def.h index 9a14f85..5320766 100644 --- a/src/sxmo-dmenu/config.def.h +++ b/src/sxmo-dmenu/config.def.h @@ -23,7 +23,7 @@ static const char *defaultcolors[SchemeLast][2] = { [SchemeOut] = { "#ffffff", "#383838" }, }; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ -static unsigned int lines = 9; +static unsigned int lines = 10; /* * Characters not considered part of a word while deleting words diff --git a/src/sxmo-dmenu/config.h b/src/sxmo-dmenu/config.h index 9a14f85..5320766 100644 --- a/src/sxmo-dmenu/config.h +++ b/src/sxmo-dmenu/config.h @@ -23,7 +23,7 @@ static const char *defaultcolors[SchemeLast][2] = { [SchemeOut] = { "#ffffff", "#383838" }, }; /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ -static unsigned int lines = 9; +static unsigned int lines = 10; /* * Characters not considered part of a word while deleting words diff --git a/src/sxmo-dmenu/dmenu.c b/src/sxmo-dmenu/dmenu.c index 89255c8..15097bd 100644 --- a/src/sxmo-dmenu/dmenu.c +++ b/src/sxmo-dmenu/dmenu.c @@ -45,7 +45,7 @@ struct item { static char numbers[NUMBERSBUFSIZE] = ""; static char text[BUFSIZ] = ""; static char *embed; -static int bh, mw, mh; +static int bh, item_bh, mw, mh; static int inputw = 0, promptw; static int lrpad; /* sum of left and right padding */ static size_t cursor; @@ -182,7 +182,7 @@ drawhighlights(struct item *item, int x, int y, int maxw) x + indentx - (lrpad / 2) - 1, y, MIN(maxw - indentx, TEXTW(highlight) - lrpad), - bh, 0, highlight, 0 + (lines > 0 ? item_bh : bh), 0, highlight, 0 ); highlight[strlen(token)] = restorechar; @@ -202,7 +202,7 @@ drawitem(struct item *item, int x, int y, int w) else drw_setscheme(drw, scheme[SchemeNorm]); - int r = drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); + int r = drw_text(drw, x, y, w, (lines > 0 ? item_bh : bh), lrpad / 2, item->text, 0); drawhighlights(item, x, y, w); return r; } @@ -269,8 +269,11 @@ drawmenu(void) if (lines > 0) { /* draw vertical list */ x -= lrpad / 2; - for (item = curr; item != next; item = item->right) - drawitem(item, 0, y += bh, mw); + y = bh; + for (item = curr; item != next; item = item->right) { + drawitem(item, 0, y, mw); + y += item_bh; + } } else if (matches) { /* draw horizontal list */ x += inputw; @@ -682,13 +685,14 @@ motionnotify(XEvent *e) if (lines > 0) { /* vertical list: (ctrl)left-click on item */ + y = bh; for (item = curr; item != next; item = item->right) { - y += h; - if (ev->y >= y && ev->y <= (y + h)) { + if (ev->y >= y && ev->y < (y + item_bh)) { sel = item; drawmenu(); return; } + y += item_bh; } /* display page up/down or jump top/bottom as appropriate */ if(ev->y > mh || ev->y < 0){ @@ -810,9 +814,9 @@ buttonpress(XEvent *e) if (lines > 0) { /* vertical list: (ctrl)left-click on item */ w = mw - x; + y = bh; for (item = curr; item != next; item = item->right) { - y += h; - if (ev->y >= y && ev->y <= (y + h)) { + if (ev->y >= y && ev->y < (y + item_bh)) { puts(item->text); if (!(ev->state & ControlMask)) exit(0); @@ -823,6 +827,7 @@ buttonpress(XEvent *e) } return; } + y += item_bh; } } else if (matches) { /* left-click on left arrow */ @@ -910,7 +915,6 @@ readstdin(void) if (items) items[i].text = NULL; inputw = (items && lines == 0 && !centered) ? TEXTW(items[imax].text) : 0; - lines = MIN(lines, i); } #include @@ -1154,6 +1158,7 @@ setup(void) const int bar_h = 24; bh = drw->fonts->h + 2; bh = MAX(bh, lineheight); + item_bh = bh; lines = MAX(lines, 0); mh = (lines + 1) * bh; promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0; @@ -1185,9 +1190,10 @@ setup(void) break; avail_h = MAX((int)bh * 2, (int)info[i].height - bar_h); - if (lines > 0 && (int)mh > avail_h) { + if (lines > 0) { lines = MAX(1, (avail_h / (int)bh) - 1); - mh = (lines + 1) * bh; + mh = avail_h; + item_bh = (mh - bh) / (int)lines; } x = info[i].x_org; mw = info[i].width; @@ -1203,9 +1209,10 @@ setup(void) parentwin); avail_h = MAX((int)bh * 2, (int)wa.height - bar_h); - if (lines > 0 && (int)mh > avail_h) { + if (lines > 0) { lines = MAX(1, (avail_h / (int)bh) - 1); - mh = (lines + 1) * bh; + mh = avail_h; + item_bh = (mh - bh) / (int)lines; } x = 0; mw = wa.width;