input: Add unbound shortcut to toggle sticky state
This commit is contained in:
parent
d2e394b957
commit
c50607afd5
3 changed files with 18 additions and 0 deletions
|
|
@ -182,6 +182,7 @@ pub enum Action {
|
|||
ToggleStacking,
|
||||
ToggleTiling,
|
||||
ToggleWindowFloating,
|
||||
ToggleSticky,
|
||||
SwapWindow,
|
||||
|
||||
Resizing(ResizeDirection),
|
||||
|
|
|
|||
|
|
@ -2134,6 +2134,10 @@ impl State {
|
|||
let workspace = self.common.shell.active_space_mut(&output);
|
||||
workspace.toggle_floating_window_focused(seat);
|
||||
}
|
||||
Action::ToggleSticky => {
|
||||
let seats = self.common.seats().cloned().collect::<Vec<_>>();
|
||||
self.common.shell.toggle_sticky_current(seats.iter(), seat);
|
||||
}
|
||||
Action::Spawn(command) => {
|
||||
let (token, data) = self
|
||||
.common
|
||||
|
|
|
|||
|
|
@ -2360,6 +2360,19 @@ impl Shell {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn toggle_sticky_current<'a>(
|
||||
&mut self,
|
||||
seats: impl Iterator<Item = &'a Seat<State>>,
|
||||
seat: &Seat<State>,
|
||||
) {
|
||||
let set = self.workspaces.sets.get_mut(&seat.active_output()).unwrap();
|
||||
let workspace = &mut set.workspaces[set.active];
|
||||
let maybe_window = workspace.focus_stack.get(seat).iter().next().cloned();
|
||||
if let Some(mapped) = maybe_window {
|
||||
self.toggle_sticky(seats, seat, &mapped);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn set_theme(&mut self, theme: cosmic::Theme) {
|
||||
self.theme = theme.clone();
|
||||
self.refresh();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue