296 points · by tosh · 10y ago · 63 comments
I think it's the best of these type of projects, and would love to see more people using it / developing and sharing scripts.
One thing i couldn't replicate yet in hammerspoon (among other things) is clicking: https://wiki.keyboardmaestro.com/action/Find_Image_on_Screen incredibly useful
- switch recipients in Franz.app
- click on menubar items
- import current page into devonthink (requires a click on a toolbar item to start the automation)
- toggle flux (click on menubar item and go down etc)
- adding tags in delibar (click on the Nth suggested tag)
- click on toolbar items in all possible apps when there is no keyboard shortcut/menu item availableiTerm2's hotkey is pretty terrible in my opinion. I've bound this function to make it work for me:
function iTermHotkeyHandler()
local iterm = hs.application.get('iTerm2')
if (iterm) then
local window = iterm:mainWindow()
if not window then
if iterm:selectMenuItem('New Window') then
window = iterm:mainWindow()
end
return
end
if iterm:isFrontmost() then
iterm:hide()
else
window:focus()
end
end
end
hs.hotkey.bind('cmd', 'space', iTermHotkeyHandler)
*me: I really should put these in some gist somewhere. function muteSpotifyOnAd()
if (hs.spotify.isRunning()) then
if (hs.spotify.getCurrentTrack():lower() == 'spotify') then
hs.spotify.setVolume(0)
else
hs.spotify.setVolume(100)
end
end
end
hs.timer.doEvery(10, muteSpotifyOnAd)- Hyper-1 through 5 to defer tasks in OmniFocus (calls out to an external script).
- Hyper-W to lock my screen.
- Hyper-M to mute skype microphone.
- Hyper-[C,T,X,F] to focus Chrome, TaskPaper, nvAlt and iTerm.
Did you forget to include some extra constraint? As written, it looks like the answer to your question is "Yes, Hammerspoon."
Just now quickly whipped it together. Needs improvement(error handling and asynchronous downloading) and packages.
HN submission: https://news.ycombinator.com/item?id=13051347
I use dzen2: https://github.com/robm/dzen
Xmobar is another popular one: http://projects.haskell.org/xmobar
I recommand getting the polybar clone by jaagr
I wouldn't want such a distraction on screen at all time though.
But hey, security schemurity.
AnyBar 32770 --- 14u IPv4 0x---------------- 0t0 UDP *:1738
AnyBar 32770 --- 15u IPv6 0x---------------- 0t0 UDP *:1738
(The `nc` command in the example is directed at localhost, but that doesn't imply that the app is bound to localhost only, just that it's bound to at least that.)Unix sockets are a better fit for this sort of thing, as they can be by default restricted to your user, and optionally opened up to others. (i.e., Unix sockets are authenticated) You can always do both (implement Unix sockets and Internet sockets).
Even binding to localhost in general is not completely safe, if a webpage or other apps can be fooled into making the right request. (I think UDP is safe here, but who knows.)
Out of curiosity, anyone know what the hammer and sickle icon is for in the screenshot?
*edit for grammar
Edit: nope. It listens on all interfaces. At least an attack can only maliciously change your menubar colour.