summaryrefslogtreecommitdiff
path: root/src/commands.cc
diff options
context:
space:
mode:
authorTobias Pisani <topisani@hamsterpoison.com>2024-03-27 17:52:31 +0100
committerTobias Pisani <topisani@hamsterpoison.com>2024-03-27 17:59:05 +0100
commita1880a544162d9f026093e33018249aa679c8c75 (patch)
tree73f417ba56d3acfb505655a2a653cdd4ea2c86b2 /src/commands.cc
parent5515383ae4683c3d691004cbc422ee1f6e36ee07 (diff)
Add SessionRenamed hook
Diffstat (limited to 'src/commands.cc')
-rw-r--r--src/commands.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/commands.cc b/src/commands.cc
index c1644f01..4404ee70 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -2577,10 +2577,12 @@ const CommandDesc rename_session_cmd = {
CommandFlags::None,
CommandHelper{},
make_single_word_completer([](const Context&){ return Server::instance().session(); }),
- [](const ParametersParser& parser, Context&, const ShellContext&)
+ [](const ParametersParser& parser, Context& ctx, const ShellContext&)
{
+ String old_name = Server::instance().session();
if (not Server::instance().rename_session(parser[0]))
throw runtime_error(format("unable to rename current session: '{}' may be already in use", parser[0]));
+ ctx.hooks().run_hook(Hook::SessionRenamed, format("{}:{}", old_name, Server::instance().session()), ctx);
}
};