396 lines · 8.9 KB
local hotkey = require("hs.hotkey")
local fzy = require("fzy")

-- Alerts
hs.alert.defaultStyle.fillColor = { hex = "#151618" }
hs.alert.defaultStyle.padding = 30
hs.alert.defaultStyle.radius = 8
hs.alert.defaultStyle.strokeColor = { hex = "#4F5053" }
hs.alert.defaultStyle.strokeWidth = 0
hs.alert.defaultStyle.textStyle = {
	font = { name = "JetBrains Mono", size = 14, color = { hex = "#F2F2F2" } },
	paragraphStyle = { lineHeightMultiple = 1.4 },
}
hs.alert.show("Hammerspoon Loaded", 2)

-- Disable animations
hs.window.animationDuration = 0

-- Window management
do
	local halfModifiers = { "alt", "ctrl", "cmd" }
	local quarterModifiers = { "shift", "alt", "ctrl" }

	-- Left
	hotkey.bind(halfModifiers, "left", function()
		local win = hs.window.focusedWindow()
		local f = win:frame()
		local screen = win:screen()
		local max = screen:frame()

		f.x = max.x
		f.y = max.y
		f.w = max.w / 2
		f.h = max.h
		win:setFrame(f)
	end)

	-- Right
	hotkey.bind(halfModifiers, "right", function()
		local win = hs.window.focusedWindow()