Skip to content

Instantly share code, notes, and snippets.

@Elliria
Last active January 14, 2025 17:41
Show Gist options
  • Save Elliria/d06633320cf23f2a093519b75f7295b7 to your computer and use it in GitHub Desktop.
Save Elliria/d06633320cf23f2a093519b75f7295b7 to your computer and use it in GitHub Desktop.
AutoKey run in different ways

AutoKey run in different ways

Before you begin

The testing methods below can be done inside of a terminal window on a machine that has AutoKey already installed on it (in fact, that's recommended since it will likely provide you with all of the necessary dependencies in advance).

πŸ›‘ πŸ›‘ πŸ›‘ πŸ›‘ πŸ›‘ πŸ›‘
It's important to note that lthough each instance of AutoKey will be independent, the AutoKey configuration from your installed copy of AutoKey will be used, which means all of these tests will have full access to your phrases and scripts and changes you make to those while testing will affect your installed version of AutoKey as well.
πŸ›‘ πŸ›‘ πŸ›‘ πŸ›‘ πŸ›‘ πŸ›‘

Test AutoKey by cloning the repository

  1. Clone the repository:
    git clone https://github.com/autokey/autokey.git
  2. Change to the autokey subdirectory you just created:
    cd autokey
  3. Change to the lib subdirectory:
    cd lib
  4. Pick one:
    • Run AutoKey GTK:
      python3 -m autokey.gtkui -lc
    • Run AutoKey Qt:
      python3 -m autokey.qtui -lc
  5. When you're finished with this testing session, close AutoKey normally.
  6. If you'd like to get rid of the clone, delete the clone's directory. Otherwise, keep it for further testing.

Test AutoKey by cloning a branch

  1. Pick one:
    • Clone the Beta branch:
      git clone --branch beta --single-branch https://github.com/autokey/autokey.git
    • Clone the Develop branch:
      git clone --branch develop --single-branch https://github.com/autokey/autokey.git
    • Clone the Master branch:
      git clone --branch master --single-branch https://github.com/autokey/autokey.git
  2. Change to the autokey subdirectory you just created:
    cd autokey
  3. Change to the lib subdirectory:
    cd lib
  4. Pick one:
    • Run AutoKey GTK:
      python3 -m autokey.gtkui -lc
    • Run AutoKey Qt:
      python3 -m autokey.qtui -lc
  5. When you're finished with this testing session, close AutoKey normally.
  6. If you'd like to get rid of the clone, delete the clone's directory. Otherwise, keep it for further testing.

Test AutoKey by cloning a fork

  1. Pick one:
    • Clone a fork (replace Elliria with the fork's name):
      git clone https://github.com/Elliria/fork.git
  2. Change to the autokey subdirectory you just created:
    cd autokey
  3. Change to the lib subdirectory:
    cd lib
  4. Pick one:
    • Run AutoKey GTK:
      python3 -m autokey.gtkui -lc
    • Run AutoKey Qt:
      python3 -m autokey.qtui -lc
  5. When you're finished with this testing session, close AutoKey normally.
  6. If you'd like to get rid of the clone, delete the clone's directory. Otherwise, keep it for further testing.

Test AutoKey by cloning a branch and checking out a pull request

  1. Clone the Develop branch:
    git clone --branch develop --single-branch https://github.com/autokey/autokey.git
  2. Change to the autokey subdirectory you just created:
    cd autokey
  3. Fetch the pull request (using its number):
    git fetch origin pull/844/head:pull_844
  4. Check out the pull request (using its number):
    git checkout pull_844
  5. Change to the lib subdirectory:
    cd lib
  6. Pick one:
    • Run AutoKey GTK:
      python3 -m autokey.gtkui -lc
    • Run AutoKey Qt:
      python3 -m autokey.qtui -lc
  7. When you're finished with this testing session, close AutoKey normally.
  8. If you'd like to get rid of the clone, delete the clone's directory. Otherwise, keep it for further testing.

Test Autokey by cloning a branch and checking out a tag (a release)

  1. Clone the Develop branch:
    git clone --branch develop --single-branch https://github.com/autokey/autokey.git
  2. Change to the autokey subdirectory you just created:
    cd autokey
  3. Fetch all of AutoKey's tags:
    git fetch --all --tags --prune
  4. Check out the specified tag by using the tags prefix and the tag's name:
    git checkout tags/v0.96.0
  5. Change to the lib subdirectory:
    cd lib
  6. Pick one:
    • Run AutoKey GTK:
      python3 -m autokey.gtkui -lc
    • Run AutoKey Qt:
      python3 -m autokey.qtui -lc
  7. When you're finished with this testing session, close AutoKey normally.
  8. If you'd like to get rid of the clone, delete the clone's directory. Otherwise, keep it for further testing.

Test AutoKey from a zip file

  1. Download the zip file of any version of AutoKey.
  2. Unzip it into the current directory.
  3. Open the autokey subdirectory you unzipped it into in a terminal window.
  4. Change to the lib subdirectory:
    cd lib
  5. Pick one:
    • Run AutoKey GTK:
      python3 -m autokey.gtkui -lc
    • Run AutoKey Qt:
      python3 -m autokey.qtui -lc
  6. When you're finished with this testing session, close AutoKey normally.
  7. If you'd like to get rid of the clone, delete the clone's directory. Otherwise, keep it for further testing.

Test AutoKey in a virtual environment

The steps below demonstrate using AutoKey in Ubuntu inside of a virtual machine and running AutoKey in the venv virtual environment (see this Debian article and this Ubuntu discussion for why), which only seems to work manually on the command line and not in a shortcut, most likely because the virtual environment needs a shell to create itself in.

Create the virtual environment (this only needs to be done once):

  1. Create a virtual machine (in VirtualBox, for example, with instructions for that here) on your computer.
  2. Install Ubuntu in it.
  3. Boot into the virtual machine.
  4. Install build-essential:
    sudo apt install build-essential
  5. Install pip3:
    sudo apt install python3-pip
  6. Install the cairo development package:
    sudo apt install libcairo2-dev
  7. Install venv:
    sudo apt install python3-venv
  8. Pick one:
    • Clone AutoKey's Master branch in the current directory:
      git clone https://github.com/autokey/autokey.git
    • Clone AutoKey's Develop branch in the current directory:
      git clone --branch develop --single-branch https://github.com/autokey/autokey.git
  9. Change to the cloned autokey directory you created:
    cd autokey
  10. Install any missing packages that are listed in the apt-requirements.txt file:
    grep -vE '^#' apr-requirements.txt | xargs sudo apt install -y
  11. Create a virtual environment:
    python3 -m venv venv
  12. Activate the virtual environment:
    source venv/bin/activate
  13. Install the Python packaging module inside the virtual environment:
    pip install packaging
  14. Install the Python pycairo module inside the virtual environment:
    pip install pycairo
  15. Install AutoKey's pip requirements inside the virtual environment:
    pip install -r pip-requirements.txt
  16. Close AutoKey.
  17. Deactivate the virtual environment:
    deactivate
  18. Close the terminal window.

Run AutoKey in the virtual environment (this can be done from then on):

  1. Open a terminal window.
  2. Pick one, replacing ~/Desktop/autokey with the path to your test copy of autokey below before following the steps, to change to the autokey directory, activate the venv virtual environment, change to the lib subdirectory, and run AutoKey:
    • AutoKey GTK:
      cd ~/Desktop/autokey; source venv/bin/activate; cd lib; python3 -m autokey.gtkui -lc
    • AutoKey Qt:
      cd ~/Desktop/autokey; source venv/bin/activate; cd lib; python3 -m autokey.qtui -lc
  3. When finished, close AutoKey.
  4. Deactivate the virtual environment:
    deactivate
  5. Close the terminal window.
  6. Log out of Ubuntu.

Notes

  • Google recommends using venv in this way if you want to run a file in venv from the command line: <venv-path>/<bin-path>/<executable>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment