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.
30 #include "statusbar.h"
33 #include "layouts/tile.h"
35 extern AwesomeConf globalconf
;
37 const NameFuncLink UicbList
[] =
40 {"spawn", uicb_spawn
},
43 {"client_kill", uicb_client_kill
},
44 {"client_moveresize", uicb_client_moveresize
},
45 {"client_settrans", uicb_client_settrans
},
46 {"setborder", uicb_setborder
},
47 {"client_swapnext", uicb_client_swapnext
},
48 {"client_swapprev", uicb_client_swapprev
},
50 {"client_tag", uicb_client_tag
},
51 {"client_togglefloating", uicb_client_togglefloating
},
52 {"tag_toggleview", uicb_tag_toggleview
},
53 {"client_toggletag", uicb_client_toggletag
},
54 {"tag_view", uicb_tag_view
},
55 {"tag_viewprev_selected", uicb_tag_prev_selected
},
56 {"tag_viewprev", uicb_tag_viewprev
},
57 {"tag_viewnext", uicb_tag_viewnext
},
59 {"tag_setlayout", uicb_tag_setlayout
},
60 {"client_focusnext", uicb_client_focusnext
},
61 {"client_focusprev", uicb_client_focusprev
},
62 {"client_togglemax", uicb_client_togglemax
},
63 {"client_toggleverticalmax", uicb_client_toggleverticalmax
},
64 {"client_togglehorizontalmax", uicb_client_togglehorizontalmax
},
65 {"client_zoom", uicb_client_zoom
},
67 {"tag_setmwfact", uicb_tag_setmwfact
},
68 {"tag_setnmaster", uicb_tag_setnmaster
},
69 {"tag_setncol", uicb_tag_setncol
},
71 {"screen_focus", uicb_screen_focus
},
72 {"client_movetoscreen", uicb_client_movetoscreen
},
76 {"statusbar_toggle", uicb_statusbar_toggle
},
77 {"statusbar_set_position", uicb_statusbar_set_position
},
79 {"client_movemouse", uicb_client_movemouse
},
80 {"client_resizemouse", uicb_client_resizemouse
},
82 {"focus_history", uicb_focus_history
},
83 {"focus_client_byname", uicb_focus_client_byname
},
85 {"widget_tell", uicb_widget_tell
},
90 run_uicb(char *cmd
, AwesomeConf
*awesomeconf
__attribute ((unused
)))
96 void (*uicb
) (int, const char *);
101 warn("Ignoring malformed command\n");
105 if(screen
>= get_screen_count() || screen
< 0){
106 warn("Invalid screen specified: %i\n", screen
);
110 p
= strtok(NULL
, " ");
112 warn("Ignoring malformed command.\n");
115 uicb
= name_func_lookup(p
, UicbList
);
117 warn("Unknown UICB function: %s.\n", p
);
121 if (p
+strlen(p
) < cmd
+len
)
123 arg
= p
+ strlen(p
) + 1;
124 /* Allow our callees to modify this string. */
125 argcpy
= p_new(char, strlen(arg
)+1);
126 strncpy(argcpy
, arg
, strlen(arg
));
127 uicb(screen
, argcpy
);
136 parse_control(char *cmd
)
138 char *p
, *curcmd
= cmd
;
143 while((p
= strchr(curcmd
, '\n')))
146 run_uicb(curcmd
, &globalconf
);
152 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80