config.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. #include "screen.h"
  16. #include "infobar.h"
  17. #include "launcher.h"
  18. #define THEME_DEFAULT (SLIST_FIRST(&W->h.theme))
  19. static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
  20. {
  21. /* Sys */
  22. { "spawn", uicb_spawn },
  23. { "quit", uicb_quit },
  24. { "reload", uicb_reload },
  25. /* Tag */
  26. { "tag_set", uicb_tag_set },
  27. { "tag", uicb_tag_set_with_name },
  28. { "tag_next", uicb_tag_next },
  29. { "tag_prev", uicb_tag_prev },
  30. { "tag_client", uicb_tag_client },
  31. { "tag_client_and_set", uicb_tag_client_and_set },
  32. { "tag_move_client_next", uicb_tag_move_client_next },
  33. { "tag_move_client_prev", uicb_tag_move_client_prev },
  34. { "tag_click", uicb_tag_click },
  35. { "tag_new", uicb_tag_new },
  36. { "tag_del", uicb_tag_del },
  37. /* Layout */
  38. { "layout_vmirror", uicb_layout_vmirror },
  39. { "layout_hmirror", uicb_layout_hmirror },
  40. { "layout_rotate_left", uicb_layout_rotate_left },
  41. { "layout_rotate_right", uicb_layout_rotate_right },
  42. { "layout_prev_set", uicb_layout_prev_set },
  43. { "layout_next_set", uicb_layout_next_set },
  44. { "layout_integrate_left", uicb_layout_integrate_Left },
  45. { "layout_integrate_right", uicb_layout_integrate_Right },
  46. { "layout_integrate_top", uicb_layout_integrate_Top },
  47. { "layout_integrate_bottom", uicb_layout_integrate_Bottom },
  48. /* Client */
  49. { "client_close", uicb_client_close },
  50. { "client_resize_right", uicb_client_resize_Right },
  51. { "client_resize_left", uicb_client_resize_Left },
  52. { "client_resize_top", uicb_client_resize_Top },
  53. { "client_resize_bottom", uicb_client_resize_Bottom },
  54. { "client_focus_right", uicb_client_focus_Right },
  55. { "client_focus_left", uicb_client_focus_Left },
  56. { "client_focus_top", uicb_client_focus_Top },
  57. { "client_focus_bottom", uicb_client_focus_Bottom },
  58. { "client_tab_right", uicb_client_tab_Right },
  59. { "client_tab_left", uicb_client_tab_Left },
  60. { "client_tab_top", uicb_client_tab_Top },
  61. { "client_tab_bottom", uicb_client_tab_Bottom },
  62. { "client_swap_right", uicb_client_swap_Right },
  63. { "client_swap_left", uicb_client_swap_Left },
  64. { "client_swap_top", uicb_client_swap_Top },
  65. { "client_swap_bottom", uicb_client_swap_Bottom },
  66. { "client_focus_next", uicb_client_focus_next },
  67. { "client_focus_prev", uicb_client_focus_prev },
  68. { "client_swap_next", uicb_client_swapsel_next },
  69. { "client_swap_prev", uicb_client_swapsel_prev },
  70. { "client_untab", uicb_client_untab },
  71. { "client_focus_next_tab", uicb_client_focus_next_tab },
  72. { "client_focus_prev_tab", uicb_client_focus_prev_tab },
  73. { "client_focus_click", uicb_client_focus_click },
  74. { "client_toggle_free", uicb_client_toggle_free },
  75. { "client_toggle_ignore_tag", uicb_client_toggle_ignore_tag },
  76. { "client_tab_next_opened", uicb_client_tab_next_opened },
  77. /* Status */
  78. { "status" , uicb_status },
  79. { "status_surface", uicb_status_surface },
  80. /* Infobar */
  81. { "infobar_toggle_hide", uicb_infobar_toggle_hide },
  82. /* Mouse */
  83. { "mouse_resize", uicb_mouse_resize },
  84. { "mouse_move", uicb_mouse_move },
  85. { "mouse_swap", uicb_mouse_move },
  86. { "mouse_tab", uicb_mouse_tab },
  87. /* Screen */
  88. { "screen_next", uicb_screen_next },
  89. { "screen_prev", uicb_screen_prev },
  90. { "screen_move_client_next", uicb_screen_move_client_next },
  91. { "screen_move_client_prev", uicb_screen_move_client_prev },
  92. /* Launcher */
  93. { "launcher", uicb_launcher },
  94. { NULL, NULL }
  95. };
  96. static inline void*
  97. uicb_name_func(Uicb name)
  98. {
  99. int i = 0;
  100. for(; uicb_list[i].func; ++i)
  101. if(!strcmp(name, uicb_list[i].name))
  102. return uicb_list[i].func;
  103. return NULL;
  104. }
  105. static const struct { const char *name; KeySym keysym; } key_list[] =
  106. {
  107. {"Control", ControlMask },
  108. {"Shift", ShiftMask },
  109. {"Lock", LockMask },
  110. {"Alt", Mod1Mask },
  111. {"Mod1", Mod1Mask },
  112. {"Mod2", Mod2Mask },
  113. {"Mod3", Mod3Mask },
  114. {"Mod4", Mod4Mask },
  115. {"Super", Mod4Mask },
  116. {"Home", Mod4Mask },
  117. {"Mod5", Mod5Mask },
  118. {NULL, NoSymbol }
  119. };
  120. static inline KeySym
  121. modkey_keysym(const char *name)
  122. {
  123. int i = 0;
  124. for(; key_list[i].name; ++i)
  125. if(!strcmp(name, key_list[i].name))
  126. return key_list[i].keysym;
  127. return NoSymbol;
  128. }
  129. static inline struct theme*
  130. name_to_theme(const char *name)
  131. {
  132. struct theme *t;
  133. SLIST_FOREACH(t, &W->h.theme, next)
  134. if(!strcmp(t->name, name))
  135. return t;
  136. return THEME_DEFAULT;
  137. }
  138. void config_init(void);
  139. #endif /* CONFIG_H */