DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

用Autohotkey让Kitty命令行变得更好用


解决Kitty命令行中无法使用右侧Alt键问题

在ahk脚本里增加如下代码:

#IfWinActive ahk_class KiTTY
RAlt::LAlt
#IfWinActive

#IfWinActive使用方法参考#IfWinActive:

The #IfWin directives are positional: they affect all hotkeys and hotstrings physically beneath them in the script. ... To turn off context sensitivity, specify any #IfWin directive but omit all of its parameters.

PS: 下面的代码通过快捷键Ctrl-Alt-l,将当前窗口的ahk_class值显示在对话框中:

!^l::
  WinGetClass, class, A
  MsgBox, The active window's class is "%class%".
Return

参考WinGetClass.

PPS: 关于右侧Alt键不能工作的原因, 是由于Putty将它定义成了AltGr键, 这个键主要用于法语(及其他欧洲语言)键盘上,按住AltGr同时输入字母, 可以直接输入一些特殊字母,例如欧元符号等。

PPPS: AutoHotkey中的块注释为 /* ... */.

P4S: Kitty在Windows 10上的配置文件是 C:\Users\lee_c\AppData\Roaming\KiTTY\kitty.sav文件。

kitty自动识别

下面的脚本实现Win+K键激活一个输入框,给出了kitty命令行常用的几种格式, 基本可分为两种:连接保存好的模板(session)和完全手工连接, 前者用-load加Session名称,后者需要在命令行中写上详细的连接参数。

#k:: ; telnet/ssh client: console style 
  InputBox, myInp, Connect,
  (
   Input Connect Params:
   Load a session: <kitty >-load 47
   SSH Connection: <kitty >user@10.0.2.47 -pw myPwd
   Telnet/Raw:  <kitty >-telnet/raw user@goduserver

   With a auto-run script: <kitty >user@10.0.2.47 -pw myPwd -m f:\myjob
  )
  if ErrorLevel
    return
  else
    Run, d:\apps\Kitty\kitty_portable.exe %myInp%
return


Published

Jan 10, 2013

Last Updated

Jan 10, 2013

Category

Tech

Tags

  • kitty 3
  • putty 3
  • windows 67

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor