Skip to content

Commit

Permalink
Don't wrap command in shell in i3 if not needed
Browse files Browse the repository at this point in the history
Related to enkore#179
  • Loading branch information
meator committed Sep 7, 2024
1 parent 338394e commit 2880efa
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -799,20 +799,28 @@ class I3Executable final : public BaseExecutable
std::vector<std::string> command_array =
CMDLineAssembly::convert_exec_to_command(info.app->exec);
expand_field_codes(command_array, *info.app, info.args);
if (!info.app->path.empty())
if (!info.app->path.empty()) {
result = "cd " + CMDLineAssembly::sq_quote(info.app->path) +
" && " +
CMDLineAssembly::convert_argv_to_string(command_array);
else
result = CMDLineAssembly::convert_argv_to_string(command_array);

if (info.app->terminal) {
std::vector<std::string> new_command_array =
CMDLineAssembly::wrap_cmdstring_in_shell(result);
new_command_array = this->term_assembler(
new_command_array, this->terminal, info.app->name);
result =
CMDLineAssembly::convert_argv_to_string(new_command_array);
if (info.app->terminal) {
std::vector<std::string> new_command_array =
CMDLineAssembly::wrap_cmdstring_in_shell(result);
new_command_array = this->term_assembler(
new_command_array, this->terminal, info.app->name);
result = CMDLineAssembly::convert_argv_to_string(
new_command_array);
}
} else {
if (info.app->terminal) {
std::vector<std::string> new_command_array =
this->term_assembler(command_array, this->terminal,
info.app->name);
result = CMDLineAssembly::convert_argv_to_string(
new_command_array);
} else
result =
CMDLineAssembly::convert_argv_to_string(command_array);
}
}
// wrapper and i3 mode are mutally exclusive, no need to handle it here.
Expand Down

0 comments on commit 2880efa

Please sign in to comment.