Skip to content
Tyler Mandry edited this page Jul 5, 2015 · 2 revisions
wm = require('wm')
layout = require('wm.layout')
local utils = require('wm.utils')

local direction   = utils.direction
local orientation = utils.orientation

function l() return wm.controller.screenLayout end
function w() return wm.controller.screenLayout:selectedWorkspace() end

hs.hotkey.bind({'alt'}, 'h', function() w():focus(direction.left) end)
hs.hotkey.bind({'alt'}, 'j', function() w():focus(direction.down) end)
hs.hotkey.bind({'alt'}, 'k', function() w():focus(direction.up) end)
hs.hotkey.bind({'alt'}, 'l', function() w():focus(direction.right) end)

hs.hotkey.bind({'alt'}, 'a', function() w():selectParent() end)
hs.hotkey.bind({'alt'}, 'd', function() w():selectChild() end)
hs.hotkey.bind({'alt', 'shift'}, 'f', function() w():showFocus() end)
hs.hotkey.bind({'alt', 'shift'}, 'q', function() w():closeSelected() end)

hs.hotkey.bind({'alt', 'shift'}, 'h', function() w():move(direction.left) end)
hs.hotkey.bind({'alt', 'shift'}, 'j', function() w():move(direction.down) end)
hs.hotkey.bind({'alt', 'shift'}, 'k', function() w():move(direction.up) end)
hs.hotkey.bind({'alt', 'shift'}, 'l', function() w():move(direction.right) end)

hs.hotkey.bind({'alt'}, 'y', function() w():resize(direction.left, 0.1) end)
hs.hotkey.bind({'alt'}, 'u', function() w():resize(direction.down, 0.1) end)
hs.hotkey.bind({'alt'}, 'i', function() w():resize(direction.up, 0.1) end)
hs.hotkey.bind({'alt'}, 'o', function() w():resize(direction.right, 0.1) end)
hs.hotkey.bind({'alt', 'shift'}, 'y', function() w():resize(direction.left, -0.1) end)
hs.hotkey.bind({'alt', 'shift'}, 'u', function() w():resize(direction.down, -0.1) end)
hs.hotkey.bind({'alt', 'shift'}, 'i', function() w():resize(direction.up, -0.1) end)
hs.hotkey.bind({'alt', 'shift'}, 'o', function() w():resize(direction.right, -0.1) end)

hs.hotkey.bind({'alt'}, 's', function() w():setMode(layout.mode.stacked) end)
hs.hotkey.bind({'alt'}, 't', function() w():setMode(layout.mode.tabbed) end)
hs.hotkey.bind({'alt'}, 'e', function() w():setMode(layout.mode.default) end)

hs.hotkey.bind({'alt'}, 'x', function() l():addWindow(hs.window.focusedWindow()) end)
hs.hotkey.bind({'alt', 'cmd'}, 'x', function() l():removeWindow(hs.window.focusedWindow()) end)
hs.hotkey.bind({'alt', 'shift'}, 'space', function() w():toggleFloating() end)
hs.hotkey.bind({'alt'}, 'space', function() w():toggleFocusMode() end)

hs.hotkey.bind({'alt'}, 'f', function() w():toggleFullscreen() end)

hs.hotkey.bind({'alt'}, 'z', function() wm.tracker:stop() end)
hs.hotkey.bind({'alt', 'shift'}, 'z', function() wm.tracker:start() end)

hs.hotkey.bind({'alt'}, '-', function() w():splitCurrent(orientation.vertical) end)
hs.hotkey.bind({'alt'}, '\\', function() w():splitCurrent(orientation.horizontal) end)

hs.hotkey.bind({'shift', 'alt'}, 's', function() hs.spotify.displayCurrentTrack() end)

Clone this wiki locally