diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-08-16 18:09:06 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2013-02-18 21:04:27 (GMT) |
commit | c0ff6ce3cb262f0dc24c3a79b2c40f36fdf1639b (patch) | |
tree | d3af46ae05e036ae125336edb96c7891536c0011 /util/fluxbox-update_configs.cc | |
parent | 5902ade8a996f7dcf085b4f4fc2d1425bce809f6 (diff) | |
download | fluxbox_pavel-c0ff6ce3cb262f0dc24c3a79b2c40f36fdf1639b.zip fluxbox_pavel-c0ff6ce3cb262f0dc24c3a79b2c40f36fdf1639b.tar.bz2 |
fluxbox-update_configs: automatically update keys file
Diffstat (limited to 'util/fluxbox-update_configs.cc')
-rw-r--r-- | util/fluxbox-update_configs.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc index 233bdbb..883d864 100644 --- a/util/fluxbox-update_configs.cc +++ b/util/fluxbox-update_configs.cc | |||
@@ -724,6 +724,22 @@ update_move_slitlist_to_init_file(std::auto_ptr<FbTk::ResourceManager_base>& rm, | |||
724 | rc_slitlist->push_back(line); | 724 | rc_slitlist->push_back(line); |
725 | } | 725 | } |
726 | 726 | ||
727 | void update_keys_for_lua(std::auto_ptr<FbTk::ResourceManager_base>& rm, FbTk::Lua &l) { | ||
728 | extern const char update_keys[]; | ||
729 | extern const unsigned int update_keys_size; | ||
730 | |||
731 | l.checkstack(2); | ||
732 | lua::stack_sentry s(l); | ||
733 | |||
734 | FbTk::StringResource &rc_keyfile = rm->getResource<string, FbTk::StringTraits>("keyFile"); | ||
735 | |||
736 | l.loadstring(update_keys, update_keys_size); | ||
737 | l.pushstring(read_file(FbTk::StringUtil::expandFilename(*rc_keyfile))); | ||
738 | l.call(1, 1); | ||
739 | *rc_keyfile = string(*rc_keyfile) + ".lua"; | ||
740 | write_file(FbTk::StringUtil::expandFilename(*rc_keyfile), l.tostring(-1)); | ||
741 | } | ||
742 | |||
727 | /*------------------------------------------------------------------*\ | 743 | /*------------------------------------------------------------------*\ |
728 | \*------------------------------------------------------------------*/ | 744 | \*------------------------------------------------------------------*/ |
729 | 745 | ||
@@ -747,7 +763,8 @@ const Update UPDATES[] = { | |||
747 | { 12, update_keys_for_activetab }, | 763 | { 12, update_keys_for_activetab }, |
748 | { 13, update_limit_nextwindow_to_current_workspace }, | 764 | { 13, update_limit_nextwindow_to_current_workspace }, |
749 | { 14, update_lua_resource_manager }, | 765 | { 14, update_lua_resource_manager }, |
750 | { 15, update_move_slitlist_to_init_file } | 766 | { 15, update_move_slitlist_to_init_file }, |
767 | { 16, update_keys_for_lua } | ||
751 | }; | 768 | }; |
752 | 769 | ||
753 | /*------------------------------------------------------------------*\ | 770 | /*------------------------------------------------------------------*\ |