diff --git a/src/config.c b/src/config.c index f94d5f9..df102c8 100644 --- a/src/config.c +++ b/src/config.c @@ -718,6 +718,7 @@ conf_launcher_section(void) conf.launcher[i].name = fetch_opt_first(set_launcher[i], "launcher", "name").str; conf.launcher[i].prompt = fetch_opt_first(set_launcher[i], "Exec:", "prompt").str; conf.launcher[i].command = fetch_opt_first(set_launcher[i], "exec", "command").str; + conf.launcher[i].width = fetch_opt_first(set_launcher[i], "0", "width_limit").num; conf.launcher[i].nhisto = 1; } free(set_launcher); diff --git a/src/ewmh.c b/src/ewmh.c index 940484a..7fe04d8 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -105,6 +105,7 @@ ewmh_init_hints(void) net_atom[wmfs_nmaster] = ATOM("_WMFS_NMASTER"); net_atom[wmfs_function] = ATOM("_WMFS_FUNCTION"); net_atom[wmfs_cmd] = ATOM("_WMFS_CMD"); + net_atom[wmfs_font] = ATOM("_WMFS_FONT"); /* Multi atom _WMFS_STATUSTEXT_ */ for(j = 0; j < s; ++j) diff --git a/src/init.c b/src/init.c index 0528fc3..21b01e0 100644 --- a/src/init.c +++ b/src/init.c @@ -91,6 +91,10 @@ init_font(void) font = XftFontOpenName(dpy, SCREEN, "sans-10"); } + /* Set font in _WMFS_FONT for eventual status tools */ + XChangeProperty(dpy, ROOT, net_atom[wmfs_font], net_atom[utf8_string], 8, + PropModeReplace, (uchar*)&conf.font, strlen(conf.font)); + return; } diff --git a/src/launcher.c b/src/launcher.c index aab5566..6690080 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -46,7 +46,7 @@ launcher_execute(Launcher *launcher) char buf[512] = { 0 }; char tmpbuf[512] = { 0 }; char *complete; - int i, pos = 0, histpos = 0, x; + int i, pos = 0, histpos = 0, x, w; int tabhits = 0; KeySym ks; XEvent ev; @@ -59,8 +59,10 @@ launcher_execute(Launcher *launcher) XGrabKeyboard(dpy, ROOT, True, GrabModeAsync, GrabModeAsync, CurrentTime); - bw = barwin_create(infobar[selscreen].bar->win, x, 1, - infobar[selscreen].bar->geo.width - x - 1, + w = (launcher->width ? launcher->width : infobar[selscreen].bar->geo.width - x - 1); + + bw = barwin_create(infobar[selscreen].bar->win, x, 1, w, + /* infobar[selscreen].bar->geo.width - x - 1, */ infobar[selscreen].bar->geo.height - 2, infobar[selscreen].bar->bg, infobar[selscreen].bar->fg, @@ -71,9 +73,7 @@ launcher_execute(Launcher *launcher) /* First draw of the cursor */ XSetForeground(dpy, gc, getcolor(infobar[selscreen].bar->fg)); - /*XDrawLine(dpy, bw->dr, gc, 1 + textw(launcher->prompt) + textw(" "), - , 1 + textw(launcher->prompt) + textw(" "), INFOBARH - 4); - */ + XDrawLine(dpy, bw->dr, gc, 1 + textw(launcher->prompt) + textw(" ") + textw(buf), 2, 1 + textw(launcher->prompt) + textw(" ") + textw(buf), INFOBARH - 4); diff --git a/src/structs.h b/src/structs.h index 15a49eb..a7e1061 100644 --- a/src/structs.h +++ b/src/structs.h @@ -148,6 +148,7 @@ enum wmfs_screen_count, wmfs_function, wmfs_cmd, + wmfs_font, wmfs_statustext, net_last }; @@ -333,6 +334,7 @@ typedef struct char *command; char histo[HISTOLEN][512]; uint nhisto; + int width; } Launcher; /* Button struct */ diff --git a/src/wmfs.c b/src/wmfs.c index 584086c..10d0cfe 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -422,6 +422,7 @@ main(int argc, char **argv) argv_global = xstrdup(argv[0]); all_argv = argv; + sprintf(conf.confpath, "%s/"DEF_CONF, getenv("HOME")); while((i = getopt(argc, argv, "hviSc:s:g:C:V:")) != -1) diff --git a/wmfsrc b/wmfsrc index 0b675bd..4646fd0 100644 --- a/wmfsrc +++ b/wmfsrc @@ -267,6 +267,9 @@ [launcher] [set_launcher] + # Limit size of the launcher window (px) + width_limit = 300 + name = "launcher_exec" prompt = "Exec: " command = "exec"