Le Getting Started pour utiliser Hammerspoon sur MacOS
What is Hammerspoon?
Hammerspoon is a desktop automation tool for OS X. It bridges various system level APIs into a Lua scripting engine, allowing you to have powerful effects on your system by writing Lua scripts.
C'est super puissant pour controller MacOS.
Quelques examples:
Cmd
, alt
, ctrl
et gauchehs.hotkey.bind({"cmd", "alt", "ctrl"}, "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)
Cmd
, alt
, ctrl
et droitehs.hotkey.bind({"cmd", "alt", "ctrl"}, "Right", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x + (max.w / 2)
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
Cmd
, alt
, ctrl
et S
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "S", function()
hs.spotify.displayCurrentTrack()
end)