mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-23 18:01:12 +01:00
feat(wm): add monitor index preference cmd
This commit adds a new komorebic command, monitor-index-preference, which allows the user to set the index preference within the VecDeque of monitors based on the "size" of a display. This works as the size Rect identifies a unique display on the greater virtual screen and persists across display connections and disconnections unless the user deliberately changes the positioning of the display monitor on the virtual screen. When a new monitor is added to the state, the monitor preferences will be checked, and if a preference exists, the new monitor will be inserted at that index, otherwise, it will be pushed to the back of the VecDeque. resolve #275
This commit is contained in:
@@ -279,6 +279,20 @@ struct WorkAreaOffset {
|
||||
bottom: i32,
|
||||
}
|
||||
|
||||
#[derive(Parser, AhkFunction)]
|
||||
struct MonitorIndexPreference {
|
||||
/// Preferred monitor index (zero-indexed)
|
||||
index_preference: usize,
|
||||
/// Left value of the monitor's size Rect
|
||||
left: i32,
|
||||
/// Top value of the monitor's size Rect
|
||||
top: i32,
|
||||
/// Right value of the monitor's size Rect
|
||||
right: i32,
|
||||
/// Bottom value of the monitor's size Rect
|
||||
bottom: i32,
|
||||
}
|
||||
|
||||
#[derive(Parser, AhkFunction)]
|
||||
struct EnsureWorkspaces {
|
||||
/// Monitor index (zero-indexed)
|
||||
@@ -606,6 +620,9 @@ enum SubCommand {
|
||||
PromoteFocus,
|
||||
/// Force the retiling of all managed windows
|
||||
Retile,
|
||||
/// Set the monitor index preference for a monitor identified using its size
|
||||
#[clap(arg_required_else_help = true)]
|
||||
MonitorIndexPreference(MonitorIndexPreference),
|
||||
/// Create at least this many workspaces for the specified monitor
|
||||
#[clap(arg_required_else_help = true)]
|
||||
EnsureWorkspaces(EnsureWorkspaces),
|
||||
@@ -1108,6 +1125,18 @@ fn main() -> Result<()> {
|
||||
.as_bytes()?,
|
||||
)?;
|
||||
}
|
||||
SubCommand::MonitorIndexPreference(arg) => {
|
||||
send_message(
|
||||
&SocketMessage::MonitorIndexPreference(
|
||||
arg.index_preference,
|
||||
arg.left,
|
||||
arg.top,
|
||||
arg.right,
|
||||
arg.bottom,
|
||||
)
|
||||
.as_bytes()?,
|
||||
)?;
|
||||
}
|
||||
SubCommand::EnsureWorkspaces(workspaces) => {
|
||||
send_message(
|
||||
&SocketMessage::EnsureWorkspaces(workspaces.monitor, workspaces.workspace_count)
|
||||
|
||||
Reference in New Issue
Block a user