Silly Bytes has moved - Silly Bytes se trasladó

www.sillybytes.net

4 nov. 2015

Ratpoison: E.T. phone home

This is the third post about the Ratpoison window manager.

This one is no a productivity improvement, nor a do-more-with-less feature, but a playful way to achieve a pretty common task: SSH to my home lab.

Remember that scene in E.T. in which he says: "ET phone home" and points with his finger to the sky? Well...



When i hit C-t E this pops up in my screen:




Then a new tmux window is opened with a SSH connection to my home lab.
 
This is achieved using the xcowsay program and its ability to use a custom image, in this case:






Using the following Ratpoison configuration snippet:

    bind E exec et_phone_home.sh


This snippet appears in my .ratpoisonrc file that you can read entirely here

The et_phone_home.sh scripts do the following:

- Show the E.T image with the "ET phone home..." message
- Switch to terminal emulator window
- Create a new tmux window with the SSH connection


The ET image is displayed using xcowsay:

    xcowsay --image et.png "ET phone home..." --think


Then switch to the terminal emulator window (urxvt in my case):

    ratpoison -c "select urxvt"


Or using the script I use for this purpose:

app_select.sh terminal

And finally create a new tmux window with the SSh connection:

    tmux new-window -c ~ -n "ssh_connection" ssh $IP


The script depends on xcowsay
And you can get it from my Dotfiles

To try it out be sure to define your Ratpoison bindings referencing the right location of the script.