Skip to main content

External open submit

External open allows you to open a Kelvin submit directly in your IDE or terminal. To set it up, follow these steps:

  1. Create schema handler for kelvin::

    # ~/.local/share/applications/kelvin-open.desktop
    [Desktop Entry]
    Type=Application
    Name=Kelvin schema handler
    Exec=kelvin-open %u
    StartupNotify=false
    MimeType=x-scheme-handler/kelvin;
  2. Register schema with default app

    xdg-mime default kelvin-open.desktop x-schema-handler/kelvin
  3. Generate your API token and store it in ~/.config/kelvin/token

  4. Create your kelvin-open script and add it to the $PATH

    #!/bin/bash
    cd $(mktemp -d)

    # download submit
    url=$(echo $1 | sed 's/kelvin://')
    curl -H"Authorization: Bearer $(<~/.config/kelvin/token)" $url | tar xvz

    # uncomment one exec line below:
    #exec gnome-terminal
    #exec code .

    # start in ubuntu container
    #exec gnome-terminal -- docker run --rm -v $PWD:/submit -w /submit -it ubuntu bash

    # start in ubuntu container with X11 forwarding (xhost + or something like that required on your side)
    #exec gnome-terminal -- docker run --rm -v $PWD:/submit -w /submit -v /tmp:/tmp -e DISPLAY=:0 -it ubuntu bash
  5. Make kelvin-open executable

    chmod u+x kelvin-open
  6. Update desktop database

    update-desktop-database ~/.local/share/applications/`