トップ/記事一覧

画面分割用アプリケーションを Shiftit から Hammerspoon に乗り換えた

📆2022/06/27

表題のとおりだが、Hammerspoon というアプリケーションを導入した。Hammerspoon は、Lua でスクリプトを書くことで、MacOS に操作を使えるというもので、無料で使用可能。画面分割用というよりは、色々な設定がスクリプトで書けるよっていうアプリケーション。

乗り換えたきっかけ

Shiftit がとにかく不安定になってしまったからというのが一番の大きな理由。ここ5年間くらいはずっと動き続けてくれていたのだけれども、MacOS を Monterey にアプデしてからは動作が不安定になってしまっていた。メンテナンスも2018年で止まってしまっている。

ちなみに、メンテが止まった理由が面白い(本当かは分からないけど)

設定 Lua ファイル

ウルトラワイドモニタを使っていて、画面を3分割したいなと思っていたので、以下のような3分割スクリプトを書いた。少し書き換えれば2分割をしたり、上限分割したりも可能。もしよければ参考にどうぞ。

lua

hs.window.animationDuration = 0 units = { right50 = { x = 0.50, y = 0.00, w = 0.50, h = 1.00 }, left50 = { x = 0.00, y = 0.00, w = 0.50, h = 1.00 }, top50 = { x = 0.00, y = 0.00, w = 1.00, h = 0.50 }, bot50 = { x = 0.00, y = 0.50, w = 1.00, h = 0.50 }, -- 画面3分割設定 right33 = { x = 0.66, y = 0.00, w = 0.34, h = 1.00 }, left33 = { x = 0.00, y = 0.00, w = 0.33, h = 1.00 }, center33 = { x = 0.33, y = 0.00, w = 0.33, h = 1.00 }, } mash = { 'option', 'shift', 'command' } hs.hotkey.bind(mash, 'right', function() hs.window.focusedWindow():move(units.right33, nil, true) end) hs.hotkey.bind(mash, 'left', function() hs.window.focusedWindow():move(units.left33, nil, true) end) hs.hotkey.bind(mash, 'up', function() hs.window.focusedWindow():move(units.center33, nil, true) end)