-
-
Notifications
You must be signed in to change notification settings - Fork 358
Description
Currently it's impossible to consume stdout and exit codes of commands in toml config. One has to use exec-and-forget
alt-w = 'exec-and-forget aerospace workspace W --fail-if-noop || aerospace workspace-back-and-forth'
atl-tab = 'exec-and-forget aerospace list-workspaces --all | aerospace workspace next'It's slow. Communicating with the server back and forth from CLI client can take additional 100ms which becomes noticeable. Even if we fix the slowness somehow, annoying flickering will still remain an issue
It'd be cool if AeroSpace supported basic shell combinators (||, &&, ;, ( ))
alt-w = 'workspace --fail-if-noop W || workspace-back-and-forth'
atl-tab = 'list-workspaces --all | workspace next'That's a big feature that lays the foundation for a lot of things (basically the combinators allow programming custom logic):
- It becomes possible to send a batch of commands from CLI to server at once, resulting in reduced flickering (because server already implements "double buffering" to reduce flickering)
https://nikitabobko.github.io/AeroSpace/goodness#use-trackpad-gestures-to-switch-workspacesOr alternatively withoutaerospace eval 'list-workspaces --monitor mouse --visible | xargs workspace; aerospace workspace next'
xargs:aerospace eval 'list-workspaces --monitor mouse --visible | workspace -; workspace next' - It fixes the ugliness of
on-window-detectedTOML callback. The new syntax is much more compact and powerful. It remains readable for people familiar with shell:on-window-detected = ''' test %{app-bundle-id} == com.jetbrains.intellij && move-workspace-to-monitor I || test %{app-bundle-id} == com.google.Chrome && move-node-to-workspace W || test %{app-bundle-id} == com.apple.dt.Xcode && (move-node-to-workspace X; exec-async 'echo hi!') '''
- It opens up a possibility for even more powerful conditional gaps [Feature Request] Better support for ultrawide monitors #60:
UPD: this particular suggestion was discarded
[gaps] outer.left = 'test %{workspace-tiling-windows-count} --lessThan 2 && echo 100' outer.right = 'test %{workspace-tiling-windows-count} --lessThan 2 && echo 100'
- It makes everything more universal and reusable. E.g. there won't be need to fix Add command to programatically run all on-window-detected callbacks #107 if
configcommand allows to queryon-window-detectedcommand:aerospace eval 'config --get on-window-detected | eval -'
Other subcommands that AeroSpace has to implement to make the feature complete:
testas in CLI but with possibility to interpolate AeroSpace special variables like%{window-title},%{window-name},%{app-bundle-id},%{workspace-tiling-windows-count}, etc Implement test-regex command so users could more interactively test regexes the way they are implemented in AeroSpace #150UPD: stop turning it into a programming language. It's better to provide single dashxargsas in CLI-to a bunch of commands as in "consume stdin convention".xargsand interpolation (which is another idea, that I discard right now) have a downside that it becomes impossible to statically parse all commands in "AeroSpace script"echoas in CLI. (use case: Creating a new Workspace next to the current Workspace, send the current node / App to and focus it? #842)exec-asyncas a replacement forexec-and-forget. The problem withexec-and-forgetthat it's not parsed as real CLI command, making it impossible to use the command with combinatorsevalto evaluate "AeroSpace script" fromargv[1]
Overall a lot issues can be fixed: #264 #60 #54 #174 (partially) #104 (partially) #107 (kinda) #150
Open question: doesn't it open a pandora box of own script programming language? It kinda does. I hope that people will never ask for loops.
Related: #1454