Como configurar putty para que se parezca a la terminal de Guake en linux

Funciona el F12 para plegar desplegar.

Guardas el script como .ahk.

Utilizas la utilidad ahk2exe.exe que viene con el programa autohotkey (facil de descargar e instalar) para convertir el archivo .ahk en archivo .exe. Lo guardas en la carpeta “startup” de windows para que se lance cada vez que el sistema se inicia.

Este es el script:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
DetectHiddenWindows, On ; find me some hidden windows

;load globals (in it’s own sub because these things change over a windows session…
GoSub LoadGlobals
;open putty
GoSub OpenPutty

;graceful exit
OnExit, ExitSub
return

;=============================================================================
; SUBS
;=============================================================================

;Load the globals as requested
LoadGlobals:
;get taskbar stats
WinGetPos, pg_taskbar_X, pg_taskbar_Y, pg_taskbar_W, pg_taskbar_H, ahk_class Shell_TrayWnd

;Size of single line mode
pg_SmallerizedHeight = 25

;User’s screen height
pg_screenHeight = %A_ScreenHeight%
pg_screenWidth = %A_ScreenWidth%

;Size of maximized mode (true guake like)
if !pg_MaxamizedHeight_ISSET
{
pg_MaximizedHeight = %pg_screenHeight%
pg_MaximizedHeight -= 200 ;this is the default, but can be changed with ctrl up/down
pg_MaxamizedHeight_ISSET=1
}

;Spot to position the window in single line mode.
;If the taskbar is up top the stick this at screenheight-smallerizedheight
;otherwise stick this at screenheight-taskbarheight-smallerizedhieght.
pg_smallerized_yPos = %pg_screenHeight%
pg_smallerized_yPos -= %pg_SmallerizedHeight%
If (%pg_taskbar_Y% <> 0){
pg_smallerized_yPos -= %pg_taskbar_H%
}

;Y position of the maximized window.
;If the taskbar is up top, then stick this at taskbar_h
;otherwise stick it at 0
pg_maximized_yPos = 0
If (%pg_taskbar_Y% = 0){
pg_maximized_yPos = %pg_taskbar_H%
}

return

;sub to make it maximize mode
goMax:
pg_isSmall=0
WinMaximize,ahk_pid %pg_pid%
WinActivate
WinMove,ahk_pid %pg_pid%,,0,%pg_Maximized_yPos%,%pg_screenWidth%,%pg_MaximizedHeight%
return

;sub to make it small mode
goSmall:

pg_isSmall=1
WinMaximize,ahk_pid %pg_pid%
WinActivate
WinMove,ahk_pid %pg_pid%,,0,%pg_smallerized_yPos%,%pg_screenWidth%,%pg_SmallerizedHeight%
return

;sub to minimize (was hiding, but that was a pain to manage with puttys full size mode)
goHide:
WinMinimize,ahk_pid %pg_pid%
return

;Open the user specified putty session
OpenPutty:
;pop open putty
Run,”C:\Program Files (x86)\PuTTY\putty.exe” -load “nombre_de_la_sesion” -ssh user@xxx.xxx.xxx.xxx -pw password,,,pg_pid
WinWait ahk_pid %pg_pid% ;give it some time
WinMaximize

;Set transparency before hitting full screen mode. See the autohotkey documentation on WinSet Transparent to understand why.
WinSet,Transparent,210,ahk_pid %pg_pid%

;FULL SCREEN MODE
sendInput !{Enter}

GoSub GoMax

Return

;=============================================================================
; HOTKEYS
;=============================================================================

;Script to change screen height larger
^down::
pg_MaximizedHeight +=40
GoSub goMax
return

;Script to change screen height smaller
^up::
pg_MaximizedHeight -=40
GoSub goMax
return

;Toggle Guake-like maximized. If in single line mode, then maximize.
F12::
;reload globals
GoSub LoadGlobals

IfWinExist ahk_pid %pg_pid%
{
WinGet,pg_MinMax, MinMax, ahk_pid %pg_pid%

if (pg_MinMax=-1)
{
;we have to toggle into the desired mode. This isn’t usually
; the case with normal windows, but we are using
; PuTTY’s full screen mode which is a pain in the ass to manipulate.

goSub GoHide
GoSub GoMax
}
else if (pg_isSmall=1)
{
goSub GoHide
gosub gomax
}
else if (pg_MinMax=0)
{
goSub GoHide
GoSub GoMax

}
else
{
GoSub GoMax
GoSub GoHide
}

}
else
{
GoSub OpenPutty
}
return

;Shrink down to bottom of the screen. Single Line Command Mode BOOYAH!
+F12::
;reload globals
GoSub LoadGlobals

IfWinExist ahk_pid %pg_pid%
{
if pg_isSmall{
GoSub GoMax
} else if pg_isHidden{
GoSub GoSmall
} else {
GoSub GoSmall
}
}
else
{
GoSub OpenPutty
}
return
;Exit Gracefully
ExitSub:
Loop, Parse, pg_IDList, |
{
if A_LoopField = ; First field in list is normally blank.
continue ; So skip it.
StringTrimRight, pg_Height, pg_Window%A_LoopField%, 0
WinMove, ahk_id %A_LoopField%,,,,, %pg_Height%
}
WinActivate,ahk_pid %pg_pid%
SendInput logout{enter}
ExitApp ; Must do this for the OnExit subroutine to actually Exit the script.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s