Startup Script Using XdoTool

13 / Nov / 2010 by Hitesh Bhatia 0 comments

(Xdotool is a tool that simulates user key movements.)


Usually when we start to work , we usually require some apps to be running. In my case I have to run a grails app, sql , subversion and IDE in different tabs of same terminal.


Normally it would take almost 1-2 minutes if I do it manually.So I created a shell script using Xdotool .And it does all my work in almost 2 seconds. And All the tabs are opened in same terminal).Best part with xdotool is since it simulates key all your aliases work.


And it works perfectly on Ubuntu 10.10. (Tried and Tested)

Here is a snippet of script that I created.

xdotool key alt+t space;
xdotool type "etc";
xdotool key Return;
xdotool key ctrl+t alt+t space;
xdotool type "grails";
xdotool key Return ;
.
.
.
xdotool key ctrl+t alt+t space;
xdotool type "sql";
xdotool key Return;
xdotool type "mysql";
xdotool key Return

This opens new tab of same terminal.

1)xdotool key alt+t space;
The “key” keyword” tells xdotool that next inputs are treated as keys. So it opens “set title” pop up.(As Alt+t and space would do)


2)xdotool type “etc”;
xdotool key Return;

The “type” keyword tells that the next inputs are treated as text.And then enter key is simulated
Hence naming my tab “etc”


3)xdotool key ctrl+t alt+t space;
Opens new tab (I made ctrl+t shortcut for opening new tab in same terminal) and opens “set title” pop up


4)xdotool type “grails”;
And the tab is named as grails. And So on..


This helps me save time. hope it helps you too.

_________________________________
Hitesh Bhatia

Mail

LinkedIn,Facebook,Twitter

_________________________________

FOUND THIS USEFUL? SHARE IT

Leave a Reply

Your email address will not be published. Required fields are marked *