mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-07 05:25:21 +02:00
Merge branch 'LGUG2Z:master' into bar_widget_grouping
This commit is contained in:
@@ -49,6 +49,7 @@ pub enum SocketMessage {
|
|||||||
StackWindow(OperationDirection),
|
StackWindow(OperationDirection),
|
||||||
UnstackWindow,
|
UnstackWindow,
|
||||||
CycleStack(CycleDirection),
|
CycleStack(CycleDirection),
|
||||||
|
CycleStackIndex(CycleDirection),
|
||||||
FocusStackWindow(usize),
|
FocusStackWindow(usize),
|
||||||
StackAll,
|
StackAll,
|
||||||
UnstackAll,
|
UnstackAll,
|
||||||
|
|||||||
@@ -247,6 +247,10 @@ impl WindowManager {
|
|||||||
self.cycle_container_window_in_direction(direction)?;
|
self.cycle_container_window_in_direction(direction)?;
|
||||||
self.focused_window()?.focus(self.mouse_follows_focus)?;
|
self.focused_window()?.focus(self.mouse_follows_focus)?;
|
||||||
}
|
}
|
||||||
|
SocketMessage::CycleStackIndex(direction) => {
|
||||||
|
self.cycle_container_window_index_in_direction(direction)?;
|
||||||
|
self.focused_window()?.focus(self.mouse_follows_focus)?;
|
||||||
|
}
|
||||||
SocketMessage::FocusStackWindow(idx) => {
|
SocketMessage::FocusStackWindow(idx) => {
|
||||||
// In case you are using this command on a bar on a monitor
|
// In case you are using this command on a bar on a monitor
|
||||||
// different from the currently focused one, you'd want that
|
// different from the currently focused one, you'd want that
|
||||||
|
|||||||
@@ -2022,6 +2022,39 @@ impl WindowManager {
|
|||||||
self.update_focused_workspace(self.mouse_follows_focus, true)
|
self.update_focused_workspace(self.mouse_follows_focus, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
|
pub fn cycle_container_window_index_in_direction(
|
||||||
|
&mut self,
|
||||||
|
direction: CycleDirection,
|
||||||
|
) -> Result<()> {
|
||||||
|
self.handle_unmanaged_window_behaviour()?;
|
||||||
|
|
||||||
|
tracing::info!("cycling container window index");
|
||||||
|
|
||||||
|
let container =
|
||||||
|
if let Some(container) = self.focused_workspace_mut()?.monocle_container_mut() {
|
||||||
|
container
|
||||||
|
} else {
|
||||||
|
self.focused_container_mut()?
|
||||||
|
};
|
||||||
|
|
||||||
|
let len = NonZeroUsize::new(container.windows().len())
|
||||||
|
.ok_or_else(|| anyhow!("there must be at least one window in a container"))?;
|
||||||
|
|
||||||
|
if len.get() == 1 {
|
||||||
|
bail!("there is only one window in this container");
|
||||||
|
}
|
||||||
|
|
||||||
|
let current_idx = container.focused_window_idx();
|
||||||
|
let next_idx = direction.next_idx(current_idx, len);
|
||||||
|
container.windows_mut().swap(current_idx, next_idx);
|
||||||
|
|
||||||
|
container.focus_window(next_idx);
|
||||||
|
container.load_focused_window();
|
||||||
|
|
||||||
|
self.update_focused_workspace(self.mouse_follows_focus, true)
|
||||||
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub fn focus_container_window(&mut self, idx: usize) -> Result<()> {
|
pub fn focus_container_window(&mut self, idx: usize) -> Result<()> {
|
||||||
self.handle_unmanaged_window_behaviour()?;
|
self.handle_unmanaged_window_behaviour()?;
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ gen_enum_subcommand_args! {
|
|||||||
CycleMoveWorkspaceToMonitor: CycleDirection,
|
CycleMoveWorkspaceToMonitor: CycleDirection,
|
||||||
Stack: OperationDirection,
|
Stack: OperationDirection,
|
||||||
CycleStack: CycleDirection,
|
CycleStack: CycleDirection,
|
||||||
|
CycleStackIndex: CycleDirection,
|
||||||
FlipLayout: Axis,
|
FlipLayout: Axis,
|
||||||
ChangeLayout: DefaultLayout,
|
ChangeLayout: DefaultLayout,
|
||||||
CycleLayout: CycleDirection,
|
CycleLayout: CycleDirection,
|
||||||
@@ -985,6 +986,9 @@ enum SubCommand {
|
|||||||
/// Cycle the focused stack in the specified cycle direction
|
/// Cycle the focused stack in the specified cycle direction
|
||||||
#[clap(arg_required_else_help = true)]
|
#[clap(arg_required_else_help = true)]
|
||||||
CycleStack(CycleStack),
|
CycleStack(CycleStack),
|
||||||
|
/// Cycle the index of the focused window in the focused stack in the specified cycle direction
|
||||||
|
#[clap(arg_required_else_help = true)]
|
||||||
|
CycleStackIndex(CycleStackIndex),
|
||||||
/// Focus the specified window index in the focused stack
|
/// Focus the specified window index in the focused stack
|
||||||
#[clap(arg_required_else_help = true)]
|
#[clap(arg_required_else_help = true)]
|
||||||
FocusStackWindow(FocusStackWindow),
|
FocusStackWindow(FocusStackWindow),
|
||||||
@@ -2305,6 +2309,9 @@ Stop-Process -Name:komorebi -ErrorAction SilentlyContinue
|
|||||||
SubCommand::CycleStack(arg) => {
|
SubCommand::CycleStack(arg) => {
|
||||||
send_message(&SocketMessage::CycleStack(arg.cycle_direction))?;
|
send_message(&SocketMessage::CycleStack(arg.cycle_direction))?;
|
||||||
}
|
}
|
||||||
|
SubCommand::CycleStackIndex(arg) => {
|
||||||
|
send_message(&SocketMessage::CycleStackIndex(arg.cycle_direction))?;
|
||||||
|
}
|
||||||
SubCommand::ChangeLayout(arg) => {
|
SubCommand::ChangeLayout(arg) => {
|
||||||
send_message(&SocketMessage::ChangeLayout(arg.default_layout))?;
|
send_message(&SocketMessage::ChangeLayout(arg.default_layout))?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user