After some digging, I managed to find that to get the name of the user's preferred terminal emulator, as set in the 'Default Applications' section of KDE5's settings, one can run this command:
kreadconfig5 --file kdeglobals --group General --key TerminalApplication
In my case (running Manjaro with KDE Plasma 5), this returns the string 'alacritty'.
Thus, wrapping this in
$(...) and typing the resulting command inside a terminal launches the user's preferred terminal emulator (I have tested that this work).
Yet, when I create a custom keyboard shortcut for KDE to run this command with
Meta+Return, nothing happens. I also tried putting
exec in front of it in case it was necessary, but it changed nothing.
If i just set up the shortcut to run the command
alacritty (which is what is returned by the first command I mentioned), then it works, but of course I want to be able to run whatever is the user's preferred terminal, not a specific one.
Can anyone explain to me why it is not working? Am I doing something wrong?