updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / musca / 0001-fix-dmenu.patch
blob2076e36f4c5b5881cf27616e845a475ee65b62db
1 diff --git a/config.h b/config.h
2 index f27e122..dcad60f 100644
3 --- a/config.h
4 +++ b/config.h
5 @@ -39,7 +39,7 @@ setting settings[] = {
6 // optional startup file of musca commands, one per line
7 { "startup", mst_str, { .s = ".musca_start" }, ".+" },
8 // customize the dmenu command.
9 - { "dmenu", mst_str, { .s = "sort | dmenu -i -b" }, ".+" },
10 + { "dmenu", mst_str, { .s = "-i -b" }, ".+" },
11 // customize the actions of dmenu driven window/group/command menus. by default we
12 // just spit commands back to musca, but you can wrap or redirect stuff. the $MUSCA
13 // environment variable is set to argv[0] in setup(). -i means execute stdin.
14 diff --git a/musca.c b/musca.c
15 index 7f1d6a3..794bb9c 100644
16 --- a/musca.c
17 +++ b/musca.c
18 @@ -2162,8 +2162,16 @@ void launch(char *cmd)
20 void menu(char *cmd, char *after)
22 + // we keep original behaviour by sorting
23 char *tmp = allocate(strlen(cmd)+strlen(after)+BLOCK);
24 - sprintf(tmp, "%s | %s | %s", cmd, settings[ms_dmenu].s, after);
25 + sprintf(tmp, "%s | sort | dmenu %s | %s", cmd, settings[ms_dmenu].s, after);
26 + printf("%s\n", tmp);
27 + launch(tmp); free(tmp);
29 +void menufix(char *cmd, char*after)
31 + char *tmp = allocate(strlen(cmd)+strlen(after)+BLOCK);
32 + sprintf(tmp, "%s %s | %s",cmd, settings[ms_dmenu].s, after);
33 printf("%s\n", tmp);
34 launch(tmp); free(tmp);
36 @@ -2631,7 +2639,7 @@ char* com_command(char *cmd, regmatch_t *subs)
38 char* com_shell(char *cmd, regmatch_t *subs)
40 - menu("dmenu_path", settings[ms_run_shell_command].s);
41 + menufix("dmenu_run", settings[ms_run_shell_command].s);
42 return NULL;
44 char* com_alias(char *cmd, regmatch_t *subs)
45 diff --git a/musca_proto.h b/musca_proto.h
46 index dc14d75..e25c1ea 100644
47 --- a/musca_proto.h
48 +++ b/musca_proto.h
49 @@ -145,6 +145,7 @@ void head_focus(head *h);
50 void head_next();
51 void launch(char *cmd);
52 void menu(char *cmd, char *after);
53 +void menufix(char *cmd, char *after);
54 void menu_wrapper(char *cmd, char *after);
55 void shutdown();
56 dcell parse_size(char *cmd, regmatch_t *subs, ucell index, ucell limit);
57 --
58 1.7.6