Added per application bindings for Niri compositor
This commit is contained in:
parent
68be39056e
commit
dfd1e88543
2 changed files with 23 additions and 1 deletions
|
@ -55,6 +55,28 @@ pub async fn get_active_window(environment: &Environment, config: &Vec<Config>)
|
||||||
Client::Default
|
Client::Default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"niri" => {
|
||||||
|
let query = Command::new("niri")
|
||||||
|
.args(["msg", "-j", "focused-window"])
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
if let Ok(reply) = serde_json::from_str::<serde_json::Value>(
|
||||||
|
std::str::from_utf8(query.stdout.as_slice()).unwrap(),
|
||||||
|
) {
|
||||||
|
let active_window =
|
||||||
|
Client::Class(reply["app_id"].to_string().replace("\"", ""));
|
||||||
|
if let Some(_) = config
|
||||||
|
.iter()
|
||||||
|
.find(|&x| x.associations.client == active_window)
|
||||||
|
{
|
||||||
|
active_window
|
||||||
|
} else {
|
||||||
|
Client::Default
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Client::Default
|
||||||
|
}
|
||||||
|
}
|
||||||
"KDE" => {
|
"KDE" => {
|
||||||
let (user, running_as_root) =
|
let (user, running_as_root) =
|
||||||
if let Ok(sudo_user) = environment.sudo_user.clone() {
|
if let Ok(sudo_user) = environment.sudo_user.clone() {
|
||||||
|
|
|
@ -184,7 +184,7 @@ fn set_environment() -> Environment {
|
||||||
env::set_var("XDG_SESSION_TYPE", "wayland")
|
env::set_var("XDG_SESSION_TYPE", "wayland")
|
||||||
}
|
}
|
||||||
|
|
||||||
let supported_compositors = vec!["Hyprland", "sway", "KDE"]
|
let supported_compositors = vec!["Hyprland", "sway", "KDE", "niri"]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|str| String::from(str))
|
.map(|str| String::from(str))
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
|
|
Loading…
Add table
Reference in a new issue