config.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * wmfs2 by Martin Duquesnoy <xorg62@gmail.com> { for(i = 2011; i < 2111; ++i) ©(i); }
  3. * For license, see COPYING.
  4. */
  5. #ifndef CONFIG_H
  6. #define CONFIG_H
  7. #include <string.h>
  8. #include <X11/Xlib.h>
  9. #include "wmfs.h"
  10. #include "util.h"
  11. #include "tag.h"
  12. #include "client.h"
  13. #include "status.h"
  14. #include "mouse.h"
  15. #define THEME_DEFAULT (SLIST_FIRST(&W->h.theme))
  16. static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
  17. {
  18. /* Sys */
  19. { "spawn", uicb_spawn },
  20. { "quit", uicb_quit },
  21. { "reload", uicb_reload },
  22. /* Tag */
  23. { "tag_set", uicb_tag_set },
  24. { "tag", uicb_tag_set_with_name },
  25. { "tag_next", uicb_tag_next },
  26. { "tag_prev", uicb_tag_prev },
  27. { "tag_client", uicb_tag_client },
  28. /* Layout */
  29. { "layout_vmirror", uicb_layout_vmirror },
  30. { "layout_hmirror", uicb_layout_hmirror },
  31. { "layout_rotate_left", uicb_layout_rotate_left },
  32. { "layout_rotate_right", uicb_layout_rotate_right },
  33. { "layout_prev_set", uicb_layout_prev_set },
  34. { "layout_next_set", uicb_layout_next_set },
  35. /* Client */
  36. { "client_close", uicb_client_close },
  37. { "client_resize_right", uicb_client_resize_Right },
  38. { "client_resize_left", uicb_client_resize_Left },
  39. { "client_resize_top", uicb_client_resize_Top },
  40. { "client_resize_bottom", uicb_client_resize_Bottom },
  41. { "client_focus_right", uicb_client_focus_Right },
  42. { "client_focus_left", uicb_client_focus_Left },
  43. { "client_focus_top", uicb_client_focus_Top },
  44. { "client_focus_bottom", uicb_client_focus_Bottom },
  45. { "client_tab_right", uicb_client_tab_Right },
  46. { "client_tab_left", uicb_client_tab_Left },
  47. { "client_tab_top", uicb_client_tab_Top },
  48. { "client_tab_bottom", uicb_client_tab_Bottom },
  49. { "client_swap_right", uicb_client_swap_Right },
  50. { "client_swap_left", uicb_client_swap_Left },
  51. { "client_swap_top", uicb_client_swap_Top },
  52. { "client_swap_bottom", uicb_client_swap_Bottom },
  53. { "client_focus_next", uicb_client_focus_next },
  54. { "client_focus_prev", uicb_client_focus_prev },
  55. { "client_swap_next", uicb_client_swapsel_next },
  56. { "client_swap_prev", uicb_client_swapsel_prev },
  57. { "client_untab", uicb_client_untab },
  58. { "client_focus_next_tab", uicb_client_focus_next_tab },
  59. { "client_focus_prev_tab", uicb_client_focus_prev_tab },
  60. /* Status */
  61. { "status" , uicb_status },
  62. /* Mouse */
  63. { "mouse_resize", uicb_mouse_resize },
  64. { "mouse_move", uicb_mouse_move },
  65. { "mouse_tab", uicb_mouse_tab },
  66. { NULL, NULL }
  67. };
  68. static inline void*
  69. uicb_name_func(Uicb name)
  70. {
  71. int i = 0;
  72. for(; uicb_list[i].func; ++i)
  73. if(!strcmp(name, uicb_list[i].name))
  74. return uicb_list[i].func;
  75. return NULL;
  76. }
  77. static const struct { const char *name; KeySym keysym; } key_list[] =
  78. {
  79. {"Control", ControlMask },
  80. {"Shift", ShiftMask },
  81. {"Lock", LockMask },
  82. {"Alt", Mod1Mask },
  83. {"Mod1", Mod1Mask },
  84. {"Mod2", Mod2Mask },
  85. {"Mod3", Mod3Mask },
  86. {"Mod4", Mod4Mask },
  87. {"Super", Mod4Mask },
  88. {"Home", Mod4Mask },
  89. {"Mod5", Mod5Mask },
  90. {NULL, NoSymbol }
  91. };
  92. static inline KeySym
  93. modkey_keysym(const char *name)
  94. {
  95. int i = 0;
  96. for(; key_list[i].name; ++i)
  97. if(!strcmp(name, key_list[i].name))
  98. return key_list[i].keysym;
  99. return NoSymbol;
  100. }
  101. static inline struct theme*
  102. name_to_theme(const char *name)
  103. {
  104. struct theme *t;
  105. SLIST_FOREACH(t, &W->h.theme, next)
  106. if(!strcmp(t->name, name))
  107. return t;
  108. return THEME_DEFAULT;
  109. }
  110. void config_init(void);
  111. #endif /* CONFIG_H */