Live data from Hacker News

Hammerspoon – Lua-based powerful tool automation of macOS

hammerspoon.org

41–50 of 84 posts

Re: Hammerspoon – Lua-based powerful tool automation of macOS

#41
post #39

Earlier quoted context omitted.

Another fun thing you can do is install Hammerspoon as your URL handler, and make certain URLs open in different Chrome profiles--any work websites open in my work Chrome profile, websites related to a game I play opens in a Chrome profile specific to that, and anything else opens up in a personal Chrome profile. I've also setup cmd+shift+1/2/3 to brings the aforementioned profiles into the foreground, so e.g. cmd+sh…

I've wanted to send YouTube links directly to VNC for ages, while having all others open in the default browser, but have never taken the time to hack up a listener. I already use Hammerspoon, so this should be a piece of cake to add. Thanks for mentioning this ability!

I believe this is the implementation I based mine on: https://github.com/zzamboni/dot-hammerspoon/blob/master/init...

Re: Hammerspoon – Lua-based powerful tool automation of macOS

#42
post #39

Earlier quoted context omitted.

I've wanted to send YouTube links directly to VNC for ages, while having all others open in the default browser, but have never taken the time to hack up a listener. I already use Hammerspoon, so this should be a piece of cake to add. Thanks for mentioning this ability!

I believe this is the implementation I based mine on: https://github.com/zzamboni/dot-hammerspoon/blob/master/init...

Awesome. Again, thanks!

Re: Hammerspoon – Lua-based powerful tool automation of macOS

#43

I fell briefly in love with Hammerspoon, but stopped using it. My MacOS automation is now my QMK keyboard calling Alfred workflows; I use Yabai for window management. I admire Lua, but ran into some sharp edges learning to program in it. Still, one can get up to speed quickly if one knows other scripting languages. Hammerspoon window management was deathly slow. Yabai is close to instantaneous.

Lua is nothing but sharp edges and gotchas. I hate Lua more than I hate JavaScript.

Re: Hammerspoon – Lua-based powerful tool automation of macOS

#46

I fell briefly in love with Hammerspoon, but stopped using it. My MacOS automation is now my QMK keyboard calling Alfred workflows; I use Yabai for window management. I admire Lua, but ran into some sharp edges learning to program in it. Still, one can get up to speed quickly if one knows other scripting languages. Hammerspoon window management was deathly slow. Yabai is close to instantaneous.

Doesn’t Yabai require disabling SIP?

Re: Hammerspoon – Lua-based powerful tool automation of macOS

#47
post #2

Really nice at first sight. I'm getting melancholic vibes of AutoHotKey reading the docs, which was arguably my first entry into professional programming. Knowing nothing about coding, I built a service desk automation back then — with (network file-) shared hotkeys and a real GUI, all in one single file... good times. Anyway, ever since switching to MacOS more than a decade ago, I've always been searching for an AHK…

Was in the same boat 10 years ago. In my quest to replace AHK on MacOS, Hammerspoon is where I ended up. It's great.

Re: Hammerspoon – Lua-based powerful tool automation of macOS

#48

I fell briefly in love with Hammerspoon, but stopped using it. My MacOS automation is now my QMK keyboard calling Alfred workflows; I use Yabai for window management. I admire Lua, but ran into some sharp edges learning to program in it. Still, one can get up to speed quickly if one knows other scripting languages. Hammerspoon window management was deathly slow. Yabai is close to instantaneous.

I’ve never had any problem with latency when using Hammerspoon for window management.

Re: Hammerspoon – Lua-based powerful tool automation of macOS

#49

I love Hammerspoon. It's one of the first must-have-for-a-usable-laptop tools I set up when I get a new MacBook. Here are the top ways I'm using it right now: 1) Hide/show apps similar to how iTerm lets you bind a hotkey to hide/show a terminal. I've got ctrl+space set to Vimcal, alt+space set to midnight.app (a time tracker I'm building), and ctrl+alt+space set to Things. 2) Start/stop playing my work playlist of lo…

Semicolon actually seems pretty awesome as an extra modifier key. Will give that a go in QMK, ty!

Re: Hammerspoon – Lua-based powerful tool automation of macOS

#50
Love Hammerspoon, I have a small snippet to store bookmarks. I copy the url, open the shortcut, add tags and it is saved to sql lite file.

  local function insertDB(db, linkval, value)
    local url = tostring(linkVal)
    local categ = tostring(value)
  db:exec[=[
           INSERT INTO bookmarks VALUES (NULL,`url`,`categ`) 
    ]=]
   end


  hs.hotkey.bind({"alt", "ctrl"}, "S", function()
    db = hs.sqlite3.open('/dropbox/user/bookmarks.db')
    local insert_stmt = assert( db:prepare("INSERT INTO 
  bookmarks VALUES (NULL, ?, ?)") )

  local url = hs.pasteboard.getContents()

  local tag, value = hs.dialog.textPrompt(url, "Please enter 
  category:");

  if tag == 'OK' then
  insert_stmt:bind_values(url, value)
  insert_stmt:step()
  insert_stmt:reset()
  -- insertDB(db, linkVal, value) 
 end
end)
Post reply on HN