Skip to content

Instantly share code, notes, and snippets.

@jbfriedrich
Created April 18, 2021 11:27
Show Gist options
  • Save jbfriedrich/6021f6aef91275eb5db2a1fcf55d581f to your computer and use it in GitHub Desktop.
Save jbfriedrich/6021f6aef91275eb5db2a1fcf55d581f to your computer and use it in GitHub Desktop.

Revisions

  1. jbfriedrich created this gist Apr 18, 2021.
    93 changes: 93 additions & 0 deletions init.lua
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,93 @@
    --------------------------------------------------------------------------------
    -- Hammerspoon config to replace parts of Mosaic
    --
    -- References:
    -- * https://www.hammerspoon.org/go/
    -- * https://www.hammerspoon.org/docs/index.html
    --------------------------------------------------------------------------------


    hs.hotkey.bind({"cmd", "alt", "ctrl"}, "n", function()
    local win = hs.window.focusedWindow()
    local f = win:frame()
    local screen = win:screen()
    local max = screen:frame()
    f.w = 1280
    f.h = 800
    f.x = ((max.w - f.w) / 2) + max.x
    f.y = ((max.h - f.h) / 2) + max.y
    win:setFrame(f)
    end)

    hs.hotkey.bind({"cmd", "alt", "ctrl"}, "p", function()
    local win = hs.window.focusedWindow()
    local f = win:frame()
    local screen = win:screen()
    local max = screen:frame()
    f.w = 1920
    f.h = 1080
    f.x = ((max.w - f.w) / 2) + max.x
    f.y = ((max.h - f.h) / 2) + max.y
    win:setFrame(f)
    end)

    hs.hotkey.bind({"cmd", "alt", "ctrl"}, "b", function()
    local win = hs.window.focusedWindow()
    local f = win:frame()
    local screen = win:screen()
    local max = screen:frame()
    f.w = 1024
    f.h = 600
    f.x = ((max.w - f.w) / 2) + max.x
    f.y = ((max.h - f.h) / 2) + max.y
    win:setFrame(f)
    end)

    hs.hotkey.bind({"cmd", "alt", "ctrl"}, "f", function()
    local win = hs.window.focusedWindow()
    local f = win:frame()
    local screen = win:screen()
    local max = screen:frame()
    f.w = 1050
    f.h = 800
    f.x = ((max.w - f.w) / 2) + max.x
    f.y = ((max.h - f.h) / 2) + max.y
    win:setFrame(f)
    end)

    hs.hotkey.bind({"cmd", "alt", "ctrl"}, "]", function()
    local win = hs.window.focusedWindow()
    local f = win:frame()
    local screen = win:screen()
    local max = screen:frame()
    f.w = 570
    f.h = 900
    f.x = ((max.w - f.w) / 2) + max.x
    f.y = ((max.h - f.h) / 2) + max.y
    win:setFrame(f)
    end)

    hs.hotkey.bind({"cmd", "alt", "ctrl"}, "[", function()
    local win = hs.window.focusedWindow()
    local f = win:frame()
    local screen = win:screen()
    local max = screen:frame()
    f.w = 570
    f.h = 478
    f.x = ((max.w - f.w) / 2) + max.x
    f.y = ((max.h - f.h) / 2) + max.y
    win:setFrame(f)
    end)

    hs.hotkey.bind({"cmd", "alt", "ctrl"}, "\\", function()
    local win = hs.window.focusedWindow()
    local f = win:frame()
    local screen = win:screen()
    local max = screen:frame()
    local fullscreen = screen:fullFrame()
    f.w = 663
    f.h = (max.h * 0.85)
    f.x = max.w - (f.w * 1.025)
    f.y = ((max.h - f.h) / 2) + max.y
    win:setFrame(f)
    end)