mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-20 07:41:25 +02:00
fix(ahk): quote app ids in generated code
Previously, generated AHK did not surround with quotes inputs which could contain spaces such as application titles. This commit ensures that in any generated AHK code where an application id is passed to a komorebic.exe command as input, that input will always be quoted. This fixes bugs related to float rules, manage rules and other application identification commands not being properly executed via komorebic called from the generated AHK files when the app id contained a space.
This commit is contained in:
@@ -27,24 +27,30 @@ impl ApplicationOptions {
|
|||||||
match self {
|
match self {
|
||||||
ApplicationOptions::ObjectNameChange => {
|
ApplicationOptions::ObjectNameChange => {
|
||||||
format!(
|
format!(
|
||||||
"komorebic.exe identify-object-name-change-application {} {}",
|
"komorebic.exe identify-object-name-change-application {} \"{}\"",
|
||||||
kind, id
|
kind, id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ApplicationOptions::Layered => {
|
ApplicationOptions::Layered => {
|
||||||
format!("komorebic.exe identify-layered-application {} {}", kind, id)
|
format!(
|
||||||
|
"komorebic.exe identify-layered-application {} \"{}\"",
|
||||||
|
kind, id
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ApplicationOptions::BorderOverflow => {
|
ApplicationOptions::BorderOverflow => {
|
||||||
format!(
|
format!(
|
||||||
"komorebic.exe identify-border-overflow-application {} {}",
|
"komorebic.exe identify-border-overflow-application {} \"{}\"",
|
||||||
kind, id
|
kind, id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ApplicationOptions::TrayAndMultiWindow => {
|
ApplicationOptions::TrayAndMultiWindow => {
|
||||||
format!("komorebic.exe identify-tray-application {} {}", kind, id)
|
format!(
|
||||||
|
"komorebic.exe identify-tray-application {} \"{}\"",
|
||||||
|
kind, id
|
||||||
|
)
|
||||||
}
|
}
|
||||||
ApplicationOptions::Force => {
|
ApplicationOptions::Force => {
|
||||||
format!("komorebic.exe manage-rule {} {}", kind, id)
|
format!("komorebic.exe manage-rule {} \"{}\"", kind, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -145,7 +151,7 @@ impl ApplicationConfigurationGenerator {
|
|||||||
if let Some(float_identifiers) = app.float_identifiers {
|
if let Some(float_identifiers) = app.float_identifiers {
|
||||||
for float in float_identifiers {
|
for float in float_identifiers {
|
||||||
let float_rule = format!(
|
let float_rule = format!(
|
||||||
"Run, komorebic.exe float-rule {} {}, , Hide",
|
"Run, komorebic.exe float-rule {} \"{}\", , Hide",
|
||||||
float.kind, float.id
|
float.kind, float.id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -257,31 +257,31 @@ WindowHidingBehaviour(hiding_behaviour) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FloatRule(identifier, id) {
|
FloatRule(identifier, id) {
|
||||||
Run, komorebic.exe float-rule %identifier% %id%, , Hide
|
Run, komorebic.exe float-rule %identifier% "%id%", , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
ManageRule(identifier, id) {
|
ManageRule(identifier, id) {
|
||||||
Run, komorebic.exe manage-rule %identifier% %id%, , Hide
|
Run, komorebic.exe manage-rule %identifier% "%id%", , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceRule(identifier, id, monitor, workspace) {
|
WorkspaceRule(identifier, id, monitor, workspace) {
|
||||||
Run, komorebic.exe workspace-rule %identifier% %id% %monitor% %workspace%, , Hide
|
Run, komorebic.exe workspace-rule %identifier% "%id%" %monitor% %workspace%, , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentifyObjectNameChangeApplication(identifier, id) {
|
IdentifyObjectNameChangeApplication(identifier, id) {
|
||||||
Run, komorebic.exe identify-object-name-change-application %identifier% %id%, , Hide
|
Run, komorebic.exe identify-object-name-change-application %identifier% "%id%", , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentifyTrayApplication(identifier, id) {
|
IdentifyTrayApplication(identifier, id) {
|
||||||
Run, komorebic.exe identify-tray-application %identifier% %id%, , Hide
|
Run, komorebic.exe identify-tray-application %identifier% "%id%", , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentifyLayeredApplication(identifier, id) {
|
IdentifyLayeredApplication(identifier, id) {
|
||||||
Run, komorebic.exe identify-layered-application %identifier% %id%, , Hide
|
Run, komorebic.exe identify-layered-application %identifier% "%id%", , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentifyBorderOverflowApplication(identifier, id) {
|
IdentifyBorderOverflowApplication(identifier, id) {
|
||||||
Run, komorebic.exe identify-border-overflow-application %identifier% %id%, , Hide
|
Run, komorebic.exe identify-border-overflow-application %identifier% "%id%", , Hide
|
||||||
}
|
}
|
||||||
|
|
||||||
FocusFollowsMouse(boolean_state, implementation) {
|
FocusFollowsMouse(boolean_state, implementation) {
|
||||||
|
|||||||
@@ -692,7 +692,10 @@ fn main() -> Result<()> {
|
|||||||
.truncate(true)
|
.truncate(true)
|
||||||
.open(library.clone())?;
|
.open(library.clone())?;
|
||||||
|
|
||||||
file.write_all(SubCommand::generate_ahk_library().as_bytes())?;
|
let output: String = SubCommand::generate_ahk_library();
|
||||||
|
let fixed_output = output.replace("%id%", "\"%id%\"");
|
||||||
|
|
||||||
|
file.write_all(fixed_output.as_bytes())?;
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"\nAHK helper library for komorebic written to {}",
|
"\nAHK helper library for komorebic written to {}",
|
||||||
|
|||||||
Reference in New Issue
Block a user