diff options
Diffstat (limited to 'src/Keys.hh')
-rw-r--r-- | src/Keys.hh | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/Keys.hh b/src/Keys.hh index 7ebb0a7..0812761 100644 --- a/src/Keys.hh +++ b/src/Keys.hh | |||
@@ -23,6 +23,7 @@ | |||
23 | #define KEYS_HH | 23 | #define KEYS_HH |
24 | 24 | ||
25 | #include "FbTk/NotCopyable.hh" | 25 | #include "FbTk/NotCopyable.hh" |
26 | #include "FbTk/AutoReloadHelper.hh" | ||
26 | 27 | ||
27 | #include <X11/Xlib.h> | 28 | #include <X11/Xlib.h> |
28 | #include <string> | 29 | #include <string> |
@@ -57,17 +58,6 @@ public: | |||
57 | /// destructor | 58 | /// destructor |
58 | ~Keys(); | 59 | ~Keys(); |
59 | 60 | ||
60 | /** | ||
61 | Load configuration from file | ||
62 | @return true on success, else false | ||
63 | */ | ||
64 | bool load(const char *filename = 0); | ||
65 | /** | ||
66 | Save keybindings to a file | ||
67 | Note: the file will be overwritten | ||
68 | @return true on success, else false | ||
69 | */ | ||
70 | bool save(const char *filename = 0) const; | ||
71 | /// bind a key action from a string | 61 | /// bind a key action from a string |
72 | /// @return false on failure | 62 | /// @return false on failure |
73 | bool addBinding(const std::string &binding); | 63 | bool addBinding(const std::string &binding); |
@@ -83,12 +73,15 @@ public: | |||
83 | /// unregister window | 73 | /// unregister window |
84 | void unregisterWindow(Window win); | 74 | void unregisterWindow(Window win); |
85 | 75 | ||
76 | const std::string& filename() const { return m_filename; } | ||
86 | /** | 77 | /** |
87 | Reload configuration from filename | 78 | Load configuration from file |
88 | @return true on success, else false | ||
89 | */ | 79 | */ |
90 | bool reconfigure(const char *filename); | 80 | void reload(); |
91 | const std::string& filename() const { return m_filename; } | 81 | /** |
82 | Reload configuration if keys file has changed | ||
83 | */ | ||
84 | void reconfigure(); | ||
92 | void keyMode(const std::string& keyMode); | 85 | void keyMode(const std::string& keyMode); |
93 | private: | 86 | private: |
94 | class t_key; // helper class to build a 'keytree' | 87 | class t_key; // helper class to build a 'keytree' |
@@ -104,13 +97,14 @@ private: | |||
104 | void ungrabButtons(); | 97 | void ungrabButtons(); |
105 | void grabWindow(Window win); | 98 | void grabWindow(Window win); |
106 | 99 | ||
107 | // Load default keybindings for when there are errors loading the initial one | 100 | // Load default keybindings for when there are errors loading the keys file |
108 | void loadDefaults(); | 101 | void loadDefaults(); |
109 | void setKeyMode(t_key *keyMode); | 102 | void setKeyMode(t_key *keyMode); |
110 | 103 | ||
111 | 104 | ||
112 | // member variables | 105 | // member variables |
113 | std::string m_filename; | 106 | std::string m_filename; |
107 | FbTk::AutoReloadHelper m_reloader; | ||
114 | t_key *m_keylist; | 108 | t_key *m_keylist; |
115 | keyspace_t m_map; | 109 | keyspace_t m_map; |
116 | 110 | ||