config.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. #define THEME_DEFAULT (SLIST_FIRST(&W->h.theme))
  14. static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
  15. {
  16. /* Sys */
  17. { "spawn", uicb_spawn },
  18. { "quit", uicb_quit },
  19. { "reload", uicb_reload },
  20. /* Tag */
  21. { "tag_set", uicb_tag_set },
  22. { "tag", uicb_tag_set_with_name },
  23. { "tag_next", uicb_tag_next },
  24. { "tag_prev", uicb_tag_prev },
  25. /* Layout */
  26. { "layout_vmirror", uicb_layout_vmirror },
  27. { "layout_hmirror", uicb_layout_hmirror },
  28. { "layout_rotate_left", uicb_layout_rotate_left },
  29. { "layout_rotate_right", uicb_layout_rotate_right },
  30. /* Client */
  31. { "client_close", uicb_client_close },
  32. { "client_resize_right", uicb_client_resize_Right },
  33. { "client_resize_left", uicb_client_resize_Left },
  34. { "client_resize_top", uicb_client_resize_Top },
  35. { "client_resize_bottom", uicb_client_resize_Bottom },
  36. { "client_focus_right", uicb_client_focus_Right },
  37. { "client_focus_left", uicb_client_focus_Left },
  38. { "client_focus_top", uicb_client_focus_Top },
  39. { "client_focus_bottom", uicb_client_focus_Bottom },
  40. { "client_swap_right", uicb_client_swapsel_Right },
  41. { "client_swap_left", uicb_client_swapsel_Left },
  42. { "client_swap_top", uicb_client_swapsel_Top },
  43. { "client_swap_bottom", uicb_client_swapsel_Bottom },
  44. { "client_focus_next", uicb_client_focus_next },
  45. { "client_focus_prev", uicb_client_focus_prev },
  46. { "client_swap_next", uicb_client_swapsel_next },
  47. { "client_swap_prev", uicb_client_swapsel_prev },
  48. { NULL, NULL }
  49. };
  50. static inline void*
  51. uicb_name_func(Uicb name)
  52. {
  53. int i = 0;
  54. for(; uicb_list[i].func; ++i)
  55. if(!strcmp(name, uicb_list[i].name))
  56. return uicb_list[i].func;
  57. return NULL;
  58. }
  59. static const struct { const char *name; KeySym keysym; } key_list[] =
  60. {
  61. {"Control", ControlMask },
  62. {"Shift", ShiftMask },
  63. {"Lock", LockMask },
  64. {"Alt", Mod1Mask },
  65. {"Mod1", Mod1Mask },
  66. {"Mod2", Mod2Mask },
  67. {"Mod3", Mod3Mask },
  68. {"Mod4", Mod4Mask },
  69. {"Super", Mod4Mask },
  70. {"Home", Mod4Mask },
  71. {"Mod5", Mod5Mask },
  72. {NULL, NoSymbol }
  73. };
  74. static inline KeySym
  75. modkey_keysym(const char *name)
  76. {
  77. int i = 0;
  78. for(; key_list[i].name; ++i)
  79. if(!strcmp(name, key_list[i].name))
  80. return key_list[i].keysym;
  81. return NoSymbol;
  82. }
  83. static inline struct theme*
  84. name_to_theme(const char *name)
  85. {
  86. struct theme *t;
  87. SLIST_FOREACH(t, &W->h.theme, next)
  88. if(!strcmp(t->name, name))
  89. return t;
  90. return THEME_DEFAULT;
  91. }
  92. void config_init(void);
  93. #endif /* CONFIG_H */