|
|
@ -71,6 +71,8 @@ pub enum SwayrCommand { |
|
|
|
SwitchWindow, |
|
|
|
SwitchWindow, |
|
|
|
/// Switch to the selected workspace.
|
|
|
|
/// Switch to the selected workspace.
|
|
|
|
SwitchWorkspace, |
|
|
|
SwitchWorkspace, |
|
|
|
|
|
|
|
/// Switch to the selected workspace.
|
|
|
|
|
|
|
|
SwitchOutput, |
|
|
|
/// Switch to the selected workspace or focus the selected window.
|
|
|
|
/// Switch to the selected workspace or focus the selected window.
|
|
|
|
SwitchWorkspaceOrWindow, |
|
|
|
SwitchWorkspaceOrWindow, |
|
|
|
/// Switch to the selected workspace or focus the selected container, or
|
|
|
|
/// Switch to the selected workspace or focus the selected container, or
|
|
|
@ -241,6 +243,7 @@ pub fn exec_swayr_cmd(args: ExecSwayrCmdArgs) { |
|
|
|
SwayrCommand::SwitchWorkspace => { |
|
|
|
SwayrCommand::SwitchWorkspace => { |
|
|
|
switch_workspace(&*props.read().unwrap()) |
|
|
|
switch_workspace(&*props.read().unwrap()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SwayrCommand::SwitchOutput => switch_output(&*props.read().unwrap()), |
|
|
|
SwayrCommand::SwitchWorkspaceOrWindow => { |
|
|
|
SwayrCommand::SwitchWorkspaceOrWindow => { |
|
|
|
switch_workspace_or_window(&*props.read().unwrap()) |
|
|
|
switch_workspace_or_window(&*props.read().unwrap()) |
|
|
|
} |
|
|
|
} |
|
|
@ -370,6 +373,7 @@ pub fn exec_swayr_cmd(args: ExecSwayrCmdArgs) { |
|
|
|
SwayrCommand::QuitWorkspaceOrWindow, |
|
|
|
SwayrCommand::QuitWorkspaceOrWindow, |
|
|
|
SwayrCommand::SwitchWindow, |
|
|
|
SwayrCommand::SwitchWindow, |
|
|
|
SwayrCommand::SwitchWorkspace, |
|
|
|
SwayrCommand::SwitchWorkspace, |
|
|
|
|
|
|
|
SwayrCommand::SwitchOutput, |
|
|
|
SwayrCommand::SwitchWorkspaceOrWindow, |
|
|
|
SwayrCommand::SwitchWorkspaceOrWindow, |
|
|
|
SwayrCommand::SwitchToUrgentOrLRUWindow, |
|
|
|
SwayrCommand::SwitchToUrgentOrLRUWindow, |
|
|
|
SwayrCommand::ConfigureOutputs, |
|
|
|
SwayrCommand::ConfigureOutputs, |
|
|
@ -515,6 +519,11 @@ fn handle_non_matching_input(input: &str) { |
|
|
|
fn select_and_focus(prompt: &str, choices: &[t::DisplayNode]) { |
|
|
|
fn select_and_focus(prompt: &str, choices: &[t::DisplayNode]) { |
|
|
|
match util::select_from_menu(prompt, choices) { |
|
|
|
match util::select_from_menu(prompt, choices) { |
|
|
|
Ok(tn) => match tn.node.get_type() { |
|
|
|
Ok(tn) => match tn.node.get_type() { |
|
|
|
|
|
|
|
t::Type::Output => { |
|
|
|
|
|
|
|
if !tn.node.is_scratchpad() { |
|
|
|
|
|
|
|
run_sway_command(&["focus output", tn.node.get_name()]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
t::Type::Workspace => { |
|
|
|
t::Type::Workspace => { |
|
|
|
if !tn.node.is_scratchpad() { |
|
|
|
if !tn.node.is_scratchpad() { |
|
|
|
run_sway_command(&["workspace", tn.node.get_name()]); |
|
|
|
run_sway_command(&["workspace", tn.node.get_name()]); |
|
|
@ -545,6 +554,12 @@ pub fn switch_workspace(extra_props: &HashMap<i64, t::ExtraProps>) { |
|
|
|
select_and_focus("Select workspace", &tree.get_workspaces()); |
|
|
|
select_and_focus("Select workspace", &tree.get_workspaces()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn switch_output(extra_props: &HashMap<i64, t::ExtraProps>) { |
|
|
|
|
|
|
|
let root = get_tree(false); |
|
|
|
|
|
|
|
let tree = t::get_tree(&root, extra_props); |
|
|
|
|
|
|
|
select_and_focus("Select output", &tree.get_outputs()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pub fn switch_workspace_or_window(extra_props: &HashMap<i64, t::ExtraProps>) { |
|
|
|
pub fn switch_workspace_or_window(extra_props: &HashMap<i64, t::ExtraProps>) { |
|
|
|
let root = get_tree(true); |
|
|
|
let root = get_tree(true); |
|
|
|
let tree = t::get_tree(&root, extra_props); |
|
|
|
let tree = t::get_tree(&root, extra_props); |
|
|
|