From 2912c21755ceaa59670fc8558a9e6b7cc24a48b3 Mon Sep 17 00:00:00 2001 From: IG Date: Tue, 27 Jun 2023 09:52:14 +0100 Subject: [PATCH] more useless ui removal --- .github/workflows/build.yml | 2 +- bt/app/browser.cpp | 16 ----------- bt/app/browser.h | 3 -- bt/app/config_window.cpp | 55 +++++++++---------------------------- bt/app/dash_window.cpp | 2 +- local-build.ps1 | 5 ++++ log.json | 10 +++++++ 7 files changed, 30 insertions(+), 63 deletions(-) create mode 100644 local-build.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b276291..b26f289 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: 'Build' env: - VERSION: 3.1.4 + VERSION: 3.1.5 BUILD_TYPE: Release ARCH: x64 VCPKG_DEFAULT_VCPKG_TRIPLET: x64-windows-static diff --git a/bt/app/browser.cpp b/bt/app/browser.cpp index 3969ae7..3666ae9 100644 --- a/bt/app/browser.cpp +++ b/bt/app/browser.cpp @@ -6,7 +6,6 @@ #include #include #include "win32/shell.h" -#include "win32/process.h" #include "str.h" #include "../globals.h" #include @@ -160,21 +159,6 @@ namespace bt { return b1.id == b2.id; } - std::vector browser::get_system_processes() { - vector r; - for(auto& p : win32::process::enumerate()) { - if(p.get_module_filename() != open_cmd) continue; - r.push_back(p); - } - return r; - } - - bool browser::is_running() { - auto all_procs = win32::process::enumerate(); - return std::any_of(all_procs.begin(), all_procs.end(), - [this](const win32::process& p) { return p.get_module_filename() == open_cmd; }); - } - std::vector> browser::get_cache(bool reload) { if(reload || cache.empty()) cache = config::i.load_browsers(); diff --git a/bt/app/browser.h b/bt/app/browser.h index da7dc85..b9f7f47 100644 --- a/bt/app/browser.h +++ b/bt/app/browser.h @@ -66,9 +66,6 @@ namespace bt { std::string vdf; // vendor data folder //std::vector chrome_profiles; - std::vector get_system_processes(); - bool is_running(); - friend bool operator==(const browser& b1, const browser& b2); // ---- static members diff --git a/bt/app/config_window.cpp b/bt/app/config_window.cpp index 8e86ca2..6732e67 100644 --- a/bt/app/config_window.cpp +++ b/bt/app/config_window.cpp @@ -107,6 +107,11 @@ namespace bt w_dash->is_visible = true; check_health(); }; + st_health->on_hovered = [this](component&, bool is_hovered) { + if(is_hovered) { + check_health(); + } + }; status->make_label("|")->is_enabled = false; auto coffee = status->make_label(ICON_FA_MUG_HOT); @@ -223,7 +228,7 @@ namespace bt }; g_static->same_line(); - auto pf = g_static->make_button(ICON_FA_FOLDER_OPEN " profile"); + auto pf = g_static->make_button(ICON_FA_FOLDER_TREE " profile"); pf->tooltip = "open profile folder in Explorer."; profiles_tabs->on_tab_changed = [pf, b](size_t idx) { auto profile = b->instances[idx]; @@ -237,43 +242,20 @@ namespace bt if(b->is_firefox) { g_static->same_line(); - auto pmgr = g_static->make_button(ICON_FA_LIST); + auto pmgr = g_static->make_button(ICON_FA_ADDRESS_CARD); pmgr->tooltip = "open Firefox Profile Manager (-P flag)"; pmgr->on_pressed = [b](button&) { win32::shell::exec(b->open_cmd, "-P"); }; g_static->same_line(); - pmgr = g_static->make_button(ICON_FA_LIST); + pmgr = g_static->make_button(ICON_FA_ID_CARD); pmgr->tooltip = "open Firefox Profile Manager in Firefox itself"; pmgr->on_pressed = [b](button&) { win32::shell::exec(b->open_cmd, "about:profiles"); }; } } - - browser_toolbar->same_line(); - auto g_sys_on = browser_toolbar->make_group(); - { - auto cmd_kill = g_sys_on->make_button(ICON_FA_GAVEL); - cmd_kill->tooltip = "kill all browser processes"; - cmd_kill->on_pressed = [b](button&) { - for(auto& p : b->get_system_processes()) { - p.terminate(); - } - }; - } - - g_sys_on->is_visible = false; - g_sys_on->on_frame = [b, g_sys_on](component&) { - g_sys_on->tag_float += ImGui::GetIO().DeltaTime; - if(g_sys_on->tag_float >= 0.5) { - bool is_running = b->is_running(); - g_sys_on->is_visible = is_running; - g_sys_on->tag_float = 0; - } - }; - g_sys_on->tag_float = 100; } else { browser_toolbar->same_line(); auto cmd_rm = browser_toolbar->make_button( @@ -491,21 +473,6 @@ special keyword - %url% which is replaced by opening url.)"; c->set_pos(left_pad, 0, true); c->make_label(b->name); - // running indicator - c->same_line(); - c->set_pos(370 * scale, -1, false); - auto lbl_on_off = c->make_label(ICON_FA_CIRCLE); - lbl_on_off->on_frame = [b, lbl_on_off](component&) { - lbl_on_off->tag_float += ImGui::GetIO().DeltaTime; - if(lbl_on_off->tag_float >= 2) { - bool is_running = b->is_running(); - lbl_on_off->set_emphasis(is_running ? emphasis::primary : emphasis::error); - lbl_on_off->tooltip = is_running ? "running" : "not running"; - lbl_on_off->tag_float = 0; - } - }; - lbl_on_off->tag_float = 100; - c->set_pos(left_pad, 0, true); if(b->instances.size() > 0) { @@ -750,7 +717,11 @@ special keyword - %url% which is replaced by opening url.)"; bool healthy = w_dash->recheck(); - if(!healthy) w_dash->is_visible = true; + if(!healthy) { + w_dash->is_visible = true; + w_dash->center(); + w_dash->bring_to_top(); + } st_health->set_emphasis(healthy ? emphasis::primary : emphasis::error); st_health->tooltip = healthy ? "good health" diff --git a/bt/app/dash_window.cpp b/bt/app/dash_window.cpp index 44c5935..2eaa154 100644 --- a/bt/app/dash_window.cpp +++ b/bt/app/dash_window.cpp @@ -20,7 +20,7 @@ namespace bt { sc.recheck(); auto g = make_group(); - auto sign = g->make_label(sc.is_ok ? ICON_FA_CHECK : ICON_FA_DELETE_LEFT); + auto sign = g->make_label(sc.is_ok ? ICON_FA_HEART_CIRCLE_CHECK : ICON_FA_HEART_CIRCLE_XMARK); sign->set_emphasis(sc.is_ok ? grey::emphasis::primary : grey::emphasis::error); g->same_line(); diff --git a/local-build.ps1 b/local-build.ps1 new file mode 100644 index 0000000..765ca92 --- /dev/null +++ b/local-build.ps1 @@ -0,0 +1,5 @@ +cmake -B build -S . -D "CMAKE_BUILD_TYPE=Release" ` + -D "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" ` + -D "VCPKG_TARGET_TRIPLET=x64-windows-static" + +cmake --build build --config Release \ No newline at end of file diff --git a/log.json b/log.json index 6805775..a0f3fd5 100644 --- a/log.json +++ b/log.json @@ -1,4 +1,14 @@ [ + { + "version": "3.1.5", + "date": "2023-06-27", + "changes": { + "improvements": [ + "BT does not check if browser process is running anymore, to avoid listing system processes which AVs don't like.", + "Some UI icons updated" + ] + } + }, { "version": "3.1.4", "date": "2023-06-27",