From 603d3165bb0b9b3fe6fcdb0ca1afc613b5387274 Mon Sep 17 00:00:00 2001 From: blankie Date: Thu, 23 Feb 2023 16:12:46 +0700 Subject: [PATCH] Add opening settings and logs with keyboard shortcuts --- windows/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/windows/main.cpp b/windows/main.cpp index 098d9f9..1530119 100644 --- a/windows/main.cpp +++ b/windows/main.cpp @@ -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; }