looking at the code for the open kitty
from flask import Flask, jsonify, request
import subprocess, time
app = Flask(__name__)
@app.route("/api/open-anki")
def open_anki():
try:
# Adjust the path if Anki is somewhere else
subprocess.Popen(["anki"]) # or full path, e.g., "/usr/bin/anki"
return jsonify({"msg": "Anki launched!"})
except Exception as e:
return jsonify({"msg": f"Failed to launch Anki: {e}"}), 500
@app.route("/api/open-kitty-location")
def open_kitty_location():
try:
location = request.args.get('location', 'Guest')
print(location, flush=True)
subprocess.Popen(["kitty"], cwd=location) # or full path, e.g., "/usr/bin/anki"
return jsonify({"msg": "Kitty launched!"})
except Exception as e:
return jsonify({"msg": f"Failed to launch Kitty: {e}"}), 500
if __name__ == "__main__":
app.run()
from flask import request
@app.route('/greet')
def greet():
return f'Hello, {name}!'