All Projects → alexander-akhmetov → Python Shortcuts

alexander-akhmetov / Python Shortcuts

Licence: mit
Create Siri Shortcuts with Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Shortcuts

Androidappshortcuts
App Shortcuts for Android on Pre Nougat 7.1!
Stars: ✭ 223 (-57.52%)
Mutual labels:  shortcut, library
iOSShortcuts
A collection of shortcuts for the Shortcuts app.
Stars: ✭ 60 (-88.57%)
Mutual labels:  shortcut, siri
Xcactionbar
"Alfred for Xcode" plugin
Stars: ✭ 1,217 (+131.81%)
Mutual labels:  shortcut, shortcuts
Hotkeys
➷ A robust Javascript library for capturing keyboard input. It has no dependencies.
Stars: ✭ 5,165 (+883.81%)
Mutual labels:  shortcut, shortcuts
executor
A powerful "short-cutter" to your console to you and your team!
Stars: ✭ 21 (-96%)
Mutual labels:  shortcut, shortcuts
keybind
ClojureScript key bindings (shortcut) library
Stars: ✭ 85 (-83.81%)
Mutual labels:  shortcut, shortcuts
static-hands
⌨️🤯 Stop moving hands, and start code fast ⚡⚡
Stars: ✭ 36 (-93.14%)
Mutual labels:  shortcut, shortcuts
Androidshortcuts
Example app for shortcuts
Stars: ✭ 335 (-36.19%)
Mutual labels:  shortcut, shortcuts
hotkey
⌨️ cross-platform hotkey package
Stars: ✭ 82 (-84.38%)
Mutual labels:  shortcut, shortcuts
react-shortcut
Convenient React component that detects if the given key combination is pressed, and triggers a callback
Stars: ✭ 16 (-96.95%)
Mutual labels:  shortcut, shortcuts
Keymage
Yet Another JS Keybinding library
Stars: ✭ 325 (-38.1%)
Mutual labels:  shortcut, shortcuts
Electron Localshortcut
Add keyboard shortcuts locally to a BrowserWindow instance, without using a Menu
Stars: ✭ 366 (-30.29%)
Mutual labels:  shortcut, shortcuts
Instapy Cli
✨ Python library and CLI to upload photo and video on Instagram. W/o a phone!
Stars: ✭ 498 (-5.14%)
Mutual labels:  library
Discord.io
A small, single-file library for creating DiscordApp clients from Node.js or the browser
Stars: ✭ 511 (-2.67%)
Mutual labels:  library
Jot
Jot is a library for persisting and applying .NET application state.
Stars: ✭ 496 (-5.52%)
Mutual labels:  library
Garland View
≡ GarlandView seamlessly transitions between multiple lists of content. Swift UI library made by @Ramotion
Stars: ✭ 496 (-5.52%)
Mutual labels:  library
Accord
Accord: A sane validation library for Scala
Stars: ✭ 519 (-1.14%)
Mutual labels:  library
Iconfontcppheaders
C, C++ headers and C# classes for icon fonts: Font Awesome, Fork Awesome, Material Design, Kenney game icons and Fontaudio
Stars: ✭ 509 (-3.05%)
Mutual labels:  library
Ical4j
A Java library for parsing and building iCalendar data models
Stars: ✭ 493 (-6.1%)
Mutual labels:  library
Spannedgridlayoutmanager
Android RecyclerView.LayoutManager that resizes and reorders views based on SpanSize
Stars: ✭ 492 (-6.29%)
Mutual labels:  library

WIP: python-shortcuts

Build Status PyPI

🍏 + 🐍 = ❤️

python-shortcuts is a library to create Siri Shortcuts on your laptop with your favourite text editor. It uses toml to represent shortcuts.

The library is in a very early development state (PR welcome!), so it does not support all actions from Shortcuts app.

Supported Python version: >=3.6.

Why

I wanted to convert my shortcut to a file in human-readable format. :)

From the code below this library can create a working shortcut:

[[action]]
type = "ask"
question = "What is your name?"

[[action]]
type = "set_variable"
name = "name"

[[action]]
type = "show_result"
text = "Hello, {{name}}!"

Or the same with Python:

from shortcuts import Shortcut, actions


sc = Shortcut()

sc.actions = [
    actions.AskAction(data={'question': 'What is your name?'}),
    actions.SetVariableAction(data={'name': 'name'}),
    actions.ShowResultAction(data={'text': 'Hello, {{name}}!'})
]

How to use

Installation

pip install shortcuts

Usage

shortcut → toml

If you need to convert existing shortcut to a toml file, at first you need to export it. Go into Shortcuts app, open the shortcut and share it. Choose "Share as file" and use this file with this library.

Convert shortcut file to toml:

shortcuts what_is_your_name.shortcut what_is_your_name.toml

toml → shortcut

Convert a toml file to a shortcut file. After you will need to open the file with iOS Shortcuts app.

shortcuts examples/what_is_your_name.toml what_is_your_name.shortcut

More examples of toml files you can find here. And read the tutorial! :)

URL → [toml|shortcut]

Also, you can download shortcut directly from iCloud. If somebody shared shortcut link with you, just run:

shortcuts https://www.icloud.com/shortcuts/... my_shortcut.toml  # or my_shortcut.shortcut

And it will download this shortcut and save it in toml or shortcut format.

Docker

It's possible to use pre-built Docker container with python-shortcuts inside:

# convert s.toml from the current directory into s.shortcut

docker run -v $(pwd):/files akhmetov/shortcuts-cli /files/s.toml /files/s.shortcut


docker run -v $(pwd):/files akhmetov/shortcuts-cli --help

    usage: shortcuts [-h] [--version] [file] [output]

    Shortcuts: Siri shortcuts creator

    positional arguments:
      file        Input file: *.(toml|shortcut|itunes url)
      output      Output file: *.(toml|shortcut)

    optional arguments:
      -h, --help  show this help message and exit
      --version   Version information

Development

Tests

Run tests:

tox

How to add a new action

See documentation.

TODO

  • Conditionals with auto-group_id: if-else, menu
  • ☐ Nested fields: dict/array/etc
  • ☐ Support variables in every field which support them in Shortcuts app
  • ☐ Workflow types: widget, etc.
  • ☐ Import questions
  • ☐ Document all actions
  • ☐ Support magic variables
  • ☐ Support all current actions from Shortcuts app

Similar projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].