input: Add SendToWorkspace action
This commit is contained in:
parent
40077f4a5a
commit
5b644b59f7
3 changed files with 29 additions and 11 deletions
|
|
@ -851,6 +851,10 @@ pub enum Action {
|
||||||
MoveToNextWorkspace,
|
MoveToNextWorkspace,
|
||||||
MoveToPreviousWorkspace,
|
MoveToPreviousWorkspace,
|
||||||
MoveToLastWorkspace,
|
MoveToLastWorkspace,
|
||||||
|
SendToWorkspace(u8),
|
||||||
|
SendToNextWorkspace,
|
||||||
|
SendToPreviousWorkspace,
|
||||||
|
SendToLastWorkspace,
|
||||||
|
|
||||||
NextOutput,
|
NextOutput,
|
||||||
PreviousOutput,
|
PreviousOutput,
|
||||||
|
|
|
||||||
|
|
@ -617,20 +617,23 @@ impl State {
|
||||||
.saturating_sub(1);
|
.saturating_sub(1);
|
||||||
let _ = self.common.shell.activate(¤t_output, workspace);
|
let _ = self.common.shell.activate(¤t_output, workspace);
|
||||||
}
|
}
|
||||||
Action::MoveToWorkspace(key_num) => {
|
x @ Action::MoveToWorkspace(_) | x @ Action::SendToWorkspace(_) => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let workspace = match key_num {
|
let follow = matches!(x, Action::MoveToWorkspace(_));
|
||||||
0 => 9,
|
let workspace = match x {
|
||||||
x => x - 1,
|
Action::MoveToWorkspace(0) | Action::SendToWorkspace(0) => 9,
|
||||||
|
Action::MoveToWorkspace(x) | Action::SendToWorkspace(x) => x - 1,
|
||||||
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
Shell::move_current_window(
|
Shell::move_current_window(
|
||||||
self,
|
self,
|
||||||
seat,
|
seat,
|
||||||
¤t_output,
|
¤t_output,
|
||||||
(¤t_output, Some(workspace as usize)),
|
(¤t_output, Some(workspace as usize)),
|
||||||
|
follow,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Action::MoveToNextWorkspace => {
|
x @ Action::MoveToNextWorkspace | x @ Action::SendToNextWorkspace => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let workspace = self
|
let workspace = self
|
||||||
.common
|
.common
|
||||||
|
|
@ -644,9 +647,10 @@ impl State {
|
||||||
seat,
|
seat,
|
||||||
¤t_output,
|
¤t_output,
|
||||||
(¤t_output, Some(workspace as usize)),
|
(¤t_output, Some(workspace as usize)),
|
||||||
|
matches!(x, Action::MoveToNextWorkspace),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Action::MoveToPreviousWorkspace => {
|
x @ Action::MoveToPreviousWorkspace | x @ Action::SendToPreviousWorkspace => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let workspace = self
|
let workspace = self
|
||||||
.common
|
.common
|
||||||
|
|
@ -660,9 +664,10 @@ impl State {
|
||||||
seat,
|
seat,
|
||||||
¤t_output,
|
¤t_output,
|
||||||
(¤t_output, Some(workspace as usize)),
|
(¤t_output, Some(workspace as usize)),
|
||||||
|
matches!(x, Action::MoveToPreviousWorkspace),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Action::MoveToLastWorkspace => {
|
x @ Action::MoveToLastWorkspace | x @ Action::SendToLastWorkspace => {
|
||||||
let current_output = seat.active_output();
|
let current_output = seat.active_output();
|
||||||
let workspace = self
|
let workspace = self
|
||||||
.common
|
.common
|
||||||
|
|
@ -675,6 +680,7 @@ impl State {
|
||||||
seat,
|
seat,
|
||||||
¤t_output,
|
¤t_output,
|
||||||
(¤t_output, Some(workspace as usize)),
|
(¤t_output, Some(workspace as usize)),
|
||||||
|
matches!(x, Action::MoveToLastWorkspace),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Action::NextOutput => {
|
Action::NextOutput => {
|
||||||
|
|
@ -753,6 +759,7 @@ impl State {
|
||||||
seat,
|
seat,
|
||||||
¤t_output,
|
¤t_output,
|
||||||
(&next_output, None),
|
(&next_output, None),
|
||||||
|
true,
|
||||||
) {
|
) {
|
||||||
if let Some(ptr) = seat.get_pointer() {
|
if let Some(ptr) = seat.get_pointer() {
|
||||||
ptr.motion(
|
ptr.motion(
|
||||||
|
|
@ -786,6 +793,7 @@ impl State {
|
||||||
seat,
|
seat,
|
||||||
¤t_output,
|
¤t_output,
|
||||||
(&prev_output, None),
|
(&prev_output, None),
|
||||||
|
true,
|
||||||
) {
|
) {
|
||||||
if let Some(ptr) = seat.get_pointer() {
|
if let Some(ptr) = seat.get_pointer() {
|
||||||
ptr.motion(
|
ptr.motion(
|
||||||
|
|
|
||||||
|
|
@ -1120,6 +1120,7 @@ impl Shell {
|
||||||
seat: &Seat<State>,
|
seat: &Seat<State>,
|
||||||
from_output: &Output,
|
from_output: &Output,
|
||||||
to: (&Output, Option<usize>),
|
to: (&Output, Option<usize>),
|
||||||
|
follow: bool,
|
||||||
) -> Option<Point<i32, Logical>> {
|
) -> Option<Point<i32, Logical>> {
|
||||||
let (to_output, to_idx) = to;
|
let (to_output, to_idx) = to;
|
||||||
let to_idx = to_idx.unwrap_or(state.common.shell.workspaces.active_num(to_output));
|
let to_idx = to_idx.unwrap_or(state.common.shell.workspaces.active_num(to_output));
|
||||||
|
|
@ -1157,9 +1158,12 @@ impl Shell {
|
||||||
for mapped in elements.into_iter() {
|
for mapped in elements.into_iter() {
|
||||||
state.common.shell.update_reactive_popups(&mapped);
|
state.common.shell.update_reactive_popups(&mapped);
|
||||||
}
|
}
|
||||||
|
let new_pos = if follow {
|
||||||
seat.set_active_output(&to_output);
|
seat.set_active_output(&to_output);
|
||||||
let new_pos = state.common.shell.activate(to_output, to_idx);
|
state.common.shell.activate(to_output, to_idx)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let to_workspace = state
|
let to_workspace = state
|
||||||
.common
|
.common
|
||||||
|
|
@ -1191,7 +1195,9 @@ impl Shell {
|
||||||
state.common.shell.update_reactive_popups(&mapped);
|
state.common.shell.update_reactive_popups(&mapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::set_focus(state, Some(&KeyboardFocusTarget::from(mapped)), &seat, None);
|
if follow {
|
||||||
|
Common::set_focus(state, Some(&KeyboardFocusTarget::from(mapped)), &seat, None);
|
||||||
|
}
|
||||||
new_pos
|
new_pos
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue