Launcher: Add width_limit option in multi set_launcher section to limit size of launcher window (Requested by s__C)

This commit is contained in:
Martin Duquesnoy
2010-11-28 13:06:24 +01:00
parent 719654fcbc
commit 3cf93a0961
4 changed files with 11 additions and 6 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -333,6 +333,7 @@ typedef struct
char *command;
char histo[HISTOLEN][512];
uint nhisto;
int width;
} Launcher;
/* Button struct */