Add opening settings and logs with keyboard shortcuts

This commit is contained in:
blankie 2023-02-23 16:12:46 +07:00
parent 17f8016d3d
commit 603d3165bb
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 4 additions and 2 deletions

View File

@ -120,7 +120,8 @@ void main_window(bool latest_log_entries_read, ImFont* monospace_font, LogcatThr
return;
}
if (ImGui::Button("Settings") && !*show_settings_window) {
bool ctrl_comma_pressed = ImGui::IsKeyPressed(ImGuiMod_Shortcut | ImGuiKey_Comma);
if ((ImGui::Button("Settings") || ctrl_comma_pressed) && !*show_settings_window) {
inactive_config.logcat_command = active_config.logcat_command;
inactive_config.normal_font_size = active_config.normal_font_size;
inactive_config.monospace_font_size = active_config.monospace_font_size;
@ -129,8 +130,9 @@ void main_window(bool latest_log_entries_read, ImFont* monospace_font, LogcatThr
*show_settings_window = true;
}
ImGui::SameLine();
bool ctrl_l_pressed = ImGui::IsKeyPressed(ImGuiMod_Shortcut | ImGuiKey_L);
bool open_logs = latest_log_entries_read ? ImGui::Button("Logs") : ImGui::RedButton("Logs");
if (open_logs) {
if (open_logs || ctrl_l_pressed) {
*show_logs_window = true;
}