Run a command to terminal from gedit with shortcut key

Hi guys.
If you working with gedit and terminal this tool is very usefull for run  a command to in the terminal from gedit (previous window).

I wrote a script with gedit external plugin for this purpose.

How to use:
  • Select a text and press "Alt+B" key
    or
  • Locate a cursor to line and press "Alt+L" key
Watch video to see it.


Installation on Ubuntu :

install gedit plugins.
# sudo apt-get install gedit-plugins 
install xdotool.
# sudo apt-get install xdotool

Open gedit ->  Edit -> Preferences -> Enable External Tools plugin.
Open gedit -> Manage External Tools -> click +
paste the script in the below to Edit: box.
#!/bin/sh
cat - > /tmp/runprev_meh.txt
line=$(cat /tmp/runprev_meh.txt)
xdotool key alt+Tab
xdotool sleep 0.2
xdotool type "$line"
xdotool key Return
xdotool key alt+Tab

Select Shortcut Key: <ALT+L>


Click againt +, for another shortcut (run "Current selection"). <ALT+B> 
All is same except "Input: Current selection" and shortcut key.

0 comments:

Post a Comment