Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitabobko committed Oct 29, 2023
1 parent 6689cdc commit 526ff35
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 14 deletions.
10 changes: 5 additions & 5 deletions config-examples/default-config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Place a copy of this config to ~/.aerospace.toml. After that you can edit ~/.aerospace.toml to your liking
# Place a copy of this config to ~/.aerospace.toml. After that, you can edit ~/.aerospace.toml to your liking

# You can use it to add commands that run after login to macOS user session.
# 'start-at-login' needs to be 'true' for 'after-login-command' to work
Expand Down Expand Up @@ -47,8 +47,8 @@ default-root-container-orientation = 'auto'
# alt-enter = 'exec-and-forget open -n /System/Applications/Utilities/Terminal.app'

# See: https://github.com/nikitabobko/AeroSpace/blob/main/docs/commands.md#layout
alt-slash = 'layout h_list v_list'
alt-comma = 'layout h_accordion v_accordion'
alt-slash = 'layout list horizontal vertical'
alt-comma = 'layout accordion horizontal vertical'

# See: https://github.com/nikitabobko/AeroSpace/blob/main/docs/commands.md#focus
alt-h = 'focus left'
Expand Down Expand Up @@ -147,9 +147,9 @@ alt-shift-slash = 'mode move-in'
[mode.service.binding]
r = ['flatten-workspace-tree', 'mode main']
o = ['reload-config', 'mode main']
#s = ['layout sticky tiling', 'mode main'] # todo sticky is not yet supported
#s = ['layout sticky tiling', 'mode main'] # sticky is not yet supported https://github.com/nikitabobko/AeroSpace/issues/2
f = ['layout floating tiling', 'mode main'] # Toggle between floating and tiling layout
backslash = ['close-all-windows-but-current', 'mode main']
backspace = ['close-all-windows-but-current', 'mode main']
esc = 'mode main'
enter = 'mode main'

Expand Down
7 changes: 3 additions & 4 deletions config-examples/i3-like-config-example.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Reference: https://github.com/i3/i3/blob/next/etc/config

# todo finish

enable-normalization-flatten-containers = false
enable-normalization-opposite-orientation-for-nested-containers = false

Expand All @@ -21,11 +19,11 @@ alt-shift-l = 'move-through right'
# alt-h = 'split h' # todo support split command?
# alt-v = 'split v' # todo support split command?

# alt-f = 'fullscreen' # todo support fullscreen command?
# alt-f = 'fullscreen' # todo support fullscreen command? https://github.com/nikitabobko/AeroSpace/issues/7

alt-s = 'layout v_accordion' # 'layout stacking' in i3
alt-w = 'layout h_accordion' # 'layout tabbed' in i3
alt-e = 'layout h_list v_list' # 'layout toggle list' in i3
alt-e = 'layout list horizontal vertical' # 'layout toggle split' in i3

alt-shift-space = 'layout floating tiling' # 'floating toggle' in i3

Expand All @@ -34,6 +32,7 @@ alt-shift-space = 'layout floating tiling' # 'floating toggle' in i3
#alt-space = 'focus toggle_tiling_floating'

# `focus parent`/`focus child` are not yet supported, and it's not clear whether they should be supported at all
# https://github.com/nikitabobko/AeroSpace/issues/5
# alt-a = 'focus parent'

alt-1 = 'workspace 1'
Expand Down
112 changes: 109 additions & 3 deletions docs/commands.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,123 @@
# Commands

**Table of contents**
- [close-all-windows-but-current](#close-all-windows-but-current)
- [exec-and-forget](#exec-and-forget)
- [exec-and-wait](#exec-and-wait)
- [flatten-workspace-tree](#flatten-workspace-tree)
- [focus](#focus)
- [layout](#layout)
- [mode](#mode)
- [move-container-to-workspace](#move-container-to-workspace)
- [move-in](#move-in)
- [move-through](#move-through)
- [move-workspace-to-display](#move-workspace-to-display)
- [reload-config](#reload-config)
- [resize](#resize)
- [workspace-back-and-forth](#workspace-back-and-forth)
- [workspace](#workspace)

## close-all-windows-but-current

```
close-all-windows-but-current
```

On the focused workspace, closes all windows but current. This command doesn't have any arguments.

## exec-and-forget

```
exec-and-forget bash_command
```

Runs `/bin/bash -c '$bash_command'`. Stdout, stderr and exit code are ignored.

For example, you can use this command to launch applications: `exec-and-forget open -n /System/Applications/Utilities/Terminal.app`

## exec-and-wait

```
exec-and-wait bash_command
```

Runs `/bin/bash -c '$bash_command'`, and waits until the command is terminated. Stdout, stderr and exit code are ignored.

Please prefer `exec-and-forget`, unless you need to wait for the termination.

You might want to wait for the termination if you have a list of commands, and you want `bash_command` to exit until you run the
next command.

Suppose that you have this binding in your config:
```toml
alt-enter = ['exec-and-wait open -n /System/Applications/Utilities/Terminal.app && sleep 1', 'layout floating']
```

It will open up Terminal.app and make it float. `sleep 1` is still required because `open` returns before the window appears.

## flatten-workspace-tree

```
flatten-workspace-tree
```

Flattens [the tree](./guide.md#tree) of currently focused workspace. This command doesn't have any arguments.

The command is useful when you messed up with your layout, and it's easier to "reset" it and start again.

## focus

```
focus (left|down|up|right)
```

Sets focus to the nearest window in [the tree](./guide.md#tree) in the given direction.

[Contrary to i3](https://i3wm.org/docs/userguide.html#_focusing_moving_containers), `focus` command doesn't have a separate
argument to focus floating windows. From `focus` command perspective, floating windows are part of [the tree](./guide.md#tree).
The floating window parent is determined as the smallest tiling container that contains the center of the floating window.

This technique eliminates the need for an additional binding for floating windows.

`focus child|parent` [isn't yet supported](https://github.com/nikitabobko/AeroSpace/issues/5) because of a low priority.

## layout

> `layout (h_list|v_list|h_accordion|v_accordion|tiling|floating|sticky...)`
```
layout (h_list|v_list|h_accordion|v_accordion|list|accordion|horizontal|vertical|tiling|floating)...
```

## move-through
Changes layout of the focused window to the given layout.

If several arguments are supplied then the first layout that describes the currently active is found. The layout specified after
the found one will be applied. If the currently active layout is not in the list, the first layout in the list will be activated.

`layout tiling` is the only command that makes the focused floating window tiled.

## mode

> SYNO
```
mode name_of_the_target_mode
```

## move-container-to-workspace

## move-in

## move-through

```
move-through (left|down|up|right)
```

This command is an analog of [i3's move command](https://i3wm.org/docs/userguide.html#move_direction)

## move-workspace-to-display

## reload-config

## resize

## workspace-back-and-forth

## workspace
4 changes: 2 additions & 2 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ TODO DOCUMENTATION
### Floating windows
TODO DOCUMENTATION

Normally, floating windows are not part of the tiling tree except for the 'focus' command. From 'focus' command perspective,
floating windows are part of the tree.
Normally, floating windows are not part of the tiling tree. But it's not the case with `focus` command. From `focus` command
perspective, floating windows are part of the tree.

## Default keybindings
TODO DOCUMENTATION the idea behind default keybindings
Expand Down
1 change: 1 addition & 0 deletions src/command/FocusCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ struct FocusCommand: Command {
check(Thread.current.isMainThread)
guard let currentWindow = focusedWindowOrEffectivelyFocused else { return }
let workspace = currentWindow.workspace
// todo floating windows break mru
let floatingWindows = makeFloatingWindowsSeenAsTiling(workspace: workspace)
defer {
restoreFloatingWindows(floatingWindows: floatingWindows, workspace: workspace)
Expand Down

0 comments on commit 526ff35

Please sign in to comment.