|
|
@ -109,10 +109,15 @@ impl<'a> fmt::Display for Window<'a> { |
|
|
|
|
|
|
|
|
|
|
|
fn build_windows<'a>( |
|
|
|
fn build_windows<'a>( |
|
|
|
root: &'a r::Node, |
|
|
|
root: &'a r::Node, |
|
|
|
|
|
|
|
include_scratchpad_windows: bool, |
|
|
|
extra_props: Option<&HashMap<i64, ipc::ExtraProps>>, |
|
|
|
extra_props: Option<&HashMap<i64, ipc::ExtraProps>>, |
|
|
|
) -> Vec<Window<'a>> { |
|
|
|
) -> Vec<Window<'a>> { |
|
|
|
let mut v = vec![]; |
|
|
|
let mut v = vec![]; |
|
|
|
for workspace in root.workspaces() { |
|
|
|
for workspace in root.workspaces() { |
|
|
|
|
|
|
|
if !include_scratchpad_windows && workspace.is_scratchpad() { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for n in workspace.windows() { |
|
|
|
for n in workspace.windows() { |
|
|
|
v.push(Window { |
|
|
|
v.push(Window { |
|
|
|
node: &n, |
|
|
|
node: &n, |
|
|
@ -126,10 +131,15 @@ fn build_windows<'a>( |
|
|
|
|
|
|
|
|
|
|
|
fn build_workspaces<'a>( |
|
|
|
fn build_workspaces<'a>( |
|
|
|
root: &'a r::Node, |
|
|
|
root: &'a r::Node, |
|
|
|
|
|
|
|
include_scratchpad: bool, |
|
|
|
extra_props: Option<&HashMap<i64, ipc::ExtraProps>>, |
|
|
|
extra_props: Option<&HashMap<i64, ipc::ExtraProps>>, |
|
|
|
) -> Vec<Workspace<'a>> { |
|
|
|
) -> Vec<Workspace<'a>> { |
|
|
|
let mut v = vec![]; |
|
|
|
let mut v = vec![]; |
|
|
|
for workspace in root.workspaces() { |
|
|
|
for workspace in root.workspaces() { |
|
|
|
|
|
|
|
if !include_scratchpad && workspace.is_scratchpad() { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let mut wins: Vec<Window> = workspace |
|
|
|
let mut wins: Vec<Window> = workspace |
|
|
|
.windows() |
|
|
|
.windows() |
|
|
|
.iter() |
|
|
|
.iter() |
|
|
@ -154,10 +164,11 @@ fn build_workspaces<'a>( |
|
|
|
/// Gets all application windows of the tree.
|
|
|
|
/// Gets all application windows of the tree.
|
|
|
|
pub fn get_windows<'a>( |
|
|
|
pub fn get_windows<'a>( |
|
|
|
root: &'a r::Node, |
|
|
|
root: &'a r::Node, |
|
|
|
|
|
|
|
include_scratchpad_windows: bool, |
|
|
|
extra_props: Option<&HashMap<i64, ipc::ExtraProps>>, |
|
|
|
extra_props: Option<&HashMap<i64, ipc::ExtraProps>>, |
|
|
|
) -> Vec<Window<'a>> { |
|
|
|
) -> Vec<Window<'a>> { |
|
|
|
let extra_props_given = extra_props.is_some(); |
|
|
|
let extra_props_given = extra_props.is_some(); |
|
|
|
let mut wins = build_windows(root, extra_props); |
|
|
|
let mut wins = build_windows(root, include_scratchpad_windows, extra_props); |
|
|
|
if extra_props_given { |
|
|
|
if extra_props_given { |
|
|
|
wins.sort(); |
|
|
|
wins.sort(); |
|
|
|
} |
|
|
|
} |
|
|
@ -170,15 +181,8 @@ pub fn get_workspaces<'a>( |
|
|
|
include_scratchpad: bool, |
|
|
|
include_scratchpad: bool, |
|
|
|
extra_props: Option<&HashMap<i64, ipc::ExtraProps>>, |
|
|
|
extra_props: Option<&HashMap<i64, ipc::ExtraProps>>, |
|
|
|
) -> Vec<Workspace<'a>> { |
|
|
|
) -> Vec<Workspace<'a>> { |
|
|
|
let workspaces = build_workspaces(root, extra_props); |
|
|
|
let mut workspaces = |
|
|
|
let mut workspaces = if include_scratchpad { |
|
|
|
build_workspaces(root, include_scratchpad, extra_props); |
|
|
|
workspaces |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
workspaces |
|
|
|
|
|
|
|
.into_iter() |
|
|
|
|
|
|
|
.filter(|ws| !ws.is_scratchpad()) |
|
|
|
|
|
|
|
.collect() |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
workspaces.rotate_left(1); |
|
|
|
workspaces.rotate_left(1); |
|
|
|
workspaces |
|
|
|
workspaces |
|
|
|
} |
|
|
|
} |
|
|
@ -252,7 +256,7 @@ impl Workspace<'_> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn is_scratchpad(&self) -> bool { |
|
|
|
pub fn is_scratchpad(&self) -> bool { |
|
|
|
self.get_name().eq("__i3_scratch") |
|
|
|
self.node.is_scratchpad() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|