One App To Rule Them All

Twitter: @krzkot

Github: lis2

Email: kotlarek.krzysztof@gmail.com

This is a tool for powerful automation of OS X

Move


    function moveLeft()
      local win = hs.window.focusedWindow()
      if win then
        local f = win:frame()
        local max = win:screen():frame()
    
        f.x = max.x + padding
        f.y = max.y + padding + padding_top
        f.w = max.w / 2 - 2 * padding
        f.h = max.h - 2 * padding - padding_top
        win:setFrame(f)
      end
    end

    hs.hotkey.bind({"cmd", "alt"}, "Left", function()
      moveLeft()
    end)
      

Lunch or focus


    hs.hotkey.bind({"alt"}, "b", function()
      hs.application.launchOrFocus('/Applications/Google Chrome.app')
    end)
    hs.hotkey.bind({"alt"}, "k", function()
      hs.application.launchOrFocus('/Applications/Slack.app')
    end)
    hs.hotkey.bind({"alt"}, "p", function()
      hs.application.launchOrFocus('/Applications/Spotify.app')
    end)
      

Control spotify or itunes


    hs.hotkey.bind({"alt"}, ";", function()
      hs.spotify.previous()
    end)
    hs.hotkey.bind({"alt"}, "'", function()
      hs.spotify.next()
    end)
    hs.hotkey.bind({"alt"}, "\\", function()
      hs.spotify.displayCurrentTrack()
    end)
      

Control volume


    hs.hotkey.bind({"alt"}, "[", function()
      output = hs.audiodevice.defaultOutputDevice()
      output:setMuted(false)
      output:setVolume(output:volume() - 10)
    end)
    hs.hotkey.bind({"alt"}, "]", function()
      output = hs.audiodevice.defaultOutputDevice()
      output:setMuted(false)
      output:setVolume(output:volume() + 10)
    end)
      

    function muteOnWake(eventType)
      if (eventType == hs.caffeinate.watcher.systemDidWake) then
        local output = hs.audiodevice.defaultOutputDevice()
        output:setMuted(true)
      end
    end
    caffeinateWatcher = hs.caffeinate.watcher.new(muteOnWake)
    caffeinateWatcher:start()
      

    hs.hotkey.bind({"cmd", "alt"}, "V", function() hs.eventtap.keyStrokes(hs.pasteboard.getContents()) end)
      

    coffeeShopWifi = "Baristartisan_Guest"
    lastSSID = hs.wifi.currentNetwork()
    wifiWatcher = nil
    
    function ssidChanged()
        newSSID = hs.wifi.currentNetwork()
    
        if newSSID == coffeeShopWifi and lastSSID ~= coffeeShopWifi then
            -- We have arrived at the coffee shop
            hs.messages.iMessage("iphonefriend@hipstermail.com", "Hey! I'm at Baristartisan's, come join me!")
            hs.messages.SMS("+1234567890", "Hey, you don't have an iPhone, but you should still come for a coffee")
        end
    end
    
    wifiWatcher = hs.wifi.watcher.new(ssidChanged)
    wifiWatcher:start()
      

hs.noises

hs.drawing

hs.battery

hs.brightness

hs.caffeinate

hs.dialog

hs.dockicon

hs.http

hs.menubar

hs.usb

hs.task

hs.wifi

Spoons

HeadphoneAutoPause

ToggleSkypeMute

https://github.com/pasiaj/Translate-for-Hammerspoon

http://railspoint.com/hammerspoon

Thank you