Your gnome-terminal (actually the underlying vte-0.34) emits the wrong sequence for ctrl+Alt+space. The bug (https://bugzilla.gnome.org/show_bug.cgi?id=710349) was fixed in vte-0.36.
If you're not afraid of hacking a little bit and you're able to safely revert things in case of trouble, you can try to install vte-0.36 on your Ubuntu 14.04. You'll get many other fixes and improments along with this one. You might find a PPA or a package in Gnome3 staging, or compile it for yourself. Upgrading to this version of vte doesn't require touching any other software components. A complete restart of gnome-terminal is required (close all the windows).
Here's how I just did it:
I added this to .bash_profile
# Only do this in the first terminal opened
termsOpen=$(who | grep 'ttys' | wc -l)
if (( $termsOpen < 2 )); then
echo "This is echoed in the first tty opened only"
fi
So, upon launching the terminal the first time, I get this output:
Last login: Mon Sep 26 08:30:42 on ttys001
This is echoed in the first tty opened only
When I open another terminal (and thus have two terminal windows open at the same time) I get this output:
Last login: Mon Sep 26 08:33:43 on ttys000
How it works:
Every time a new terminal window is opened .bash_profile
is sourced.
This command
who | grep 'ttys' | wc -l
simply counts the number of terminal windows that are open. If they are lower than 2 (in other words; there is only one terminal window active), then echo This is echoed in the first tty opened only
Version info:
OS X Version: 10.11.5
bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Best Answer
This shell script should handle the starting and stopping of any program:
let's say you saved it under
~/mystarter
, you can run any command with it using~/mystarter <name>
, eg in your case, bind Meta+R to:and make sure the script is executable:
chmod u+x ~/mystarter
. Also it's probably best to put it somewhere in yourPATH
, so you don't have to type it's full location every time.As for the fact that
gnome-run
doesn't show up inps -A
, make sure that gnome run itself isn't a script that launches the actual process. Check if there is a difference betweenps -A | wc -l
before and after launching it (this counts all running processes).Edit:
Since you've accepted the answer, I thought I'd add support for running commands that have commandline arguments, so that this might become a place of reference. Run a command like so:
eg:
The command just looks up
ncmpcpp
to see if it's running already, but executes the full command (with arguments) whenncmpcpp
wasn't running.