Fix IPC window tree processing.

This commit is contained in:
Alexandr Bogomyakov
2020-08-21 15:42:58 +10:00
parent ebd4e8fd31
commit ab127dc580
3 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: Alexandr Bogomyakov (ultradesu) <ab@hexor.ru>
pkgname=swkb
pkgver=0.2.3
pkgver=0.2.4
pkgrel=1
pkgdesc="swkb"
url="https://github.com/house-of-vanity/swkb.git"

View File

@ -1,6 +1,6 @@
[package]
name = "swkb"
version = "0.2.3"
version = "0.2.4"
authors = ["Alexandr Bogomyakov <abogomyakov@iponweb.net>"]
edition = "2018"

View File

@ -21,7 +21,12 @@ async fn get_input_id() -> Vec<String> {
async fn get_focus_id() -> i64 {
let mut connection = Connection::new().await.unwrap();
let tree = connection.get_tree().await.unwrap();
let tree = match connection.get_tree().await {
Ok(tree) => tree,
Err(_) => {
return 0;
}
};
let mut focused: i64 = 0;
for i in tree.nodes {
for z in i.nodes {
@ -52,7 +57,7 @@ async fn main() -> Fallible<()> {
while let Some(event) = events.next().await {
match event {
Ok(Event::Input(event)) => {
println!("Input: {:?}", event);
//println!("Input: {:?}", event);
let layouts_list = event.input.xkb_layout_names;
let layout_name = event.input.xkb_active_layout_name.unwrap_or("none".to_string());
if layout_name == "none" {
@ -65,7 +70,7 @@ async fn main() -> Fallible<()> {
layouts.insert(current_window, index);
}
Ok(Event::Window(event)) => {
println!("Window: {:?}", event);
//println!("Window: {:?}", event);
match event.change {
swayipc::reply::WindowChange::Focus => {
let layouts = layouts.lock().unwrap();