Actually use default logcat command

This commit is contained in:
blankie 2023-02-03 15:15:54 +07:00
parent 1c44b770a8
commit a6a53eb98a
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
3 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,8 @@
#include <nlohmann/json.hpp>
#include "filters.h"
const constexpr char* default_logcat_command = "adb logcat -Dv 'threadtime epoch UTC uid'";
struct Config {
std::string logcat_command;
float normal_font_size = 13.0f;

View File

@ -8,6 +8,7 @@
#include "log.h"
#include "misc.h"
#include "config.h"
#include "logcat_thread.h"
#include "logcat_entry.h"
@ -320,6 +321,10 @@ bool LogcatThread::_handle_start_request() {
}
};
std::string logcat_command = !this->_logcat_command->empty()
? *this->_logcat_command
: default_logcat_command;
this->_logcat_pid = fork();
if (this->_logcat_pid == -1) {
try {
@ -337,7 +342,7 @@ bool LogcatThread::_handle_start_request() {
close_or_warn(this->_stderr_write_fd);
close_or_warn(this->_stdout_read_fd);
close_or_warn(this->_stderr_read_fd);
execlp("sh", "sh", "-c", this->_logcat_command->c_str(), nullptr);
execlp("sh", "sh", "-c", logcat_command.c_str(), nullptr);
try {
throw_system_error("execlp()");
} catch (const std::exception& e) {

View File

@ -18,7 +18,7 @@ void settings_window(Config& active_config, Config& inactive_config, bool* p_ope
return;
}
ImGui::TextUnformatted("Logcat command only takes effect when logcat is not running");
ImGui::InputTextWithHint("Logcat command", "adb logcat -Dv 'threadtime UTC epoch usec uid'", &inactive_config.logcat_command);
ImGui::InputTextWithHint("Logcat command", default_logcat_command, &inactive_config.logcat_command);
ImGui::Text("Font sizes only take effect when LogMeow is restarted");
#ifdef USE_FONTCONFIG