2 * uicb.c - user interface callbacks management
4 * Copyright © 2007 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "statusbar.h"
32 #include "layouts/tile.h"
34 extern AwesomeConf globalconf
;
36 const NameFuncLink UicbList
[] =
39 {"spawn", uicb_spawn
},
42 {"client_kill", uicb_client_kill
},
43 {"client_moveresize", uicb_client_moveresize
},
44 {"client_settrans", uicb_client_settrans
},
45 {"client_swapnext", uicb_client_swapnext
},
46 {"client_swapprev", uicb_client_swapprev
},
48 {"client_tag", uicb_client_tag
},
49 {"client_togglefloating", uicb_client_togglefloating
},
50 {"tag_toggleview", uicb_tag_toggleview
},
51 {"client_toggletag", uicb_client_toggletag
},
52 {"tag_view", uicb_tag_view
},
53 {"tag_viewprev_selected", uicb_tag_prev_selected
},
54 {"tag_viewprev", uicb_tag_viewprev
},
55 {"tag_viewnext", uicb_tag_viewnext
},
56 {"tag_create", uicb_tag_create
},
58 {"tag_setlayout", uicb_tag_setlayout
},
59 {"client_focusnext", uicb_client_focusnext
},
60 {"client_focusprev", uicb_client_focusprev
},
61 {"client_togglemax", uicb_client_togglemax
},
62 {"client_toggleverticalmax", uicb_client_toggleverticalmax
},
63 {"client_togglehorizontalmax", uicb_client_togglehorizontalmax
},
64 {"client_zoom", uicb_client_zoom
},
66 {"tag_setmwfact", uicb_tag_setmwfact
},
67 {"tag_setnmaster", uicb_tag_setnmaster
},
68 {"tag_setncol", uicb_tag_setncol
},
70 {"screen_focus", uicb_screen_focus
},
71 {"client_movetoscreen", uicb_client_movetoscreen
},
75 {"statusbar_toggle", uicb_statusbar_toggle
},
77 {"client_movemouse", uicb_client_movemouse
},
78 {"client_resizemouse", uicb_client_resizemouse
},
80 {"focus_history", uicb_focus_history
},
81 {"focus_client_byname", uicb_focus_client_byname
},
83 {"widget_tell", uicb_widget_tell
},
100 warn("Ignoring malformed command\n");
104 if(screen
>= get_screen_count() || screen
< 0)
106 warn("Invalid screen specified: %i\n", screen
);
110 p
= strtok(NULL
, " ");
113 warn("Ignoring malformed command.\n");
117 uicb
= name_func_lookup(p
, UicbList
);
120 warn("Unknown UICB function: %s.\n", p
);
124 if (p
+ a_strlen(p
) < cmd
+ len
)
126 arg
= p
+ a_strlen(p
) + 1;
128 /* Allow our callees to modify this string. */
129 argcpy
= p_new(char, len
+ 1);
130 a_strncpy(argcpy
, len
+ 1, arg
, len
);
131 uicb(screen
, argcpy
);
141 parse_control(char *cmd
)
143 char *p
, *curcmd
= cmd
;
148 while((p
= strchr(curcmd
, '\n')))
158 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80