Skip to content

Commit

Permalink
🚧 pages: refactor kwin debug window into helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
vnepogodin committed Aug 6, 2024
1 parent 596b69b commit b3fc1ae
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ fn get_nm_connections() -> Vec<String> {
connections.split('\n').filter(|x| !x.is_empty()).map(String::from).collect::<Vec<_>>()
}

fn launch_kwin_debug_window() {
let _ = Exec::cmd("qdbus6")
.args(&["org.kde.KWin", "/KWin", "org.kde.KWin.showDebugConsole"])
.join()
.unwrap();
}

fn create_fixes_section(builder: &Builder) -> gtk::Box {
let topbox = gtk::Box::new(gtk::Orientation::Vertical, 2);
let button_box_f = gtk::Box::new(gtk::Orientation::Horizontal, 10);
Expand Down Expand Up @@ -448,10 +455,8 @@ fn create_fixes_section(builder: &Builder) -> gtk::Box {
kwinw_debug_btn.connect_clicked(move |_| {
// Spawn child process in separate thread.
std::thread::spawn(move || {
let _ = Exec::cmd("qdbus6")
.args(&["org.kde.KWin", "/KWin", "org.kde.KWin.showDebugConsole"])
.join()
.unwrap();
// do we even need to start that in separate thread. should be fine without
launch_kwin_debug_window();
});
});
button_box_frth.pack_end(&kwinw_debug_btn, true, true, 2);
Expand Down

0 comments on commit b3fc1ae

Please sign in to comment.