
It’s time to set up some shortcuts that use Hyper in order to ease window management.
Hammerspoon app install#
Then, install this karabiner configuration.Īlternatively, you can download this file and add it by hand to the complex modifications section of That way, we can user Hyper and Escape on the same key, without them interfering. We are going to do that too–but only when tapped. Vim users often remap caps lock to Escape to save their pinky finger some pain. My primary use for Hyper is machine-global shortcut keys,Įspecially for window management with Hammerspoon. We can effectively create a new modifier key. Since no sane application will expect a user to hold all those keys at once, We can make use of Steve Losh’s idea of emulating the extra “Hyper” key introducedīy the Space Cadet keyboard by defining Hyper as control+option+command+shift. Having an extra modifier key open for whatever we want. 1: The “Hyper” key + transform Caps Lock into Escape Some of these improvements require extra software,Īnd there’s a section at the bottom to set that up when needed. Handful of high-value improvements that can go a long way without hours of investment. The time you can spend on this is virtually unbounded,īut I have found there are a few tricks that many people miss-a So it’s worth spending a little time improving common workflows now and then. Hope you found this useful.Software developers spend hour after hour on their machines, I brought this up in Hammerspoon's github issue for Spotify save support and some fine folks (thanks and helped me put it all together. Spotify has chosen to leave the keyboard shortcut undocumented.

One of the challenges was finding the keyboard shortcut to save the song. Do note that if the song is already saved, it will be removed from the library. Whenever this hotkey is pressed, the currently playing song will be saved to your Spotify library (under the liked songs playlist). Here lies the magic: the hs.eventtap.keyStroke method can pass key strokes to an application without having to switch focus to the app! The function finds the spotify app from the list of available applications using the hs.application.find method and passes the ⌥ + ⇧ + b keyboard shortcut to the app. The anonymous function describes what we want to do when the combination ( ⌘ + ⌥ + ⌃ + l in my case) is pressed. The hs.hotkey.bind function takes three parameters, a set of modifier keys, a regular key and an anonymous function.
Hammerspoon app code#
This is the piece of code that configures the hotkey: - save/remove from library currently playing song on spotify Hammerspoon stores it's configuration at $HOME/.hammerspoon/a. So, let's get started with building our function instead! If you had a chance to look at the Hammerspoon documentation, you might've seen that they already provide extensions to interact with Spotify but unfortunately it doesn't have a method to save the currently playing song. If you're unfamiliar with Lua, check out the Learn X in Y minutes tutorial for a quick introduction. I would highly recommend checking out their Getting Started guide to get a feel of the API and some sample use cases. It's an automation framework for macOS that provides a Lua scripting environment and extensions to interact with the operating system and few common applications. The solution was to build a global hotkey to save the song and that's when I discovered Hammerspoon.

I tend to listen to the playlist when I'm programming and having to switch to the app to save the song breaks my flow state. If I find a song I like, I want to save the song to my library but I don't want to switch to the Spotify app to do so.

The Discover weekly playlist is one of my favorite ways to explore new music on Spotify.
