~mil/sxmo-tickets#445: 
automatically calculate # of lines of menus

In sxmo_dmenu.sh we hardcode the number of lines for our menus depending on if we are in vertical or horizontal mode. However, these hardcoded decisions assume the default height of the menu. A user can override the height with BMENU_OPTS and probably something similar for dmenu. Hence, we should calculate the number of lines based on some sort of math based on the HEIGHT.

HEIGHT="$(echo "$BEMENU_OPTS" | sed 's/.*-H *\([0-9]\)/\1/')"
HORIZ_HEIGHT="$(echo "$HEIGHT / 2.5" | bc)"
VERT_HEIGHT="$(echo "$HEIGHT / 1.33" | bc)"·
#bemenu -l "$(sxmo_rotate.sh isrotated > /dev/null && printf 8 ||  printf 15)" "$@"
bemenu -l "$(sxmo_rotate.sh isrotated > /dev/null && printf "$HORIZ_HEIGHT" ||  printf "$VERT_HEIGHT")" "$@"

However, that's as far as I got. I'm not sure about the sed statement and I'm not sure about my math, so maybe someone else can pick up the idea and run with it.

Status
REPORTED
Submitter
~phartman
Assigned to
No-one
Submitted
5 months ago
Updated
5 months ago
Labels
feature

~baroque0 5 months ago

It prob also depends on other bemeneu parameters like font height, line height, and overall the scale factor used in wayland..? i use scale 1.6 instead of 2

but agreed we should find a better way. the default leaves lots of unused screen estate for me...

~earboxer referenced this from #484 a month ago

Register here or Log in to comment, or comment via email.