8/24/2023 0 Comments Hammerspoon scriptsOnce I'd got a menubar working then the next item to tick off was to get a result from running emacsclient. To keep things nice I've created a Lua script called a which I can then import from a (that main script that Hammerspoon runs on start up).Ĭreating a menubar item using Hammerspoon is dead simple: local clockingMenu = hs.menubar.new()Īn impressively minimal API for this, and most other tasks - exactly what you want from an automation framework. Once Hammerspoon is installed and running it is relatively simple to write/install a script to perform all kinds of fun automation with macOS. This returns something used by Emacs and includes face information - however it's quite easy to extract what I need. The second is org-clock-get-clock-string. The first is org-clock-is-active - which will return nil if there isn't currently a clock running. Rather than writing any Emacs Lisp to accomplish this I'm using emacsclient and a couple of Org mode functions. This is a solved problem (for example /jordonbiondo/osx-org-clock-menubar), however I wanted to put something together myself and see if over time I could improve on previous attempts. This might sound odd for those of you who live in Emacs - but I have to spend quite a lot of time in Xcode and Android Studio. One issue with this has been I have to use Emacs to see if I've got a timer running. As well as saving $12 a month I'm keeping my records in plain text and can easily run scripts to get the kind of stats I'm interested in on my performance on a per client and per project basis. I've recently decided to stop using Harvest for tracking time and start using the ' clocking ' features of Org mode. I've dabbled with Lua in the past, even going so far as to make it a scripting language in my app Trunk Notes (now discontinued so don't go looking for it on the App Store.) Hammerspoon is a macOS automation scripting tool which uses the language Lua. Lots of people! You can find out more on our Contributors page.I'm off mid morning today for my son's end of term church service - so rather than getting stuck into some serious coding I thought I'd have a play with Hammerspoon to bring the active Org mode clock to the macOS menu bar. If you find a bug, or have a suggestion, you can also file an issue on the issue tracker. We have a Discord server to chat about Hammerspoon. For more information, see the contribution guidelines on GitHub.īugs found on can be reported on GitHub Where can I get help? They can either be pure Lua scripts that offer useful helper functions, or you can write Objective-C extensions to expose new areas of system functionality to users. More extensions will always be a huge benefit to Hammerspoon. You can learn more about the Lua scripting language at lua.org. If you are new to Hammerspoon, read the Getting Started Guide with reference to the full API documentation. You will need to create a Lua script in ~/.hammerspoon/a using our APIs and standard Lua APIs. Out of the box, Hammerspoon does nothing. If you are using an older Mac which is not running a recent version of macOS, please consult our Release Notes for a version which is compatible with your system. How do I install it?ĭownload the latest release and then drag the application to /Applications/. You might want to do something crazy like have iTunes automatically start playing when your Mac detects you are in Paris. You might want to display an alert when your battery drops below a certain percentage. You might want to run a series of commands when your wifi interface connects to your home network. You might want to bind a keyboard shortcut to a series of window operations, or an applescript. Typically you would write a configuration file in Lua that connects events to actions. If you want to explore the options Hammerspoon offers, check out the Getting Started Guide and the full API documentation as well as the already pre-made plugins called Spoons. You can write Lua code that interacts with macOS APIs for applications, windows, mouse pointers, filesystem objects, audio devices, batteries, screens, low-level keyboard/mouse events, clipboards, location services, wifi, and more. What gives Hammerspoon its power is a set of extensions that expose specific pieces of system functionality, to the user. At its core, Hammerspoon is just a bridge between the operating system and a Lua scripting engine. This is a tool for powerful automation of macOS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |