forked from speedie/spmenu
add option to enable/disable setting lines/columns using keybinds
This commit is contained in:
parent
6083df6736
commit
c1058dfb00
12
docs/docs.md
12
docs/docs.md
|
@ -130,6 +130,18 @@ You may use long, descriptive arguments or the shorter arguments.
|
|||
`-nt, --no-allow-typing`
|
||||
: Don't allow typing, the user must select an option
|
||||
|
||||
`-ol, --override-lines`
|
||||
: Allow keybinds to override lines
|
||||
|
||||
`-oc, --override-columns`
|
||||
: Allow keybinds to override columns
|
||||
|
||||
`-nol, --no-override-lines`
|
||||
: Don't allow keybinds to override lines
|
||||
|
||||
`-noc, --no-override-columns`
|
||||
: Don't allow keybinds to override columns
|
||||
|
||||
`-x, --x-position x offset`
|
||||
: Offset spmenu x position by x offset (X11 only)
|
||||
|
||||
|
|
|
@ -119,6 +119,8 @@ spmenu.alpha: 1
|
|||
spmenu.lineheight: 1
|
||||
spmenu.lines: 0
|
||||
spmenu.columns: 10
|
||||
spmenu.overridelines: 1
|
||||
spmenu.overridecolumns: 1
|
||||
spmenu.preselected: 0
|
||||
spmenu.indentitems: 0
|
||||
|
||||
|
|
|
@ -181,6 +181,8 @@ spmenu = {
|
|||
line = ( { height = 1; // Height of each line (px)
|
||||
lines = 0; // Number of lines (number)
|
||||
columns = 10; // Number of columns (number)
|
||||
overridelines = 1; // Allow overriding lines using keybinds (0/1)
|
||||
overridecolumns = 1; // Allow overriding columns using keybinds (0/1)
|
||||
indentitems = 0; // Indent items to prompt width (0/1)
|
||||
} );
|
||||
|
||||
|
|
|
@ -461,7 +461,7 @@ void defaultimg(Arg *arg) {
|
|||
}
|
||||
|
||||
void setlines(Arg *arg) {
|
||||
if (fullscreen) return;
|
||||
if (fullscreen || !overridelines) return;
|
||||
|
||||
lines += arg->i;
|
||||
|
||||
|
@ -479,7 +479,7 @@ void setlines(Arg *arg) {
|
|||
}
|
||||
|
||||
void setcolumns(Arg *arg) {
|
||||
if (fullscreen) return;
|
||||
if (fullscreen || !overridecolumns) return;
|
||||
|
||||
columns += arg->i;
|
||||
|
||||
|
|
18
libs/argv.c
18
libs/argv.c
|
@ -4,6 +4,12 @@ void readargs(int argc, char *argv[]) {
|
|||
int j = 0;
|
||||
int k = 0;
|
||||
|
||||
#if !USEX
|
||||
#if !USEWAYLAND
|
||||
die("Why did you think it was a good idea to compile me without support for any display server? You're an idiot. :)");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// check if we should load the xrdb/config, because it needs to be loaded before arguments are checked
|
||||
// priority: internal -> config -> xresources -> arguments
|
||||
for (j = 1; j < argc; j++) {
|
||||
|
@ -161,6 +167,14 @@ void readargs(int argc, char *argv[]) {
|
|||
type = 1;
|
||||
} else if (!strcmp(argv[i], "-nt") || (!strcmp(argv[i], "--no-allow-typing"))) { // don't allow the user to type
|
||||
type = 0;
|
||||
} else if (!strcmp(argv[i], "-ol") || (!strcmp(argv[i], "--override-lines"))) { // allow overriding lines
|
||||
overridelines = 1;
|
||||
} else if (!strcmp(argv[i], "-nol") || (!strcmp(argv[i], "--no-override-lines"))) { // don't allow overriding lines
|
||||
overridelines = 0;
|
||||
} else if (!strcmp(argv[i], "-oc") || (!strcmp(argv[i], "--override-columns"))) { // allow overriding columns
|
||||
overridecolumns = 1;
|
||||
} else if (!strcmp(argv[i], "-noc") || (!strcmp(argv[i], "--no-override-columns"))) { // don't allow overriding columns
|
||||
overridecolumns = 0;
|
||||
} else if (!strcmp(argv[i], "-P") || (!strcmp(argv[i], "--password"))) { // is the input a password
|
||||
passwd = 1;
|
||||
} else if (!strcmp(argv[i], "-nP") || (!strcmp(argv[i], "--no-password"))) { // is the input a password
|
||||
|
@ -604,6 +618,10 @@ void usage(int status) {
|
|||
"spmenu -na, --no-alpha Disable alpha\n"
|
||||
"spmenu -tp, --allow-typing Allow the user to type\n"
|
||||
"spmenu -nt, --no-allow-typing Don't allow typing, the user must select an option\n"
|
||||
"spmenu -ol, --override-lines Allow keybinds to override lines\n"
|
||||
"spmenu -oc, --override-columns Allow keybinds to override columns\n"
|
||||
"spmenu -nol, --no-override-lines Don't allow keybinds to override lines\n"
|
||||
"spmenu -noc, --no-override-columns Don't allow keybinds to override columns\n"
|
||||
, status ? stderr : stdout);
|
||||
|
||||
fputs(
|
||||
|
|
|
@ -523,6 +523,8 @@ void conf_init(void) {
|
|||
config_setting_lookup_int(conf, "height", &lineheight); // spmenu.line.height
|
||||
config_setting_lookup_int(conf, "lines", &lines); // spmenu.line.lines
|
||||
config_setting_lookup_int(conf, "columns", &columns); // spmenu.line.columns
|
||||
config_setting_lookup_int(conf, "overridelines", &overridelines); // spmenu.line.overridelines
|
||||
config_setting_lookup_int(conf, "overridecolumns", &overridecolumns); // spmenu.line.overridecolumns
|
||||
config_setting_lookup_int(conf, "indentitems", &indentitems); // spmenu.line.indentitems
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,8 @@ static char *listfile = NULL; /* File to read entries from inst
|
|||
static int lineheight = 1; /* Line height (0: Calculate automatically) */
|
||||
static int lines = 0; /* Default number of lines */
|
||||
static int columns = 10; /* Default number of columns */
|
||||
static int overridelines = 1; /* Allow overriding lines using keybinds */
|
||||
static int overridecolumns = 1; /* Allow overriding columns using keybinds */
|
||||
|
||||
/* History options */
|
||||
static int maxhist = 64; /* Max number of history entries */
|
||||
|
|
|
@ -134,6 +134,8 @@ ResourcePref resources[] = {
|
|||
{ "lines", INTEGER, &lines },
|
||||
{ "lineheight", INTEGER, &lineheight },
|
||||
{ "columns", INTEGER, &columns },
|
||||
{ "overridelines", INTEGER, &overridelines },
|
||||
{ "overridecolumns", INTEGER, &overridecolumns },
|
||||
{ "maxhist", INTEGER, &maxhist },
|
||||
{ "hideitem", INTEGER, &hideitem },
|
||||
{ "hidematchcount", INTEGER, &hidematchcount },
|
||||
|
|
12
spmenu.1
12
spmenu.1
|
@ -154,6 +154,18 @@ Allow the user to type
|
|||
\f[V]-nt, --no-allow-typing\f[R]
|
||||
Don\[cq]t allow typing, the user must select an option
|
||||
.TP
|
||||
\f[V]-ol, --override-lines\f[R]
|
||||
Allow keybinds to override lines
|
||||
.TP
|
||||
\f[V]-oc, --override-columns\f[R]
|
||||
Allow keybinds to override columns
|
||||
.TP
|
||||
\f[V]-nol, --no-override-lines\f[R]
|
||||
Don\[cq]t allow keybinds to override lines
|
||||
.TP
|
||||
\f[V]-noc, --no-override-columns\f[R]
|
||||
Don\[cq]t allow keybinds to override columns
|
||||
.TP
|
||||
\f[V]-x, --x-position x offset\f[R]
|
||||
Offset spmenu x position by x offset (X11 only)
|
||||
.TP
|
||||
|
|
Loading…
Reference in a new issue