You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

4 years ago
use crate::con;
use crate::util;
pub fn switch_window() {
let root = con::get_tree();
let mut windows = con::get_windows(&root);
windows.sort();
4 years ago
if let Some(window) = con::select_window("Switch to window", &windows) {
util::swaymsg(vec![
format!("[con_id={}]", window.get_id()).as_str(),
"focus",
]);
}
}
pub fn switch_workspace() {
let root = con::get_tree();
let mut workspaces = con::get_workspaces(&root, false);
workspaces.sort();
if let Some(workspace) =
con::select_workspace("Switch to workspace", &workspaces)
{
util::swaymsg(vec!["workspace", "number", workspace.get_name()]);
}
}
pub fn quit_window() {
let root = con::get_tree();
let mut windows = con::get_windows(&root);
windows.sort_by(|a, b| a.cmp(b).reverse());
4 years ago
if let Some(window) = con::select_window("Quit window", &windows) {
util::swaymsg(vec![
format!("[con_id={}]", window.get_id()).as_str(),
"kill",
]);
}
}