LoginSignup
1
1

More than 1 year has passed since last update.

Hammerspoon で ShiftIt なウィンドウ制御

Last updated at Posted at 2022-05-23
  1. 公式サイトからHammerspoonをダウンロードし、~/Applications ディレクトリへドラッグアンドドロップ
  2. Hammerspoonを起動し、メニューバーアイコン -> Preferences...
  3. 「Launch Hammerspoon at login」をチェックする
  4. 「Enable Accesibility」を押して、Macの設定からHammerspoonにアクセス権を与える
  5. キーバインドを設定
~/.hammerspoon/init.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 },
  righttop      = { x = 0.50, y = 0.00, w = 0.50, h = 0.50 },
  lefttop       = { x = 0.00, y = 0.00, w = 0.50, h = 0.50 },
  rightbot      = { x = 0.50, y = 0.50, w = 0.50, h = 0.50 },
  leftbot       = { x = 0.00, y = 0.50, w = 0.50, h = 0.50 },
  maximum       = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 }
}

mash = { 'ctrl', 'cmd' }
hs.hotkey.bind(mash, 'right', function() hs.window.focusedWindow():move(units.right50, nil, true) end)
hs.hotkey.bind(mash, 'left', function() hs.window.focusedWindow():move(units.left50, nil, true) end)
hs.hotkey.bind(mash, 'up', function() hs.window.focusedWindow():move(units.top50, nil, true) end)
hs.hotkey.bind(mash, 'down', function() hs.window.focusedWindow():move(units.bot50, nil, true) end)
hs.hotkey.bind(mash, 'i', function() hs.window.focusedWindow():move(units.righttop, nil, true) end)
hs.hotkey.bind(mash, 'u', function() hs.window.focusedWindow():move(units.lefttop, nil, true) end)
hs.hotkey.bind(mash, 'k', function() hs.window.focusedWindow():move(units.rightbot, nil, true) end)
hs.hotkey.bind(mash, 'j', function() hs.window.focusedWindow():move(units.leftbot, nil, true) end)
hs.hotkey.bind(mash, 'm', function() hs.window.focusedWindow():move(units.maximum, nil, true) end)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1