Skip to content

Commit

Permalink
Rename MoveContainerToWorkspaceCommand -> MoveNodeToWorkspaceCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitabobko committed Nov 2, 2023
1 parent f7ab7df commit 5ec184d
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 59 deletions.
8 changes: 4 additions & 4 deletions AeroSpace.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
2CC46A952773F148AC398144 /* Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6352ADEE6625D9703CFCA99A /* Window.swift */; };
2E06134604F2510189F1FA85 /* ExecAndWaitCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9EDB8770FBA8B2E6FE91BBB /* ExecAndWaitCommand.swift */; };
374CE35B85B941B8F584C113 /* FlattenWorkspaceTreeCommandTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53FDECECC773EBA30661EB8A /* FlattenWorkspaceTreeCommandTest.swift */; };
3774857EF024E97B7AA5DE78 /* MoveNodeToWorkspaceCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25AC44D0E9450867215FCBEC /* MoveNodeToWorkspaceCommand.swift */; };
39EC2CF418F086457E900177 /* showMessageToUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14FABE2521026C8394254D97 /* showMessageToUser.swift */; };
3BD6FF4CC51532977DA0C05A /* AeroAny.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82476B9BEBAC00EB9E32256F /* AeroAny.swift */; };
3BE358D5C209F279BB71AC95 /* MoveInCommandTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E5ED8E885494CAEEC70A90 /* MoveInCommandTest.swift */; };
Expand All @@ -47,7 +48,6 @@
7ED8C2A66DD6F903796F090C /* TestApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2431BEAFFF1AC12D3001317A /* TestApp.swift */; };
8086A22EDCDC4C906C337D0B /* resizeWithMouse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9745E5FC11701AE35712EC18 /* resizeWithMouse.swift */; };
852F88894A3B9FC385563665 /* HotKey in Frameworks */ = {isa = PBXBuildFile; productRef = 42BC1E757EF69233C2262FF4 /* HotKey */; };
89064BDDB5E9D17BEDE52E8C /* MoveContainerToWorkspaceCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD62043D7F5113A8BA635FDF /* MoveContainerToWorkspaceCommand.swift */; };
920FDF8498DCCB62149D1719 /* Monitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6507EBAA795220FD0C05384 /* Monitor.swift */; };
93D44EA41776738B4758C28D /* util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 976540EBEACF846D598CD6E1 /* util.swift */; };
991943D50DF9EDBF321A66F1 /* SelectorComparator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1316FFED5D1044CB693EA45 /* SelectorComparator.swift */; };
Expand Down Expand Up @@ -109,6 +109,7 @@
1C0D40CBD65704BA9595C2FA /* keysMap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = keysMap.swift; sourceTree = "<group>"; };
1E81623E8954701269A22322 /* AeroSpaceApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AeroSpaceApp.swift; sourceTree = "<group>"; };
2431BEAFFF1AC12D3001317A /* TestApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestApp.swift; sourceTree = "<group>"; };
25AC44D0E9450867215FCBEC /* MoveNodeToWorkspaceCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoveNodeToWorkspaceCommand.swift; sourceTree = "<group>"; };
28B788A95DD3C267878E05B5 /* Rect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Rect.swift; sourceTree = "<group>"; };
3A262B442A94C1964509B691 /* TreeNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TreeNode.swift; sourceTree = "<group>"; };
3A6EF465EF4129BCB10FE247 /* ExecCommandTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExecCommandTest.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -160,7 +161,6 @@
C848D6E57FDF22AAF0FB45E6 /* TilingContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TilingContainer.swift; sourceTree = "<group>"; };
CB03A4736BC3F6D19E4E69F3 /* parseCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = parseCommand.swift; sourceTree = "<group>"; };
CB371951459F8CB0137788C2 /* ResizeCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResizeCommand.swift; sourceTree = "<group>"; };
CD62043D7F5113A8BA635FDF /* MoveContainerToWorkspaceCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoveContainerToWorkspaceCommand.swift; sourceTree = "<group>"; };
CD90FB41FD41602120F67FF5 /* Command.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Command.swift; sourceTree = "<group>"; };
CF3C9038C846369FDD71D1D2 /* ReloadConfigCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReloadConfigCommand.swift; sourceTree = "<group>"; };
D0EAADE8D2FB5D05FA5456B0 /* FocusCommandTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusCommandTest.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -326,7 +326,7 @@
D27A7AF7E9A049700BDE276B /* JoinWithCommand.swift */,
1A2B673C67B00DBFCC27FFE7 /* LayoutCommand.swift */,
4B0CD3C2A0E86CDB9DF312AB /* ModeCommand.swift */,
CD62043D7F5113A8BA635FDF /* MoveContainerToWorkspaceCommand.swift */,
25AC44D0E9450867215FCBEC /* MoveNodeToWorkspaceCommand.swift */,
67B9FFF81EB0327ABD51A7FE /* MoveThroughCommand.swift */,
0FF221FD5C0CB4163E322D6D /* MoveWorkspaceToDisplayCommand.swift */,
CB03A4736BC3F6D19E4E69F3 /* parseCommand.swift */,
Expand Down Expand Up @@ -509,7 +509,7 @@
EECC59858691B99A95542D72 /* MacWindow.swift in Sources */,
6E4E235FDA41307B19F16182 /* ModeCommand.swift in Sources */,
920FDF8498DCCB62149D1719 /* Monitor.swift in Sources */,
89064BDDB5E9D17BEDE52E8C /* MoveContainerToWorkspaceCommand.swift in Sources */,
3774857EF024E97B7AA5DE78 /* MoveNodeToWorkspaceCommand.swift in Sources */,
EDFDE707B4DC5E500B1709B1 /* MoveThroughCommand.swift in Sources */,
05407EA2B9AC3F9371B56E6B /* MoveWorkspaceToDisplayCommand.swift in Sources */,
635733FDDF37E44364372B74 /* MruStack.swift in Sources */,
Expand Down
66 changes: 33 additions & 33 deletions config-examples/default-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,39 +98,39 @@ alt-x = 'workspace X'
alt-y = 'workspace Y'
alt-z = 'workspace Z'

# See: https://github.com/nikitabobko/AeroSpace/blob/main/docs/commands.md#move-container-to-workspace
alt-shift-0 = 'move-container-to-workspace 0'
alt-shift-1 = 'move-container-to-workspace 1'
alt-shift-2 = 'move-container-to-workspace 2'
alt-shift-3 = 'move-container-to-workspace 3'
alt-shift-4 = 'move-container-to-workspace 4'
alt-shift-5 = 'move-container-to-workspace 5'
alt-shift-6 = 'move-container-to-workspace 6'
alt-shift-7 = 'move-container-to-workspace 7'
alt-shift-8 = 'move-container-to-workspace 8'
alt-shift-9 = 'move-container-to-workspace 9'
alt-shift-a = 'move-container-to-workspace A'
alt-shift-b = 'move-container-to-workspace B'
alt-shift-c = 'move-container-to-workspace C'
alt-shift-d = 'move-container-to-workspace D'
alt-shift-e = 'move-container-to-workspace E'
alt-shift-f = 'move-container-to-workspace F'
alt-shift-g = 'move-container-to-workspace G'
alt-shift-i = 'move-container-to-workspace I'
alt-shift-m = 'move-container-to-workspace M'
alt-shift-n = 'move-container-to-workspace N'
alt-shift-o = 'move-container-to-workspace O'
alt-shift-p = 'move-container-to-workspace P'
alt-shift-q = 'move-container-to-workspace Q'
alt-shift-r = 'move-container-to-workspace R'
alt-shift-s = 'move-container-to-workspace S'
alt-shift-t = 'move-container-to-workspace T'
alt-shift-u = 'move-container-to-workspace U'
alt-shift-v = 'move-container-to-workspace V'
alt-shift-w = 'move-container-to-workspace W'
alt-shift-x = 'move-container-to-workspace X'
alt-shift-y = 'move-container-to-workspace Y'
alt-shift-z = 'move-container-to-workspace Z'
# See: https://github.com/nikitabobko/AeroSpace/blob/main/docs/commands.md#move-node-to-workspace
alt-shift-0 = 'move-node-to-workspace 0'
alt-shift-1 = 'move-node-to-workspace 1'
alt-shift-2 = 'move-node-to-workspace 2'
alt-shift-3 = 'move-node-to-workspace 3'
alt-shift-4 = 'move-node-to-workspace 4'
alt-shift-5 = 'move-node-to-workspace 5'
alt-shift-6 = 'move-node-to-workspace 6'
alt-shift-7 = 'move-node-to-workspace 7'
alt-shift-8 = 'move-node-to-workspace 8'
alt-shift-9 = 'move-node-to-workspace 9'
alt-shift-a = 'move-node-to-workspace A'
alt-shift-b = 'move-node-to-workspace B'
alt-shift-c = 'move-node-to-workspace C'
alt-shift-d = 'move-node-to-workspace D'
alt-shift-e = 'move-node-to-workspace E'
alt-shift-f = 'move-node-to-workspace F'
alt-shift-g = 'move-node-to-workspace G'
alt-shift-i = 'move-node-to-workspace I'
alt-shift-m = 'move-node-to-workspace M'
alt-shift-n = 'move-node-to-workspace N'
alt-shift-o = 'move-node-to-workspace O'
alt-shift-p = 'move-node-to-workspace P'
alt-shift-q = 'move-node-to-workspace Q'
alt-shift-r = 'move-node-to-workspace R'
alt-shift-s = 'move-node-to-workspace S'
alt-shift-t = 'move-node-to-workspace T'
alt-shift-u = 'move-node-to-workspace U'
alt-shift-v = 'move-node-to-workspace V'
alt-shift-w = 'move-node-to-workspace W'
alt-shift-x = 'move-node-to-workspace X'
alt-shift-y = 'move-node-to-workspace Y'
alt-shift-z = 'move-node-to-workspace Z'

# See: https://github.com/nikitabobko/AeroSpace/blob/main/docs/commands.md#workspace-back-and-forth
alt-tab = 'workspace-back-and-forth'
Expand Down
20 changes: 10 additions & 10 deletions config-examples/i3-like-config-example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ alt-8 = 'workspace 8'
alt-9 = 'workspace 9'
alt-0 = 'workspace 10'

alt-shift-1 = 'move-container-to-workspace 1'
alt-shift-2 = 'move-container-to-workspace 2'
alt-shift-3 = 'move-container-to-workspace 3'
alt-shift-4 = 'move-container-to-workspace 4'
alt-shift-5 = 'move-container-to-workspace 5'
alt-shift-6 = 'move-container-to-workspace 6'
alt-shift-7 = 'move-container-to-workspace 7'
alt-shift-8 = 'move-container-to-workspace 8'
alt-shift-9 = 'move-container-to-workspace 9'
alt-shift-0 = 'move-container-to-workspace 10'
alt-shift-1 = 'move-node-to-workspace 1'
alt-shift-2 = 'move-node-to-workspace 2'
alt-shift-3 = 'move-node-to-workspace 3'
alt-shift-4 = 'move-node-to-workspace 4'
alt-shift-5 = 'move-node-to-workspace 5'
alt-shift-6 = 'move-node-to-workspace 6'
alt-shift-7 = 'move-node-to-workspace 7'
alt-shift-8 = 'move-node-to-workspace 8'
alt-shift-9 = 'move-node-to-workspace 9'
alt-shift-0 = 'move-node-to-workspace 10'

alt-shift-c = 'reload-config'

Expand Down
16 changes: 9 additions & 7 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [join-with](#join-with)
- [layout](#layout)
- [mode](#mode)
- [move-container-to-workspace](#move-container-to-workspace)
- [move-node-to-workspace](#move-node-to-workspace)
- [move-through](#move-through)
- [move-workspace-to-display](#move-workspace-to-display)
- [reload-config](#reload-config)
Expand Down Expand Up @@ -107,9 +107,10 @@ h_list
└── window 3
```

`join-with` command is supposed to be a replacement for i3's [split command](https://i3wm.org/docs/userguide.html#_splitting_containers).
It seems that the only reason why you might want to split a container is to put several windows under a common "umbrella" parent.
Contrary to `split`, `join-with` can be used with [enable-normalization-flatten-containers](./guide.md#normalization)
> [!NOTE]
> `join-with` command is supposed to be a replacement for i3's [split command](https://i3wm.org/docs/userguide.html#_splitting_containers).
> It seems that the only reason why you might want to split a node is to put several windows under a common "umbrella" parent.
> Contrary to `split`, `join-with` can be used with [enable-normalization-flatten-containers](./guide.md#normalization)
## layout

Expand All @@ -132,10 +133,10 @@ mode name_of_the_target_mode

Activates the specified [binding mode](./guide.md#bindings-modes)

## move-container-to-workspace
## move-node-to-workspace

```
move-container-to-workspace target_workspace_name
move-node-to-workspace target_workspace_name
```

Moves currently focused window to the specified workspace
Expand All @@ -149,7 +150,8 @@ move-through (left|down|up|right) [floating_pixel]
Moves the window in the given direction. The optional `floating_pixel` argument specifies how far the window should be moved if
it is floating. The default is 50 pixels

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct MoveContainerToWorkspaceCommand: Command {
struct MoveNodeToWorkspaceCommand: Command {
let targetWorkspaceName: String

func runWithoutLayout() async {
Expand Down
4 changes: 2 additions & 2 deletions src/command/parseCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func parseSingleCommand(_ raw: String) -> ParsedCommand<Command> {
let firstWord = String(words.first ?? "")
if firstWord == "workspace" {
return parseSingleArg(args, firstWord).map { WorkspaceCommand(workspaceName: $0) }
} else if firstWord == "move-container-to-workspace" {
return parseSingleArg(args, firstWord).map { MoveContainerToWorkspaceCommand(targetWorkspaceName: $0) }
} else if firstWord == "move-node-to-workspace" {
return parseSingleArg(args, firstWord).map { MoveNodeToWorkspaceCommand(targetWorkspaceName: $0) }
} else if firstWord == "mode" {
return parseSingleArg(args, firstWord).map { ModeCommand(idToActivate: $0) }
} else if firstWord == "join-with" {
Expand Down
4 changes: 2 additions & 2 deletions test/command/MoveContainerToWorkspaceCommandTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class MoveContainerToWorkspaceCommandTest: XCTestCase {
}

XCTAssertTrue(focusedWorkspaceSourceOfTruth == .macOs)
await MoveContainerToWorkspaceCommand(targetWorkspaceName: "b").runWithoutLayout()
await MoveNodeToWorkspaceCommand(targetWorkspaceName: "b").runWithoutLayout()
XCTAssertTrue(workspaceA.isEffectivelyEmpty)
XCTAssertTrue(focusedWorkspaceSourceOfTruth == .ownModel)
XCTAssertEqual((Workspace.get(byName: "b").rootTilingContainer.children.singleOrNil() as? Window)?.windowId, 1)
Expand All @@ -23,7 +23,7 @@ final class MoveContainerToWorkspaceCommandTest: XCTestCase {
}

XCTAssertTrue(focusedWorkspaceSourceOfTruth == .macOs)
await MoveContainerToWorkspaceCommand(targetWorkspaceName: "b").runWithoutLayout()
await MoveNodeToWorkspaceCommand(targetWorkspaceName: "b").runWithoutLayout()
XCTAssertTrue(workspaceA.isEffectivelyEmpty)
XCTAssertTrue(focusedWorkspaceSourceOfTruth == .ownModel)
XCTAssertEqual(Workspace.get(byName: "b").children.filterIsInstance(of: Window.self).singleOrNil()?.windowId, 1)
Expand Down

0 comments on commit 5ec184d

Please sign in to comment.