-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cb6ea0
commit 025fefe
Showing
13 changed files
with
388 additions
and
51 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import Foundation | ||
|
||
protocol Command { | ||
func run() | ||
} | ||
|
||
struct ChainedCommand: Command { | ||
let subCommands: [Command] | ||
|
||
func run() { | ||
for command in subCommands { | ||
command.run() | ||
} | ||
} | ||
} | ||
|
||
enum NoOpCommand: Command { | ||
case instance | ||
|
||
func run() {} // It does nothing | ||
} | ||
|
||
struct WorkspaceCommand : Command { | ||
let workspaceName: String | ||
|
||
func run() { | ||
switchToWorkspace(Workspace.get(byName: workspaceName)) | ||
} | ||
} | ||
|
||
struct ModeCommand: Command { | ||
let idToActivate: String | ||
|
||
func run() { | ||
for mode in config.modes { | ||
for binding in mode.bindings { | ||
if mode.id == idToActivate { | ||
binding.activate() | ||
} else { | ||
binding.deactivate() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct BashCommand: Command { | ||
let bashCommand: String | ||
|
||
func run() { | ||
do { | ||
try Process.run(URL(filePath: "/bin/bash"), arguments: ["-c", bashCommand]) | ||
} catch { | ||
} | ||
} | ||
} | ||
|
||
struct FocusCommand: Command { | ||
let direction: Direction | ||
|
||
enum Direction { | ||
case up | ||
case down | ||
case left | ||
case right | ||
|
||
case parent | ||
case child | ||
case floating | ||
case tiling | ||
case toggle_tiling_floating | ||
} | ||
|
||
func run() { | ||
// todo | ||
} | ||
} |
Oops, something went wrong.