u16suzuの blog

日々学んだことのメモブログです。

atomのタブやfuzzy-finderなどのフォントサイズを一括で変更するbash script

仕事でノートPCをモニタにつないだり、ノートPC本体だけで使ったりすることがあり、

atomの編集部分以外のフォントサイズを手軽に一括で変更したくて書いた。

### change atom font size
atom_font() {
  cd ~/.atom/styles
  case "$1" in
    "pc" )
      ln -sfv font_pc.less font.less;;
    "monitor" )
      ln -sfv font_monitor.less font.less;;
    * )
      echo "please specify 'pc' or 'monitor'"
  esac
  pops
}

各環境ごとのフォントサイズをファイルに書いておく。

今回は .atom/stylesにファイルを作成した。

$ cat styles/font_pc.less
@font_size: 15px; // PC

$ cat styles/font_monitor.less
@font_size: 20px; // monitor

atomstyles.less 側では @import しておく。

@import "./styles/font.less";

// Font size
// 検索結果, 検索タブ, タブのタイトル
body, html, .panel-heading, .title, .file.entry, .directory.entry {
  font-size: @font_size;
}
.fuzzy-finder {
  font-size: @font_size;
}
.command-palette {
  font-size: @font_size;
}

pc モード

フォントサイズ15px

f:id:u16s:20161124014350p:plain

monitor モード

フォントサイズ20px

f:id:u16s:20161124014338p:plain