mirror of
https://codeberg.org/adnano/wmenu.git
synced 2025-11-02 09:01:43 -05:00
Add wmenu -H flag
This flag allows the user to specify the line height usually in terms of pixels.
This commit is contained in:
parent
fc69aa6e2b
commit
3725c6fadc
4 changed files with 21 additions and 7 deletions
15
menu.c
15
menu.c
|
|
@ -89,7 +89,8 @@ void menu_getopts(struct menu *menu, int argc, char *argv[]) {
|
|||
"\t[-N color] [-n color] [-M color] [-m color] [-S color] [-s color]\n";
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt(argc, argv, "bhiPvf:l:o:p:N:n:M:m:S:s:")) != -1) {
|
||||
int line_height = 0;
|
||||
while ((opt = getopt(argc, argv, "bhiPvH:f:l:o:p:N:n:M:m:S:s:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'b':
|
||||
menu->bottom = true;
|
||||
|
|
@ -103,6 +104,9 @@ void menu_getopts(struct menu *menu, int argc, char *argv[]) {
|
|||
case 'v':
|
||||
puts("wmenu " VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
case 'H':
|
||||
line_height = atoi(optarg);
|
||||
break;
|
||||
case 'f':
|
||||
menu->font = optarg;
|
||||
break;
|
||||
|
|
@ -156,13 +160,16 @@ void menu_getopts(struct menu *menu, int argc, char *argv[]) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int height = get_font_height(menu->font);
|
||||
menu->line_height = height + 2;
|
||||
menu->font_height = get_font_height(menu->font);
|
||||
menu->line_height = menu->font_height + 2;
|
||||
if(line_height > menu->line_height) {
|
||||
menu->line_height = line_height;
|
||||
}
|
||||
menu->height = menu->line_height;
|
||||
if (menu->lines > 0) {
|
||||
menu->height += menu->height * menu->lines;
|
||||
}
|
||||
menu->padding = height / 2;
|
||||
menu->padding = menu->font_height / 2;
|
||||
}
|
||||
|
||||
// Add an item to the menu.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue