move a few things to the config, add .Xresources values
This commit is contained in:
parent
fcd52fa1c2
commit
2ee27ad8bc
|
@ -56,10 +56,6 @@ spmenu.col_sgrcolor15: #ffffff
|
||||||
spmenu.globalcolors: 1
|
spmenu.globalcolors: 1
|
||||||
spmenu.alpha: 1
|
spmenu.alpha: 1
|
||||||
|
|
||||||
!! Width
|
|
||||||
spmenu.accuratewidth: 1
|
|
||||||
spmenu.borderwidth: 0
|
|
||||||
|
|
||||||
!! Lines and columns
|
!! Lines and columns
|
||||||
spmenu.lineheight: 1
|
spmenu.lineheight: 1
|
||||||
spmenu.lines: 0
|
spmenu.lines: 0
|
||||||
|
@ -73,6 +69,7 @@ spmenu.histdup: 0
|
||||||
|
|
||||||
!! Matches
|
!! Matches
|
||||||
spmenu.type: 1
|
spmenu.type: 1
|
||||||
|
spmenu.passwd: 0
|
||||||
spmenu.fuzzy: 1
|
spmenu.fuzzy: 1
|
||||||
spmenu.sortmatches: 1
|
spmenu.sortmatches: 1
|
||||||
spmenu.casesensitive: 0
|
spmenu.casesensitive: 0
|
||||||
|
@ -81,7 +78,12 @@ spmenu.casesensitive: 0
|
||||||
spmenu.menuposition: 1
|
spmenu.menuposition: 1
|
||||||
spmenu.menupaddingv: 0
|
spmenu.menupaddingv: 0
|
||||||
spmenu.menupaddingh: 0
|
spmenu.menupaddingh: 0
|
||||||
|
spmenu.menuwidth: 0
|
||||||
|
spmenu.xpos: 0
|
||||||
|
spmenu.ypos: 0
|
||||||
spmenu.minwidth: 1000
|
spmenu.minwidth: 1000
|
||||||
|
spmenu.accuratewidth: 1
|
||||||
|
spmenu.borderwidth: 0
|
||||||
|
|
||||||
!! Properties
|
!! Properties
|
||||||
spmenu.dockproperty: 1
|
spmenu.dockproperty: 1
|
||||||
|
|
|
@ -12,6 +12,9 @@ spmenu =
|
||||||
border = 0;
|
border = 0;
|
||||||
paddingv = 0;
|
paddingv = 0;
|
||||||
paddingh = 0;
|
paddingh = 0;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
width = 0;
|
||||||
monitor = -1;
|
monitor = -1;
|
||||||
managed = 0;
|
managed = 0;
|
||||||
alpha = 1;
|
alpha = 1;
|
||||||
|
@ -134,6 +137,7 @@ spmenu =
|
||||||
// Input
|
// Input
|
||||||
input = ( { fast = 1;
|
input = ( { fast = 1;
|
||||||
type = 1;
|
type = 1;
|
||||||
|
password = 0;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Mode
|
// Mode
|
||||||
|
|
|
@ -209,11 +209,11 @@ readargs(int argc, char *argv[])
|
||||||
} else if (!strcmp(argv[i], "-H") || (!strcmp(argv[i], "--hist-file"))) // hist file location
|
} else if (!strcmp(argv[i], "-H") || (!strcmp(argv[i], "--hist-file"))) // hist file location
|
||||||
histfile = argv[++i];
|
histfile = argv[++i];
|
||||||
else if (!strcmp(argv[i], "-x") || (!strcmp(argv[i], "--x-position"))) // window x offset
|
else if (!strcmp(argv[i], "-x") || (!strcmp(argv[i], "--x-position"))) // window x offset
|
||||||
dmx = atoi(argv[++i]);
|
xpos = atoi(argv[++i]);
|
||||||
else if (!strcmp(argv[i], "-y") || (!strcmp(argv[i], "--y-position"))) // window y offset (from bottom up if -b)
|
else if (!strcmp(argv[i], "-y") || (!strcmp(argv[i], "--y-position"))) // window y offset (from bottom up if -b)
|
||||||
dmy = atoi(argv[++i]);
|
ypos = atoi(argv[++i]);
|
||||||
else if (!strcmp(argv[i], "-z") || (!strcmp(argv[i], "--width"))) // make spmenu this wide
|
else if (!strcmp(argv[i], "-z") || (!strcmp(argv[i], "--width"))) // make spmenu this wide
|
||||||
dmw = atoi(argv[++i]);
|
menuwidth = atoi(argv[++i]);
|
||||||
else if (!strcmp(argv[i], "-p") || (!strcmp(argv[i], "--prompt"))) // adds prompt to left of input field
|
else if (!strcmp(argv[i], "-p") || (!strcmp(argv[i], "--prompt"))) // adds prompt to left of input field
|
||||||
prompt = argv[++i];
|
prompt = argv[++i];
|
||||||
else if (!strcmp(argv[i], "-It") || (!strcmp(argv[i], "--input"))) // specify initial text
|
else if (!strcmp(argv[i], "-It") || (!strcmp(argv[i], "--input"))) // specify initial text
|
||||||
|
|
|
@ -64,6 +64,9 @@ conf_init(void)
|
||||||
config_setting_lookup_int(conf, "position", &menuposition); // spmenu.window.menuposition
|
config_setting_lookup_int(conf, "position", &menuposition); // spmenu.window.menuposition
|
||||||
config_setting_lookup_int(conf, "paddingv", &menupaddingv); // spmenu.window.paddingv
|
config_setting_lookup_int(conf, "paddingv", &menupaddingv); // spmenu.window.paddingv
|
||||||
config_setting_lookup_int(conf, "paddingh", &menupaddingh); // spmenu.window.paddingh
|
config_setting_lookup_int(conf, "paddingh", &menupaddingh); // spmenu.window.paddingh
|
||||||
|
config_setting_lookup_int(conf, "x", &xpos); // spmenu.window.x
|
||||||
|
config_setting_lookup_int(conf, "y", &xpos); // spmenu.window.y
|
||||||
|
config_setting_lookup_int(conf, "width", &menuwidth); // spmenu.window.width
|
||||||
config_setting_lookup_int(conf, "border", &borderwidth); // spmenu.window.border
|
config_setting_lookup_int(conf, "border", &borderwidth); // spmenu.window.border
|
||||||
config_setting_lookup_int(conf, "managed", &managed); // spmenu.window.managed
|
config_setting_lookup_int(conf, "managed", &managed); // spmenu.window.managed
|
||||||
config_setting_lookup_int(conf, "monitor", &mon); // spmenu.window.monitor
|
config_setting_lookup_int(conf, "monitor", &mon); // spmenu.window.monitor
|
||||||
|
@ -327,6 +330,7 @@ conf_init(void)
|
||||||
// look up
|
// look up
|
||||||
config_setting_lookup_int(conf, "fast", &fast); // spmenu.input.fast
|
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, "type", &type); // spmenu.input.type
|
||||||
|
config_setting_lookup_int(conf, "password", &passwd); // spmenu.input.password
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,9 @@ ResourcePref resources[] = {
|
||||||
{ "globalcolors", INTEGER, &globalcolors },
|
{ "globalcolors", INTEGER, &globalcolors },
|
||||||
{ "coloritems", INTEGER, &coloritems },
|
{ "coloritems", INTEGER, &coloritems },
|
||||||
{ "menuposition", INTEGER, &menuposition },
|
{ "menuposition", INTEGER, &menuposition },
|
||||||
|
{ "xpos", INTEGER, &xpos },
|
||||||
|
{ "ypos", INTEGER, &ypos },
|
||||||
|
{ "menuwidth", INTEGER, &menuwidth },
|
||||||
{ "menupaddingv", INTEGER, &menupaddingv },
|
{ "menupaddingv", INTEGER, &menupaddingv },
|
||||||
{ "menupaddingh", INTEGER, &menupaddingh },
|
{ "menupaddingh", INTEGER, &menupaddingh },
|
||||||
{ "textpadding", INTEGER, &textpadding },
|
{ "textpadding", INTEGER, &textpadding },
|
||||||
|
@ -59,6 +62,7 @@ ResourcePref resources[] = {
|
||||||
{ "accuratewidth", INTEGER, &accuratewidth },
|
{ "accuratewidth", INTEGER, &accuratewidth },
|
||||||
{ "alpha", INTEGER, &alpha },
|
{ "alpha", INTEGER, &alpha },
|
||||||
{ "type", INTEGER, &type },
|
{ "type", INTEGER, &type },
|
||||||
|
{ "passwd", INTEGER, &passwd },
|
||||||
{ "minwidth", INTEGER, &minwidth },
|
{ "minwidth", INTEGER, &minwidth },
|
||||||
{ "preselected", INTEGER, &preselected },
|
{ "preselected", INTEGER, &preselected },
|
||||||
{ "borderwidth", INTEGER, &borderwidth },
|
{ "borderwidth", INTEGER, &borderwidth },
|
||||||
|
|
|
@ -17,7 +17,10 @@ static int alpha = 1; /* Enable alpha */
|
||||||
static int menuposition = 1; /* Position of the menu (0: Bottom, 1: Top, 2: Center */
|
static int menuposition = 1; /* Position of the menu (0: Bottom, 1: Top, 2: Center */
|
||||||
static int menupaddingv = 0; /* Vertical padding of bar (in pixels) */
|
static int menupaddingv = 0; /* Vertical padding of bar (in pixels) */
|
||||||
static int menupaddingh = 0; /* Horizontal padding of bar (in pixels) */
|
static int menupaddingh = 0; /* Horizontal padding of bar (in pixels) */
|
||||||
static int minwidth = 1000; /* Minimum width */
|
static int menuwidth = 0; /* spmenu width when setting X/Y position */
|
||||||
|
static int minwidth = 1000; /* Minimum width when centered */
|
||||||
|
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? */
|
static int managed = 0; /* Let your window manager manage spmenu? */
|
||||||
|
|
||||||
/* Window properties */
|
/* Window properties */
|
||||||
|
@ -52,6 +55,7 @@ static char *input = NULL; /* Default input text */
|
||||||
|
|
||||||
/* Match options */
|
/* Match options */
|
||||||
static int type = 1; /* Allow typing into spmenu or only allow keybinds. */
|
static int type = 1; /* Allow typing into spmenu or only allow keybinds. */
|
||||||
|
static int passwd = 0; /* Replace input with another character and don't read stdin */
|
||||||
static int sortmatches = 1; /* Sort matches (0/1) */
|
static int sortmatches = 1; /* Sort matches (0/1) */
|
||||||
static int casesensitive = 0; /* Case-sensitive by default? (0/1) */
|
static int casesensitive = 0; /* Case-sensitive by default? (0/1) */
|
||||||
static int preselected = 0; /* Which line should spmenu preselect? */
|
static int preselected = 0; /* Which line should spmenu preselect? */
|
||||||
|
|
10
spmenu.c
10
spmenu.c
|
@ -125,13 +125,9 @@ static int numlockmask = 0;
|
||||||
// height of each item, menu width, menu height
|
// height of each item, menu width, menu height
|
||||||
static int bh, mw, mh;
|
static int bh, mw, mh;
|
||||||
static int reallines = 0;
|
static int reallines = 0;
|
||||||
static int dmx = 0; // put spmenu at this x offset
|
|
||||||
static int dmy = 0; // put spmenu at this y offset (measured from the bottom if menuposition is 0)
|
|
||||||
static unsigned int dmw = 0; // make spmenu this wide
|
|
||||||
static int inputw = 0;
|
static int inputw = 0;
|
||||||
static int promptw;
|
static int promptw;
|
||||||
static int plw = 0;
|
static int plw = 0;
|
||||||
static int passwd = 0;
|
|
||||||
static int lrpad; // sum of left and right padding
|
static int lrpad; // sum of left and right padding
|
||||||
static int vp; // vertical padding for bar
|
static int vp; // vertical padding for bar
|
||||||
static int sp; // side padding for bar
|
static int sp; // side padding for bar
|
||||||
|
@ -587,9 +583,9 @@ setupdisplay(void)
|
||||||
x = info[i].x_org + ((info[i].width - mw) / 2);
|
x = info[i].x_org + ((info[i].width - mw) / 2);
|
||||||
y = info[i].y_org + ((info[i].height - mh) / 2);
|
y = info[i].y_org + ((info[i].height - mh) / 2);
|
||||||
} else { // top or bottom
|
} else { // top or bottom
|
||||||
x = info[i].x_org + dmx;
|
x = info[i].x_org + xpos;
|
||||||
y = info[i].y_org + (menuposition ? 0 : info[i].height - mh - dmy);
|
y = info[i].y_org + (menuposition ? 0 : info[i].height - mh - ypos);
|
||||||
mw = (dmw>0 ? dmw : info[i].width);
|
mw = (menuwidth>0 ? menuwidth : info[i].width);
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree(info);
|
XFree(info);
|
||||||
|
|
Loading…
Reference in a new issue