From 3cf93a0961b4f4aed38908133651e78621e7868d Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Sun, 28 Nov 2010 13:06:24 +0100 Subject: [PATCH] Launcher: Add width_limit option in multi set_launcher section to limit size of launcher window (Requested by s__C) --- src/config.c | 1 + src/launcher.c | 12 ++++++------ src/structs.h | 1 + wmfsrc | 3 +++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/config.c b/src/config.c index acf6e86..ca9c84b 100644 --- a/src/config.c +++ b/src/config.c @@ -716,6 +716,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/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 4f8692e..c0da549 100644 --- a/src/structs.h +++ b/src/structs.h @@ -333,6 +333,7 @@ typedef struct char *command; char histo[HISTOLEN][512]; uint nhisto; + int width; } Launcher; /* Button struct */ 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"