How to configure opening apps by shortcuts in KDE

If you want to do something similar to what Hammerspoon does on Mac or Autohotkey on Windows, then this post is for you.