mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-27 15:07:02 +02:00
feat(wm): allow reapplying initial workspace rules
This commit adds the following new socket messages and commands: - `EnforceWorkspaceRules`: resets the `already_moved_window_handles` and calls `enforce_workspace_rules` so that all workspace rules, including initial workspace rules are applied again - `enforce-workspace-rules`: cli command which sends the EnforceWorkspaceRules socket message
This commit is contained in:
@@ -185,6 +185,7 @@ pub enum SocketMessage {
|
|||||||
ClearWorkspaceRules(usize, usize),
|
ClearWorkspaceRules(usize, usize),
|
||||||
ClearNamedWorkspaceRules(String),
|
ClearNamedWorkspaceRules(String),
|
||||||
ClearAllWorkspaceRules,
|
ClearAllWorkspaceRules,
|
||||||
|
EnforceWorkspaceRules,
|
||||||
#[serde(alias = "FloatRule")]
|
#[serde(alias = "FloatRule")]
|
||||||
IgnoreRule(ApplicationIdentifier, String),
|
IgnoreRule(ApplicationIdentifier, String),
|
||||||
ManageRule(ApplicationIdentifier, String),
|
ManageRule(ApplicationIdentifier, String),
|
||||||
|
|||||||
@@ -396,6 +396,13 @@ impl WindowManager {
|
|||||||
let mut workspace_rules = WORKSPACE_MATCHING_RULES.lock();
|
let mut workspace_rules = WORKSPACE_MATCHING_RULES.lock();
|
||||||
workspace_rules.clear();
|
workspace_rules.clear();
|
||||||
}
|
}
|
||||||
|
SocketMessage::EnforceWorkspaceRules => {
|
||||||
|
{
|
||||||
|
let mut already_moved = self.already_moved_window_handles.lock();
|
||||||
|
already_moved.clear();
|
||||||
|
}
|
||||||
|
self.enforce_workspace_rules()?;
|
||||||
|
}
|
||||||
SocketMessage::ManageRule(identifier, ref id) => {
|
SocketMessage::ManageRule(identifier, ref id) => {
|
||||||
let mut manage_identifiers = MANAGE_IDENTIFIERS.lock();
|
let mut manage_identifiers = MANAGE_IDENTIFIERS.lock();
|
||||||
|
|
||||||
|
|||||||
@@ -1309,6 +1309,8 @@ enum SubCommand {
|
|||||||
ClearNamedWorkspaceRules(ClearNamedWorkspaceRules),
|
ClearNamedWorkspaceRules(ClearNamedWorkspaceRules),
|
||||||
/// Remove all application association rules for all workspaces
|
/// Remove all application association rules for all workspaces
|
||||||
ClearAllWorkspaceRules,
|
ClearAllWorkspaceRules,
|
||||||
|
/// Enforce all workspace rules, including initial workspace rules that have already been applied
|
||||||
|
EnforceWorkspaceRules,
|
||||||
/// Identify an application that sends EVENT_OBJECT_NAMECHANGE on launch
|
/// Identify an application that sends EVENT_OBJECT_NAMECHANGE on launch
|
||||||
#[clap(arg_required_else_help = true)]
|
#[clap(arg_required_else_help = true)]
|
||||||
IdentifyObjectNameChangeApplication(IdentifyObjectNameChangeApplication),
|
IdentifyObjectNameChangeApplication(IdentifyObjectNameChangeApplication),
|
||||||
@@ -2457,6 +2459,9 @@ if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue) {
|
|||||||
SubCommand::ClearAllWorkspaceRules => {
|
SubCommand::ClearAllWorkspaceRules => {
|
||||||
send_message(&SocketMessage::ClearAllWorkspaceRules)?;
|
send_message(&SocketMessage::ClearAllWorkspaceRules)?;
|
||||||
}
|
}
|
||||||
|
SubCommand::EnforceWorkspaceRules => {
|
||||||
|
send_message(&SocketMessage::EnforceWorkspaceRules)?;
|
||||||
|
}
|
||||||
SubCommand::Stack(arg) => {
|
SubCommand::Stack(arg) => {
|
||||||
send_message(&SocketMessage::StackWindow(arg.operation_direction))?;
|
send_message(&SocketMessage::StackWindow(arg.operation_direction))?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user