Add input width float, allowing input width to be customized in the

config file
This commit is contained in:
Jacob 2023-08-08 17:27:04 +02:00
parent 99233c4783
commit b221e94015
4 changed files with 8 additions and 3 deletions

View file

@ -296,6 +296,7 @@ spmenu = {
fast = 1; // Grab keyboard before matching entries (0/1)
type = 1; // Allow typing (0/1)
password = 0; // Don't read standard input and replace all characters with the password character (0/1)
width = 0.3; // Width reserved for user input (menu width * <width>)
}
);

View file

@ -708,6 +708,7 @@ void conf_init(void) {
config_setting_lookup_int(conf, "fast", &fast); // spmenu.input.fast
config_setting_lookup_int(conf, "type", &type); // spmenu.input.type
config_setting_lookup_int(conf, "password", &passwd); // spmenu.input.password
config_setting_lookup_float(conf, "width", &inputwidth); // spmenu.input.width
}
}

View file

@ -9,6 +9,7 @@ static int loadconfig = 1; /* Load configuration (~/.config/spm
static int loadtheme = 1; /* Load theme (~/.config/spmenu/theme.conf) on runtime */
static int loadbinds = 1; /* Load keybind file (~/.config/spmenu/binds.conf) on runtime */
static int mon = -1; /* Monitor to run spmenu on */
static int managed = 0; /* Let your window manager manage spmenu? */
/* Wayland options */
static int scrolldistance = 512; /* Distance to scroll for a scroll action to count */
@ -25,13 +26,13 @@ static int alpha = 1; /* Enable alpha */
static int menuposition = 2; /* Position of the menu (0: Bottom, 1: Top, 2: Center */
static int menupaddingv = 0; /* Vertical padding inside the menu (px) */
static int menupaddingh = 0; /* Horizontal padding inside the menu (px) */
static int menuwidth = 0; /* spmenu width */
static int menuwidth = 0; /* spmenu window width */
static int menumarginv = 0; /* Vertical padding around the menu */
static int menumarginh = 0; /* Horizontal padding around the menu */
static int centerwidth = 1000; /* Width when centered */
static double inputwidth = 0.3; /* Width reserved for input text, (Menu width * input width) */
static int xpos = 0; /* X position to offset spmenu */
static int ypos = 0; /* Y position to offset spmenu */
static int managed = 0; /* Let your window manager manage spmenu? */
/* Powerline options */
static int powerlineprompt = 1; /* Enable powerline for the prompt */

View file

@ -491,7 +491,9 @@ void resizeclient(void) {
* items.
*/
void get_width(void) {
sp.inputw = sp.mw / 3;
sp.inputw = sp.mw * inputwidth;
fprintf(stderr, "%f\n", inputwidth);
}
void get_mh(void) {