Created
December 28, 2022 06:11
-
-
Save andresrinivasan/425ca2226626af7c5deb5f8243c3fda7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import json | |
| import iterm2 | |
| async def get_most_profiles(c): | |
| all = await iterm2.PartialProfile.async_query(c) | |
| return [p for p in all if p.all_properties["Name"] != "Hotkey Window"] | |
| async def main(connection): | |
| print( | |
| json.dumps( | |
| { | |
| "items": [ | |
| { | |
| "title": "New iTerm Window", | |
| "subtitle": f"Start {p.all_properties['Name']}", | |
| "arg": p.all_properties["Name"], | |
| "match": p.all_properties["Name"], | |
| "autocomplete": p.all_properties["Name"], | |
| "mods": { | |
| "alt": { | |
| "subtitle": f"Start {p.all_properties['Name']} profile in last Finder directory" | |
| } | |
| }, | |
| } | |
| for p in await get_most_profiles(connection) | |
| ] | |
| } | |
| ) | |
| ) | |
| if __name__ == "__main__": | |
| iterm2.run_until_complete(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment