diff --git a/docs/docs.md b/docs/docs.md index a2c6a04..deaaa15 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -95,6 +95,9 @@ See a list below for a list. - spmenu -ic - Position the image in the center - spmenu -itc - Position the image in the top center - spmenu -wm - Spawn spmenu as a window manager controlled client +- spmenu -nwm - Don't spawn spmenu as a window manager controlled client +- spmenu -lcfg - Load spmenu configuration (~/.spmenu or ~/.config/spmenu/spmenurc) +- spmenu -ncfg - Don't load spmenu configuration (~/.spmenu or ~/.config/spmenu/spmenurc) - spmenu -v - Print spmenu version to stdout - spmenu -fn font - Set the spmenu font to font diff --git a/docs/example.Xresources b/docs/example.Xresources index 7c3cc7c..b499167 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -60,6 +60,8 @@ spmenu.preselected: 0 spmenu.type: 1 spmenu.class: spmenu spmenu.mon: -1 +spmenu.managed: 0 +spmenu.loadconfig: 0 spmenu.leftarrow: < spmenu.rightarrow: > spmenu.password: . diff --git a/libs/argv.c b/libs/argv.c index c9e1a72..2fbe49f 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -14,6 +14,11 @@ readargs(int argc, char *argv[]) } if (xresources) { + if (loadconfig) { + int cxrdb = system("[ -e $HOME/.config/spmenu/spmenurc ] && xrdb -override $HOME/.config/spmenu/spmenurc"); + int hxrdb = system("[ -e $HOME/.spmenurc ] && xrdb -override $HOME/.spmenurc"); + } + load_xresources(); } @@ -77,6 +82,12 @@ readargs(int argc, char *argv[]) generatecache = 0; } else if (!strcmp(argv[i], "-wm")) { /* display as managed wm window */ managed = 1; + } else if (!strcmp(argv[i], "-nwm")) { /* don't display as managed wm window */ + managed = 0; + } else if (!strcmp(argv[i], "-lcfg")) { /* load config */ + loadconfig = 1; + } else if (!strcmp(argv[i], "-ncfg")) { /* don't load config */ + loadconfig = 0; } else if (!strcmp(argv[i], "-na")) { /* disable alpha */ alpha = 0; } else if (!strcmp(argv[i], "-a")) { /* alpha */ @@ -355,6 +366,9 @@ usage(void) "spmenu -ic Position the image in the center\n" "spmenu -itc Position the image in the top center\n" "spmenu -wm Spawn spmenu as a window manager controlled client/window. Useful for testing\n" + "spmenu -nwm Don't spawn spmenu as a window manager controlled client/window. Useful for testing\n" + "spmenu -lcfg Load spmenu configuration (~/.spmenu or ~/.config/spmenu/spmenurc)\n" + "spmenu -ncfg Don't load spmenu configuration (~/.spmenu or ~/.config/spmenu/spmenurc)\n" "spmenu -v Print spmenu version to stdout\n" "\n", stdout); fputs("- Appearance arguments -\n" diff --git a/libs/xresources.h b/libs/xresources.h index 94e9f43..734bf23 100644 --- a/libs/xresources.h +++ b/libs/xresources.h @@ -134,6 +134,8 @@ ResourcePref resources[] = { { "generatecache", INTEGER, &generatecache }, { "mode", INTEGER, &mode }, { "fast", INTEGER, &fast }, + { "loadconfig", INTEGER, &loadconfig }, + { "managed", INTEGER, &managed }, { "mon", INTEGER, &mon }, { "pango_item", INTEGER, &pango_item }, { "pango_prompt", INTEGER, &pango_prompt }, diff --git a/options.h b/options.h index 2d92d3b..a82383d 100644 --- a/options.h +++ b/options.h @@ -7,6 +7,7 @@ static char class[] = "spmenu"; /* Class for spmenu */ static int fast = 0; /* Grab keyboard first */ static int xresources = 1; /* Enable .Xresources support */ +static int loadconfig = 1; /* Load configuration (~/.spmenurc or ~/.config/spmenu/spmenurc) on runtime */ static int mon = -1; /* Monitor to run spmenu on */ /* Window options */ @@ -16,6 +17,7 @@ static int menupaddingv = 0; /* Vertical padding of bar (in pixels) */ static int menupaddingh = 0; /* Horizontal padding of bar (in pixels) */ static int minwidth = 500; /* Minimum width */ static int centered = 0; /* Whether or not to center spmenu by default */ +static int managed = 0; /* Let your window manager manage spmenu? */ /* Image options */ static int imagewidth = 86; /* Default image width */ diff --git a/spmenu.1 b/spmenu.1 index 4fa159e..5fd650c 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -183,6 +183,15 @@ spmenu -itc - Position the image in the top center .IP \[bu] 2 spmenu -wm - Spawn spmenu as a window manager controlled client .IP \[bu] 2 +spmenu -nwm - Don\[cq]t spawn spmenu as a window manager controlled +client +.IP \[bu] 2 +spmenu -lcfg - Load spmenu configuration (\[ti]/.spmenu or +\[ti]/.config/spmenu/spmenurc) +.IP \[bu] 2 +spmenu -ncfg - Don\[cq]t load spmenu configuration (\[ti]/.spmenu or +\[ti]/.config/spmenu/spmenurc) +.IP \[bu] 2 spmenu -v - Print spmenu version to stdout .IP \[bu] 2 spmenu -fn font - Set the spmenu font to font diff --git a/spmenu.c b/spmenu.c index 7ca156e..393b07a 100644 --- a/spmenu.c +++ b/spmenu.c @@ -154,7 +154,6 @@ static struct item *items = NULL, *backup_items; static struct item *matches, *matchend; static struct item *prev, *curr, *next, *sel; static int screen; -static int managed = 0; /* image globals */ #if USEIMAGE