Creating a script for key automation

Perhaps the autokey-{qt|gtk} package - the qt and gtk gui depending on current toolkit (Plasma or Gnome)