Sending virtual keypresses doesn't work for me (see comments), but that answer inspired me to look for similar solutions. Sending a "text" event with
xvkbd ignores the current state of your physical keyboard:
sh -c 'xsel | xvkbd -xsendevent -file - 2>/dev/null'
xvkbd -text uses a few backslash sequences, so rather than dance with escaping,
-file works. Add
-delay 0 to enter the text without delay between the “keystrokes”.
xvkbd also outputs some warning text about modifiers, but it appears to be irrelevant to this use (but I didn't want to see it in
I bound this to a shortcut using System > Preferences > Keyboard Shortcuts.
Note that you need to have xsel and xvkbd packages installed:
sudo apt-get install xsel xvkbd
Preface: I am new, and having similar problems. In the absence of an answer by someone with a functional knowledge of these things, this is how I am approaching solving this.
'man gnome-terminal' offers some interesting options for starting new windows, or tabs using a specific profile. An alias to start an instance of gnome-terminal in a new tab using profile "X" seems like a reasonable quasi-kluge, and allows for existing keyboard shortcuts to switch between, and close tabs.
It would look something close to this:
alias gtvim='gnome-terminal --tab-with-profile=X -t Vim -x vim >&1'
For alias permanency, it has to be added to bottom of ~/.bashrc
I need to work on other things now, but that was my first foray into it. It still seems to open the command in a new terminal window, but still easily accessible from keyboard shortcuts.
Just as a side note, I am attempting to have all terminals with ssh connections to remote terminals open with a different color profile to help prevent commands being issued to the wrong machine.
Have you tried using Ctrl + Shift + V