From ec540ecdb7d5ced278d33421590eca0e9a784aac Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Thu, 7 Mar 2024 16:47:05 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20pages:=20add=20debug=20window=20?= =?UTF-8?q?button=20for=20kwin-wayland?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/en/cachyos_hello.ftl | 1 + i18n/ru/cachyos_hello.ftl | 1 + src/pages.rs | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/i18n/en/cachyos_hello.ftl b/i18n/en/cachyos_hello.ftl index f1291b9..4babf86 100644 --- a/i18n/en/cachyos_hello.ftl +++ b/i18n/en/cachyos_hello.ftl @@ -45,6 +45,7 @@ remove-orphans-title = Remove orphans clear-pkgcache-title = Clear package cache rankmirrors-title = Rank mirrors dnsserver-title = Change DNS server +show-kwinw-debug-title = Show kwin(Wayland) debug window # Main Page (buttons) button-about-tooltip = About diff --git a/i18n/ru/cachyos_hello.ftl b/i18n/ru/cachyos_hello.ftl index c450a95..f353386 100644 --- a/i18n/ru/cachyos_hello.ftl +++ b/i18n/ru/cachyos_hello.ftl @@ -44,6 +44,7 @@ remove-orphans-title = Удалить orphans clear-pkgcache-title = Очистить кэш пакетов rankmirrors-title = Ранжировать зеркала dnsserver-title = Сменить DNS-сервер +show-kwinw-debug-title = Показать окно отладки kwin(Wayland) # Main Page (buttons) button-about-tooltip = О программе diff --git a/src/pages.rs b/src/pages.rs index 3595f2e..50cf6c5 100644 --- a/src/pages.rs +++ b/src/pages.rs @@ -320,6 +320,23 @@ fn create_fixes_section(builder: &Builder) -> gtk::Box { topbox.pack_end(&button_box_s, true, true, 5); topbox.pack_end(&button_box_f, true, true, 5); + if let Ok(pgrep_res) = Exec::cmd("pgrep").args(&["kwin_wayland"]).stdout(subprocess::NullFile).join() { + if pgrep_res.success() { + let kwinw_debug_btn = gtk::Button::with_label(&fl!("show-kwinw-debug-title")); + kwinw_debug_btn.set_widget_name("show-kwinw-debug-title"); + kwinw_debug_btn.connect_clicked(move |_| { + // Spawn child process in separate thread. + std::thread::spawn(move || { + let _ = Exec::cmd("qdbus") + .args(&["org.kde.KWin", "/KWin", "org.kde.KWin.showDebugConsole"]) + .join() + .unwrap(); + }); + }); + button_box_frth.pack_end(&kwinw_debug_btn, true, true, 2); + } + } + topbox.set_hexpand(true); topbox }