Skip to content

Commit

Permalink
add source files
Browse files Browse the repository at this point in the history
  • Loading branch information
gogamid committed May 21, 2024
1 parent f791864 commit afdbdab
Show file tree
Hide file tree
Showing 5 changed files with 326 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Mac
.DS_Store

# Alfred
prefs.plist
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/usage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
235 changes: 235 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>az.gogamid.aerospace</string>
<key>connections</key>
<dict>
<key>5571A44C-D107-43F7-8139-97F8FEE23248</key>
<array>
<dict>
<key>destinationuid</key>
<string>3E3CBCF0-0943-4DA8-8E16-D23C8457DC5A</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>A485572F-8F6B-4C39-BEB5-569BE66A8212</key>
<array>
<dict>
<key>destinationuid</key>
<string>5571A44C-D107-43F7-8139-97F8FEE23248</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Imron Gamidli</string>
<key>description</key>
<string>Aerospace Tiling Window Manager Extension for Alfred</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>aerospace</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttreatemptyqueryasnil</key>
<true/>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>102</integer>
<key>keyword</key>
<string>{var:aerospace_keyword}</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
<true/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>fetching commands</string>
<key>script</key>
<string>python3 ./main.py $1
</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string></string>
<key>title</key>
<string>Type Aerospace Command</string>
<key>type</key>
<integer>11</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>A485572F-8F6B-4C39-BEB5-569BE66A8212</string>
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>alignment</key>
<integer>0</integer>
<key>backgroundcolor</key>
<string></string>
<key>fadespeed</key>
<integer>0</integer>
<key>fillmode</key>
<integer>0</integer>
<key>font</key>
<string></string>
<key>ignoredynamicplaceholders</key>
<false/>
<key>largetypetext</key>
<string>{query}</string>
<key>textcolor</key>
<string></string>
<key>wrapat</key>
<integer>50</integer>
</dict>
<key>type</key>
<string>alfred.workflow.output.largetype</string>
<key>uid</key>
<string>3E3CBCF0-0943-4DA8-8E16-D23C8457DC5A</string>
<key>version</key>
<integer>3</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>aerospace {query}</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>11</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>5571A44C-D107-43F7-8139-97F8FEE23248</string>
<key>version</key>
<integer>2</integer>
</dict>
</array>
<key>readme</key>
<string># alfred-aerospace
&lt;!--toc:start--&gt;
- [alfred-aerospace](#alfred-aerospace)
- [Usage](#usage)
- [Contribution is needed](#contribution-is-needed)
&lt;!--toc:end--&gt;
Aerospace Tiling Window Manager Extension for Alfred
## Usage
![usage](./images/usage.png)
Currently only commands which do not require options are working, such as:
- flatten-workspace-tree
- fullscreen
- macos-native-fullscreen
- reload-config
- enable
- close
- close-all-but-current
....
## Contribution is needed
1. Read about [Script Filter](https://www.alfredapp.com/help/workflows/inputs/script-filter/?ref=blog.lorentzca.me)
2. Modify [main.py](./main.py) file for command options</string>
<key>uidata</key>
<dict>
<key>3E3CBCF0-0943-4DA8-8E16-D23C8457DC5A</key>
<dict>
<key>xpos</key>
<real>525</real>
<key>ypos</key>
<real>365</real>
</dict>
<key>5571A44C-D107-43F7-8139-97F8FEE23248</key>
<dict>
<key>xpos</key>
<real>290</real>
<key>ypos</key>
<real>365</real>
</dict>
<key>A485572F-8F6B-4C39-BEB5-569BE66A8212</key>
<dict>
<key>xpos</key>
<real>80</real>
<key>ypos</key>
<real>365</real>
</dict>
</dict>
<key>userconfigurationconfig</key>
<array>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string>asp</string>
<key>placeholder</key>
<string>asp</string>
<key>required</key>
<true/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string>Trigger keyword for aerospace in Alfred!</string>
<key>label</key>
<string>Keyword</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>aerospace_keyword</string>
</dict>
</array>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>0.0.1</string>
<key>webaddress</key>
<string>https://github.com/gogamid/alfred-aerospace</string>
</dict>
</plist>
86 changes: 86 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import json
import sys

csv_rows = [
("close", "Close the focused window"),
(
"close-all-windows-but-current",
"On the focused workspace, close all windows but current",
),
(
"debug-windows",
"Interactive command to record Accessibility API debug information to create bug reports",
),
("enable", "Temporarily disable window management"),
("flatten-workspace-tree", "Flatten the tree of currently focused workspace."),
("focus", "Set focus to the nearest window in in the given direction."),
("focus-monitor", "Focus monitor by relative direction, by order, or by pattern"),
("fullscreen", "Toggle the fullscreen mode for the currently focused window"),
(
"join-with",
"Put the currently focused window and the nearest node in the specified direction under a common parent container",
),
("layout", "Change layout of the focused window to the given layout"),
(
"list-apps",
"Print the list of running applications that appears in the Dock and may have a user interface",
),
(
"list-exec-env-vars",
"List environment variables that exec-* commands and callbacks are run with",
),
("list-monitors", "Print monitors that satisfy conditions"),
("list-windows", "Print windows that satisfy conditions"),
("list-workspaces", "Print workspaces that satisfy conditions"),
(
"macos-native-fullscreen",
"Toggle macOS fullscreen for the currently focused window",
),
("macos-native-minimize", "Toggle macOS minimize for the currently focused window"),
("mode", "Activate the specified binding mode"),
("move", "Move the window in the given direction"),
(
"move-node-to-monitor",
"Move window to monitor targeted by relative direction, by order, or by pattern",
),
(
"move-node-to-workspace",
"Move currently focused window to the specified workspace",
),
(
"move-workspace-to-monitor",
"Move currently focused workspace to the next or previous monitor",
),
("reload-config", "Reload currently active config"),
("resize", "Resize the currently focused window"),
("split", "Split focused window"),
("workspace", "Focus the specified workspace"),
(
"workspace-back-and-forth",
"Switch between currently focused workspace and previously focused workspace back and forth",
),
]


def generate_worflow_output(commands):
return json.dumps(
{
"items": [
{
"title": command,
"subtitle": description,
"arg": command,
}
for (command, description) in commands
]
},
ensure_ascii=False,
)


text = sys.argv[1]
commands = []
for command, description in csv_rows:
if text in command:
commands.append((command, description))
print(generate_worflow_output(commands))

0 comments on commit afdbdab

Please sign in to comment.