fix(ahk): prefer runwait for ahk lib wrappers

This commit ensures that the generated AHK library for komorebic uses
RunWait instead of Run, as the latter is asynchronous and can result in
an unexpected order of calls when used in a komorebi.ahk configuration
file.

re #269
This commit is contained in:
LGUG2Z
2022-10-21 15:24:29 -07:00
parent b25cc1c8bf
commit 1229c65580
2 changed files with 92 additions and 92 deletions

View File

@@ -129,7 +129,7 @@ pub fn ahk_function(input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStre
fn generate_ahk_function() -> String { fn generate_ahk_function() -> String {
::std::format!(r#" ::std::format!(r#"
{}({}) {{ {}({}) {{
Run, komorebic.exe {} {} {}, , Hide RunWait, komorebic.exe {} {} {}, , Hide
}}"#, }}"#,
::std::stringify!(#name), ::std::stringify!(#name),
#all_arguments, #all_arguments,
@@ -148,7 +148,7 @@ pub fn ahk_function(input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStre
fn generate_ahk_function() -> String { fn generate_ahk_function() -> String {
::std::format!(r#" ::std::format!(r#"
{}({}) {{ {}({}) {{
Run, komorebic.exe {} {}, , Hide RunWait, komorebic.exe {} {}, , Hide
}}"#, }}"#,
::std::stringify!(#name), ::std::stringify!(#name),
#arguments, #arguments,
@@ -194,7 +194,7 @@ pub fn ahk_library(input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStrea
stream.extend(quote! { stream.extend(quote! {
v.push(::std::format!(r#" v.push(::std::format!(r#"
{}() {{ {}() {{
Run, komorebic.exe {}, , Hide RunWait, komorebic.exe {}, , Hide
}}"#, }}"#,
::std::stringify!(#name), ::std::stringify!(#name),
::std::stringify!(#name).to_kebab_case() ::std::stringify!(#name).to_kebab_case()

View File

@@ -1,357 +1,357 @@
; Generated by komorebic.exe ; Generated by komorebic.exe
Start(ffm, await_configuration, tcp_port) { Start(ffm, await_configuration, tcp_port) {
Run, komorebic.exe start %ffm% --await-configuration %await_configuration% --tcp-port %tcp_port%, , Hide RunWait, komorebic.exe start %ffm% --await-configuration %await_configuration% --tcp-port %tcp_port%, , Hide
} }
Stop() { Stop() {
Run, komorebic.exe stop, , Hide RunWait, komorebic.exe stop, , Hide
} }
State() { State() {
Run, komorebic.exe state, , Hide RunWait, komorebic.exe state, , Hide
} }
Query(state_query) { Query(state_query) {
Run, komorebic.exe query %state_query%, , Hide RunWait, komorebic.exe query %state_query%, , Hide
} }
Subscribe(named_pipe) { Subscribe(named_pipe) {
Run, komorebic.exe subscribe %named_pipe%, , Hide RunWait, komorebic.exe subscribe %named_pipe%, , Hide
} }
Unsubscribe(named_pipe) { Unsubscribe(named_pipe) {
Run, komorebic.exe unsubscribe %named_pipe%, , Hide RunWait, komorebic.exe unsubscribe %named_pipe%, , Hide
} }
Log() { Log() {
Run, komorebic.exe log, , Hide RunWait, komorebic.exe log, , Hide
} }
QuickSaveResize() { QuickSaveResize() {
Run, komorebic.exe quick-save-resize, , Hide RunWait, komorebic.exe quick-save-resize, , Hide
} }
QuickLoadResize() { QuickLoadResize() {
Run, komorebic.exe quick-load-resize, , Hide RunWait, komorebic.exe quick-load-resize, , Hide
} }
SaveResize(path) { SaveResize(path) {
Run, komorebic.exe save-resize %path%, , Hide RunWait, komorebic.exe save-resize %path%, , Hide
} }
LoadResize(path) { LoadResize(path) {
Run, komorebic.exe load-resize %path%, , Hide RunWait, komorebic.exe load-resize %path%, , Hide
} }
Focus(operation_direction) { Focus(operation_direction) {
Run, komorebic.exe focus %operation_direction%, , Hide RunWait, komorebic.exe focus %operation_direction%, , Hide
} }
Move(operation_direction) { Move(operation_direction) {
Run, komorebic.exe move %operation_direction%, , Hide RunWait, komorebic.exe move %operation_direction%, , Hide
} }
Minimize() { Minimize() {
Run, komorebic.exe minimize, , Hide RunWait, komorebic.exe minimize, , Hide
} }
Close() { Close() {
Run, komorebic.exe close, , Hide RunWait, komorebic.exe close, , Hide
} }
CycleFocus(cycle_direction) { CycleFocus(cycle_direction) {
Run, komorebic.exe cycle-focus %cycle_direction%, , Hide RunWait, komorebic.exe cycle-focus %cycle_direction%, , Hide
} }
CycleMove(cycle_direction) { CycleMove(cycle_direction) {
Run, komorebic.exe cycle-move %cycle_direction%, , Hide RunWait, komorebic.exe cycle-move %cycle_direction%, , Hide
} }
Stack(operation_direction) { Stack(operation_direction) {
Run, komorebic.exe stack %operation_direction%, , Hide RunWait, komorebic.exe stack %operation_direction%, , Hide
} }
Resize(edge, sizing) { Resize(edge, sizing) {
Run, komorebic.exe resize %edge% %sizing%, , Hide RunWait, komorebic.exe resize %edge% %sizing%, , Hide
} }
ResizeAxis(axis, sizing) { ResizeAxis(axis, sizing) {
Run, komorebic.exe resize-axis %axis% %sizing%, , Hide RunWait, komorebic.exe resize-axis %axis% %sizing%, , Hide
} }
Unstack() { Unstack() {
Run, komorebic.exe unstack, , Hide RunWait, komorebic.exe unstack, , Hide
} }
CycleStack(cycle_direction) { CycleStack(cycle_direction) {
Run, komorebic.exe cycle-stack %cycle_direction%, , Hide RunWait, komorebic.exe cycle-stack %cycle_direction%, , Hide
} }
MoveToMonitor(target) { MoveToMonitor(target) {
Run, komorebic.exe move-to-monitor %target%, , Hide RunWait, komorebic.exe move-to-monitor %target%, , Hide
} }
MoveToWorkspace(target) { MoveToWorkspace(target) {
Run, komorebic.exe move-to-workspace %target%, , Hide RunWait, komorebic.exe move-to-workspace %target%, , Hide
} }
SendToMonitor(target) { SendToMonitor(target) {
Run, komorebic.exe send-to-monitor %target%, , Hide RunWait, komorebic.exe send-to-monitor %target%, , Hide
} }
SendToWorkspace(target) { SendToWorkspace(target) {
Run, komorebic.exe send-to-workspace %target%, , Hide RunWait, komorebic.exe send-to-workspace %target%, , Hide
} }
SendToMonitorWorkspace(target_monitor, target_workspace) { SendToMonitorWorkspace(target_monitor, target_workspace) {
Run, komorebic.exe send-to-monitor-workspace %target_monitor% %target_workspace%, , Hide RunWait, komorebic.exe send-to-monitor-workspace %target_monitor% %target_workspace%, , Hide
} }
FocusMonitor(target) { FocusMonitor(target) {
Run, komorebic.exe focus-monitor %target%, , Hide RunWait, komorebic.exe focus-monitor %target%, , Hide
} }
FocusWorkspace(target) { FocusWorkspace(target) {
Run, komorebic.exe focus-workspace %target%, , Hide RunWait, komorebic.exe focus-workspace %target%, , Hide
} }
FocusMonitorWorkspace(target_monitor, target_workspace) { FocusMonitorWorkspace(target_monitor, target_workspace) {
Run, komorebic.exe focus-monitor-workspace %target_monitor% %target_workspace%, , Hide RunWait, komorebic.exe focus-monitor-workspace %target_monitor% %target_workspace%, , Hide
} }
CycleMonitor(cycle_direction) { CycleMonitor(cycle_direction) {
Run, komorebic.exe cycle-monitor %cycle_direction%, , Hide RunWait, komorebic.exe cycle-monitor %cycle_direction%, , Hide
} }
CycleWorkspace(cycle_direction) { CycleWorkspace(cycle_direction) {
Run, komorebic.exe cycle-workspace %cycle_direction%, , Hide RunWait, komorebic.exe cycle-workspace %cycle_direction%, , Hide
} }
MoveWorkspaceToMonitor(target) { MoveWorkspaceToMonitor(target) {
Run, komorebic.exe move-workspace-to-monitor %target%, , Hide RunWait, komorebic.exe move-workspace-to-monitor %target%, , Hide
} }
NewWorkspace() { NewWorkspace() {
Run, komorebic.exe new-workspace, , Hide RunWait, komorebic.exe new-workspace, , Hide
} }
ResizeDelta(pixels) { ResizeDelta(pixels) {
Run, komorebic.exe resize-delta %pixels%, , Hide RunWait, komorebic.exe resize-delta %pixels%, , Hide
} }
InvisibleBorders(left, top, right, bottom) { InvisibleBorders(left, top, right, bottom) {
Run, komorebic.exe invisible-borders %left% %top% %right% %bottom%, , Hide RunWait, komorebic.exe invisible-borders %left% %top% %right% %bottom%, , Hide
} }
WorkAreaOffset(left, top, right, bottom) { WorkAreaOffset(left, top, right, bottom) {
Run, komorebic.exe work-area-offset %left% %top% %right% %bottom%, , Hide RunWait, komorebic.exe work-area-offset %left% %top% %right% %bottom%, , Hide
} }
AdjustContainerPadding(sizing, adjustment) { AdjustContainerPadding(sizing, adjustment) {
Run, komorebic.exe adjust-container-padding %sizing% %adjustment%, , Hide RunWait, komorebic.exe adjust-container-padding %sizing% %adjustment%, , Hide
} }
AdjustWorkspacePadding(sizing, adjustment) { AdjustWorkspacePadding(sizing, adjustment) {
Run, komorebic.exe adjust-workspace-padding %sizing% %adjustment%, , Hide RunWait, komorebic.exe adjust-workspace-padding %sizing% %adjustment%, , Hide
} }
ChangeLayout(default_layout) { ChangeLayout(default_layout) {
Run, komorebic.exe change-layout %default_layout%, , Hide RunWait, komorebic.exe change-layout %default_layout%, , Hide
} }
LoadCustomLayout(path) { LoadCustomLayout(path) {
Run, komorebic.exe load-custom-layout %path%, , Hide RunWait, komorebic.exe load-custom-layout %path%, , Hide
} }
FlipLayout(axis) { FlipLayout(axis) {
Run, komorebic.exe flip-layout %axis%, , Hide RunWait, komorebic.exe flip-layout %axis%, , Hide
} }
Promote() { Promote() {
Run, komorebic.exe promote, , Hide RunWait, komorebic.exe promote, , Hide
} }
PromoteFocus() { PromoteFocus() {
Run, komorebic.exe promote-focus, , Hide RunWait, komorebic.exe promote-focus, , Hide
} }
Retile() { Retile() {
Run, komorebic.exe retile, , Hide RunWait, komorebic.exe retile, , Hide
} }
EnsureWorkspaces(monitor, workspace_count) { EnsureWorkspaces(monitor, workspace_count) {
Run, komorebic.exe ensure-workspaces %monitor% %workspace_count%, , Hide RunWait, komorebic.exe ensure-workspaces %monitor% %workspace_count%, , Hide
} }
ContainerPadding(monitor, workspace, size) { ContainerPadding(monitor, workspace, size) {
Run, komorebic.exe container-padding %monitor% %workspace% %size%, , Hide RunWait, komorebic.exe container-padding %monitor% %workspace% %size%, , Hide
} }
WorkspacePadding(monitor, workspace, size) { WorkspacePadding(monitor, workspace, size) {
Run, komorebic.exe workspace-padding %monitor% %workspace% %size%, , Hide RunWait, komorebic.exe workspace-padding %monitor% %workspace% %size%, , Hide
} }
WorkspaceLayout(monitor, workspace, value) { WorkspaceLayout(monitor, workspace, value) {
Run, komorebic.exe workspace-layout %monitor% %workspace% %value%, , Hide RunWait, komorebic.exe workspace-layout %monitor% %workspace% %value%, , Hide
} }
WorkspaceCustomLayout(monitor, workspace, path) { WorkspaceCustomLayout(monitor, workspace, path) {
Run, komorebic.exe workspace-custom-layout %monitor% %workspace% %path%, , Hide RunWait, komorebic.exe workspace-custom-layout %monitor% %workspace% %path%, , Hide
} }
WorkspaceLayoutRule(monitor, workspace, at_container_count, layout) { WorkspaceLayoutRule(monitor, workspace, at_container_count, layout) {
Run, komorebic.exe workspace-layout-rule %monitor% %workspace% %at_container_count% %layout%, , Hide RunWait, komorebic.exe workspace-layout-rule %monitor% %workspace% %at_container_count% %layout%, , Hide
} }
WorkspaceCustomLayoutRule(monitor, workspace, at_container_count, path) { WorkspaceCustomLayoutRule(monitor, workspace, at_container_count, path) {
Run, komorebic.exe workspace-custom-layout-rule %monitor% %workspace% %at_container_count% %path%, , Hide RunWait, komorebic.exe workspace-custom-layout-rule %monitor% %workspace% %at_container_count% %path%, , Hide
} }
ClearWorkspaceLayoutRules(monitor, workspace) { ClearWorkspaceLayoutRules(monitor, workspace) {
Run, komorebic.exe clear-workspace-layout-rules %monitor% %workspace%, , Hide RunWait, komorebic.exe clear-workspace-layout-rules %monitor% %workspace%, , Hide
} }
WorkspaceTiling(monitor, workspace, value) { WorkspaceTiling(monitor, workspace, value) {
Run, komorebic.exe workspace-tiling %monitor% %workspace% %value%, , Hide RunWait, komorebic.exe workspace-tiling %monitor% %workspace% %value%, , Hide
} }
WorkspaceName(monitor, workspace, value) { WorkspaceName(monitor, workspace, value) {
Run, komorebic.exe workspace-name %monitor% %workspace% %value%, , Hide RunWait, komorebic.exe workspace-name %monitor% %workspace% %value%, , Hide
} }
ToggleWindowContainerBehaviour() { ToggleWindowContainerBehaviour() {
Run, komorebic.exe toggle-window-container-behaviour, , Hide RunWait, komorebic.exe toggle-window-container-behaviour, , Hide
} }
TogglePause() { TogglePause() {
Run, komorebic.exe toggle-pause, , Hide RunWait, komorebic.exe toggle-pause, , Hide
} }
ToggleTiling() { ToggleTiling() {
Run, komorebic.exe toggle-tiling, , Hide RunWait, komorebic.exe toggle-tiling, , Hide
} }
ToggleFloat() { ToggleFloat() {
Run, komorebic.exe toggle-float, , Hide RunWait, komorebic.exe toggle-float, , Hide
} }
ToggleMonocle() { ToggleMonocle() {
Run, komorebic.exe toggle-monocle, , Hide RunWait, komorebic.exe toggle-monocle, , Hide
} }
ToggleMaximize() { ToggleMaximize() {
Run, komorebic.exe toggle-maximize, , Hide RunWait, komorebic.exe toggle-maximize, , Hide
} }
RestoreWindows() { RestoreWindows() {
Run, komorebic.exe restore-windows, , Hide RunWait, komorebic.exe restore-windows, , Hide
} }
Manage() { Manage() {
Run, komorebic.exe manage, , Hide RunWait, komorebic.exe manage, , Hide
} }
Unmanage() { Unmanage() {
Run, komorebic.exe unmanage, , Hide RunWait, komorebic.exe unmanage, , Hide
} }
ReloadConfiguration() { ReloadConfiguration() {
Run, komorebic.exe reload-configuration, , Hide RunWait, komorebic.exe reload-configuration, , Hide
} }
WatchConfiguration(boolean_state) { WatchConfiguration(boolean_state) {
Run, komorebic.exe watch-configuration %boolean_state%, , Hide RunWait, komorebic.exe watch-configuration %boolean_state%, , Hide
} }
CompleteConfiguration() { CompleteConfiguration() {
Run, komorebic.exe complete-configuration, , Hide RunWait, komorebic.exe complete-configuration, , Hide
} }
WindowHidingBehaviour(hiding_behaviour) { WindowHidingBehaviour(hiding_behaviour) {
Run, komorebic.exe window-hiding-behaviour %hiding_behaviour%, , Hide RunWait, komorebic.exe window-hiding-behaviour %hiding_behaviour%, , Hide
} }
CrossMonitorMoveBehaviour(move_behaviour) { CrossMonitorMoveBehaviour(move_behaviour) {
Run, komorebic.exe cross-monitor-move-behaviour %move_behaviour%, , Hide RunWait, komorebic.exe cross-monitor-move-behaviour %move_behaviour%, , Hide
} }
ToggleCrossMonitorMoveBehaviour() { ToggleCrossMonitorMoveBehaviour() {
Run, komorebic.exe toggle-cross-monitor-move-behaviour, , Hide RunWait, komorebic.exe toggle-cross-monitor-move-behaviour, , Hide
} }
UnmanagedWindowOperationBehaviour(operation_behaviour) { UnmanagedWindowOperationBehaviour(operation_behaviour) {
Run, komorebic.exe unmanaged-window-operation-behaviour %operation_behaviour%, , Hide RunWait, komorebic.exe unmanaged-window-operation-behaviour %operation_behaviour%, , Hide
} }
FloatRule(identifier, id) { FloatRule(identifier, id) {
Run, komorebic.exe float-rule %identifier% "%id%", , Hide RunWait, komorebic.exe float-rule %identifier% "%id%", , Hide
} }
ManageRule(identifier, id) { ManageRule(identifier, id) {
Run, komorebic.exe manage-rule %identifier% "%id%", , Hide RunWait, 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 RunWait, 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 RunWait, 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 RunWait, komorebic.exe identify-tray-application %identifier% "%id%", , Hide
} }
IdentifyLayeredApplication(identifier, id) { IdentifyLayeredApplication(identifier, id) {
Run, komorebic.exe identify-layered-application %identifier% "%id%", , Hide RunWait, komorebic.exe identify-layered-application %identifier% "%id%", , Hide
} }
IdentifyBorderOverflowApplication(identifier, id) { IdentifyBorderOverflowApplication(identifier, id) {
Run, komorebic.exe identify-border-overflow-application %identifier% "%id%", , Hide RunWait, komorebic.exe identify-border-overflow-application %identifier% "%id%", , Hide
} }
ActiveWindowBorder(boolean_state) { ActiveWindowBorder(boolean_state) {
Run, komorebic.exe active-window-border %boolean_state%, , Hide RunWait, komorebic.exe active-window-border %boolean_state%, , Hide
} }
ActiveWindowBorderColour(r, g, b, window_kind) { ActiveWindowBorderColour(r, g, b, window_kind) {
Run, komorebic.exe active-window-border-colour %r% %g% %b% --window-kind %window_kind%, , Hide RunWait, komorebic.exe active-window-border-colour %r% %g% %b% --window-kind %window_kind%, , Hide
} }
FocusFollowsMouse(boolean_state, implementation) { FocusFollowsMouse(boolean_state, implementation) {
Run, komorebic.exe focus-follows-mouse %boolean_state% --implementation %implementation%, , Hide RunWait, komorebic.exe focus-follows-mouse %boolean_state% --implementation %implementation%, , Hide
} }
ToggleFocusFollowsMouse(implementation) { ToggleFocusFollowsMouse(implementation) {
Run, komorebic.exe toggle-focus-follows-mouse --implementation %implementation%, , Hide RunWait, komorebic.exe toggle-focus-follows-mouse --implementation %implementation%, , Hide
} }
MouseFollowsFocus(boolean_state) { MouseFollowsFocus(boolean_state) {
Run, komorebic.exe mouse-follows-focus %boolean_state%, , Hide RunWait, komorebic.exe mouse-follows-focus %boolean_state%, , Hide
} }
ToggleMouseFollowsFocus() { ToggleMouseFollowsFocus() {
Run, komorebic.exe toggle-mouse-follows-focus, , Hide RunWait, komorebic.exe toggle-mouse-follows-focus, , Hide
} }
AhkLibrary() { AhkLibrary() {
Run, komorebic.exe ahk-library, , Hide RunWait, komorebic.exe ahk-library, , Hide
} }
AhkAppSpecificConfiguration(path, override_path) { AhkAppSpecificConfiguration(path, override_path) {
Run, komorebic.exe ahk-app-specific-configuration %path% %override_path%, , Hide RunWait, komorebic.exe ahk-app-specific-configuration %path% %override_path%, , Hide
} }
FormatAppSpecificConfiguration(path) { FormatAppSpecificConfiguration(path) {
Run, komorebic.exe format-app-specific-configuration %path%, , Hide RunWait, komorebic.exe format-app-specific-configuration %path%, , Hide
} }
NotificationSchema() { NotificationSchema() {
Run, komorebic.exe notification-schema, , Hide RunWait, komorebic.exe notification-schema, , Hide
} }
SocketSchema() { SocketSchema() {
Run, komorebic.exe socket-schema, , Hide RunWait, komorebic.exe socket-schema, , Hide
} }