Saturday, March 13, 2010

iTermとMacVimのWindowの透過度をkeyboard shortcutで変える

iTerm
  1. apple scriptで以下のようなtransparency_to05.scptとtransparency_to3.scptを書く
  2. /Users/keyes/Library/Application Support/iTerm/Scripts/にそれらを置く(folderが無ければ作る)。そうするとiTermにスクリプトメニューが現れる
  3. Preference/keyboardの設定でshortcutを割り当てる
transparency_to05.scpt
tell application "iTerm"
    activate
    tell current session of the last terminal
          set transparency to "0.05"
    end tell
end tell

ちなみにapplescript で引数を渡すには以下のようにする
ほんとうはこれに引数を渡したものをセットしたい

on run argv
  tell application "iTerm"
      activate
      tell current session of the last terminal
          set transparency to item 1 of argv
      end tell
  end tell
end run

MacVim
  1. .gvimrcに以下を追加
map + :set transparency+=10<CR>
map ; :set transparency-=10<CR>

No comments: