Skip to content

Commit

Permalink
Config WIP 3
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitabobko committed Sep 14, 2023
1 parent ecd8da8 commit 88d3db2
Show file tree
Hide file tree
Showing 19 changed files with 240 additions and 225 deletions.
80 changes: 64 additions & 16 deletions AeroSpace.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

105 changes: 52 additions & 53 deletions config-examples/default-config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# For the whole reference of possible keys and modifiers see: https://github.com/nikitabobko/AeroSpace/blob/main/src/config/keysMap.swift
# For all possible keys and modifiers see: https://github.com/nikitabobko/AeroSpace/blob/main/src/config/keysMap.swift

# todo review defaults

after-startup-command = [] # You can use it to add command or commands that run after startup.
use-padding-for-nested-containers-with-the-same-orientation = true
auto-flatten-containers = true
# auto-different-orientation-for-nested-containers = true
Expand All @@ -11,8 +14,8 @@ alt-enter = 'bash /usr/bin/open /System/Applications/Utilities/Terminal.app'

alt-shift-quote = 'focus child'
alt-quote = 'focus parent'
alt-slash = 'layout toggle h_list v_list'
alt-comma = 'layout toggle h_accordion v_accordion'
# alt-slash = 'layout h_list v_list'
# alt-comma = 'layout h_accordion v_accordion'

# todo focus floating binding

Expand All @@ -23,16 +26,17 @@ alt-j = ['focus tiling', 'focus down']
alt-l = ['focus tiling', 'focus right']

# Move window
alt-shift-k = 'move_through up'
alt-shift-h = 'move_through left'
alt-shift-j = 'move_through down'
alt-shift-l = 'move_through right'

# alt-shift-k = 'move_through up'
# alt-shift-h = 'move_through left'
# alt-shift-j = 'move_through down'
# alt-shift-l = 'move_through right'

# Resize window
alt-shift-minus = 'resize shrink height 2 px'
alt-shift-equal = 'resize grow height 2 px'
alt-shift-comma = 'resize shrink width 2 px'
alt-shift-period = 'resize grow width 2 px'
# alt-shift-minus = 'resize shrink height 2 px'
# alt-shift-equal = 'resize grow height 2 px'
# alt-shift-comma = 'resize shrink width 2 px'
# alt-shift-period = 'resize grow width 2 px'

alt-0 = 'workspace 000'
alt-1 = 'workspace 111'
Expand Down Expand Up @@ -67,47 +71,42 @@ alt-x = 'workspace XXX'
alt-y = 'workspace YYY'
alt-z = 'workspace ZZZ'

alt-shift-0 = 'move container to workspace 000'
alt-shift-1 = 'move container to workspace 111'
alt-shift-2 = 'move container to workspace 222'
alt-shift-3 = 'move container to workspace 333'
alt-shift-4 = 'move container to workspace 444'
alt-shift-5 = 'move container to workspace 555'
alt-shift-6 = 'move container to workspace 666'
alt-shift-7 = 'move container to workspace 777'
alt-shift-8 = 'move container to workspace 888'
alt-shift-9 = 'move container to workspace 999'
alt-shift-a = 'move container to workspace AAA'
alt-shift-b = 'move container to workspace BBB'
alt-shift-c = 'move container to workspace CCC'
alt-shift-d = 'move container to workspace DDD'
alt-shift-e = 'move container to workspace EEE'
alt-shift-f = 'move container to workspace FFF'
alt-shift-g = 'move container to workspace GGG'
alt-shift-i = 'move container to workspace III'
alt-shift-m = 'move container to workspace MMM'
alt-shift-n = 'move container to workspace NNN'
alt-shift-o = 'move container to workspace OOO'
alt-shift-p = 'move container to workspace PPP'
alt-shift-q = 'move container to workspace QQQ'
alt-shift-r = 'move container to workspace RRR'
alt-shift-s = 'move container to workspace SSS'
alt-shift-t = 'move container to workspace TTT'
alt-shift-u = 'move container to workspace UUU'
alt-shift-v = 'move container to workspace VVV'
alt-shift-w = 'move container to workspace WWW'
alt-shift-x = 'move container to workspace XXX'
alt-shift-y = 'move container to workspace YYY'
alt-shift-z = 'move container to workspace ZZZ'

alt-tab = 'workspace_back_and_forth'
# alt-shift-0 = 'move container to workspace 000'
# alt-shift-1 = 'move container to workspace 111'
# alt-shift-2 = 'move container to workspace 222'
# alt-shift-3 = 'move container to workspace 333'
# alt-shift-4 = 'move container to workspace 444'
# alt-shift-5 = 'move container to workspace 555'
# alt-shift-6 = 'move container to workspace 666'
# alt-shift-7 = 'move container to workspace 777'
# alt-shift-8 = 'move container to workspace 888'
# alt-shift-9 = 'move container to workspace 999'
# alt-shift-a = 'move container to workspace AAA'
# alt-shift-b = 'move container to workspace BBB'
# alt-shift-c = 'move container to workspace CCC'
# alt-shift-d = 'move container to workspace DDD'
# alt-shift-e = 'move container to workspace EEE'
# alt-shift-f = 'move container to workspace FFF'
# alt-shift-g = 'move container to workspace GGG'
# alt-shift-i = 'move container to workspace III'
# alt-shift-m = 'move container to workspace MMM'
# alt-shift-n = 'move container to workspace NNN'
# alt-shift-o = 'move container to workspace OOO'
# alt-shift-p = 'move container to workspace PPP'
# alt-shift-q = 'move container to workspace QQQ'
# alt-shift-r = 'move container to workspace RRR'
# alt-shift-s = 'move container to workspace SSS'
# alt-shift-t = 'move container to workspace TTT'
# alt-shift-u = 'move container to workspace UUU'
# alt-shift-v = 'move container to workspace VVV'
# alt-shift-w = 'move container to workspace WWW'
# alt-shift-x = 'move container to workspace XXX'
# alt-shift-y = 'move container to workspace YYY'
# alt-shift-z = 'move container to workspace ZZZ'

alt-shift-slash.alt-shift-k = 'move_in up'
alt-shift-slash.alt-shift-h = 'move_in left'
alt-shift-slash.alt-shift-j = 'move_in down'
alt-shift-slash.alt-shift-l = 'move_in right'
# alt-tab = 'workspace_back_and_forth'

# aerospace config set mode.main.binding.alt-l 'focus tiling' 'focus right'
# aerospace config set mode.main.binding.alt-enter 'basn alacritty'
# aerospace config set mode.main.binding.alt-shift-slash.alt-shift-l 'move_in right'
# aerospace config set config.start-at-login false
# alt-shift-slash.alt-shift-k = 'move_in up'
# alt-shift-slash.alt-shift-h = 'move_in left'
# alt-shift-slash.alt-shift-j = 'move_in down'
# alt-shift-slash.alt-shift-l = 'move_in right'
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ targets:
type: application
platform: macOS
deploymentTarget: "13.0"
sources: [src]
sources: [src, config-examples/default-config.toml]
dependencies:
- package: HotKey
- package: TOMLKit
Expand Down
5 changes: 1 addition & 4 deletions src/accessibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ func checkAccessibilityPermissions() {
}

private func resetAccessibility() {
do {
try Process.run(URL(filePath: "/usr/bin/tccutil"), arguments: ["reset", "Accessibility", Bundle.appId])
} catch {
}
try! Process.run(URL(filePath: "/usr/bin/tccutil"), arguments: ["reset", "Accessibility", Bundle.appId])
}

protocol ReadableAttr {
Expand Down
10 changes: 10 additions & 0 deletions src/command/BashCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
struct BashCommand: Command {
let bashCommand: String

func run() {
do {
try Process.run(URL(filePath: "/bin/bash"), arguments: ["-c", bashCommand])
} catch {
}
}
}
3 changes: 3 additions & 0 deletions src/command/Command.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
protocol Command {
func run()
}
9 changes: 9 additions & 0 deletions src/command/CompositeCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
struct CompositeCommand: Command {
let subCommands: [Command]

func run() {
for command in subCommands {
command.run()
}
}
}
13 changes: 13 additions & 0 deletions src/command/FocusCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
struct FocusCommand: Command {
let direction: Direction

enum Direction: String {
case up, down, left, right

case parent, child, floating, tiling, toggle_tiling_floating
}

func run() {
// todo
}
}
17 changes: 17 additions & 0 deletions src/command/LayoutCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/// Syntax:
/// layout (main|h_accordion|v_accordion|h_list|v_list|floating|tiling)...
struct LayoutCommand: Command {
let toggleTo: [Layout]
enum Layout {
case main
case h_accordion
case v_accordion
case h_list
case v_list
case floating
}

func run() {
// todo
}
}
13 changes: 13 additions & 0 deletions src/command/ModeCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
struct ModeCommand: Command {
let idToActivate: String

func run() {
for (modeId, mode) in config.modes {
if modeId == idToActivate {
mode.activate()
} else {
mode.deactivate()
}
}
}
}
11 changes: 11 additions & 0 deletions src/command/MoveThroughtCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
struct MoveThroughCommand: Command {
let direction: Direction

enum Direction {
case left, down, up, right
}

func run() {

}
}
6 changes: 6 additions & 0 deletions src/command/ReloadConfigCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
struct ReloadConfigCommand: Command {
func run() {
reloadConfig()
refresh()
}
}
7 changes: 7 additions & 0 deletions src/command/WorkspaceCommand.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
struct WorkspaceCommand : Command {
let workspaceName: String

func run() {
switchToWorkspace(Workspace.get(byName: workspaceName))
}
}
100 changes: 0 additions & 100 deletions src/config/Command.swift

This file was deleted.

File renamed without changes.
19 changes: 0 additions & 19 deletions src/config/defaultConfig.swift

This file was deleted.

Loading

0 comments on commit 88d3db2

Please sign in to comment.