

The more you know about hammerspoon, the more you can control your MacOS. By the way, you can learn Lua by reading other’s hammerspoon config files. Hammerspoon is a powerful tool allowing you to have powerful effects on your system by writing Lua scripts.

SetCaffeineDisplay(hs.caffeinate.get( " displayIdle "))

SetCaffeineDisplay(hs.caffeinate.toggle( " displayIdle "))Ĭaffeine:setClickCallback(caffeineClicked) But now I can create a menubar by the following config: I used to type caffeinate -t 99999 to make OS awake. Hs.wifi.associate(studySSID, " myPassPhrase ") Hs.hotkey.bind(hyperShift, ' 8 ', function() Hs.wifi.associate(bedroomSSID, " myPassPhrase ") Hs.hotkey.bind(hyperShift, ' 9 ', function() So I can config like this to make sure I can connect to the stronger one. In some rooms, the signal of router A is stronger, while in other rooms, router B is better. HyperShift = )ĪppWatcher = hs.(applicationWatcher) obj:selectWindow() It uses a chooser, and you can type part of the title or app name to switch to a specific window. I have implemented a window switcher that works well across workspaces. MacOS window management is broken, in my opinion.
#Hammerspoon window windows#
Now we can dive into a more complex task: windows manager. I found that i had to keep track of windows myself. Then try to press cmd+option+t, the clock should appear again. Hs.hotkey.bind(hyper, ' t ', function() spoon.AClock:toggleShow() end) Now let’s start your first config script, edit the a file: I talked to Matt Raible who showed me hammerspoon which I installed use ye ol. You can see the clock display on the screen. I upgraded to macOs Monterey 12.2 and my beloved window manager of choice. Then launch the hammerspoon console and inputīingo! We just finish the hammerspoon version of “hello world” :)
#Hammerspoon window install#
Let’s getting started.įirst, install hammerspoon, you can easily install it using homebrew:Īnd make sure these files and folders exists:ĭownload it and double click to unzip and install it, it will be installed in the Spoons folder. I hope this post can help beginners to get started with hammerspoon (and spoons).

So I deceided to rewrite my hammerspoon config file with spoons. I have used hammerspoon for a long time, recently I found that the new version of hammerspoon supported Lua plugins called “Spoons”. Teddy Ma's Homepage | Powerful Hammerspoon Is there anything out there for me that can play nicely with a DE (no preference as to which)? I've seen stuff like Qtile but there doesn't seem to be a good way to switch between windows. I'd still prefer something closer to Hammerspoon but the closest I could find was Subtle but it seems that its not being developed and I'd still have to set everything up similarly to i3. However it's taking me too much time to set up (I've already wasted too much time testing out various distros, DEs, etc) and I have a lot of work to do. I've played around with i3 and though it lacks a lot of features I miss, it makes up for it with some other features I like (mostly tab stacking). I liked this setup because I can change the ratio of window sizes easily, overlap tiles, still easily switch to programs that wouldn't tile nicely and everything was still totally usable with a mouse. In order to change between windows I use Mod+Space to open up Pentadactyl/Vimperator-style hints for all windows, including ones hidden by others ( Pic, but in the latest version you can set hints to be the first letter of the app rather than random). I use Mod+WASD to move the currently selected window in that direction, and Mod+HJKL to resize windows. My setup was essentially a 9 column 2 row grid (I can change these numbers with hotkeys but I pretty much always leave them at 9 and 2). I've been developing in OS X for a while now and I've become very attached to Hammerspoon ( ), but a couple of days ago I decided to switch to Linux.
