This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local alert = require("hs.alert") | |
local timer = require("hs.timer") | |
local eventtap = require("hs.eventtap") | |
local events = eventtap.event.types | |
local module = {} | |
-- You either override these here or after including this file from another, e.g. | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local alert = require("hs.alert") | |
local timer = require("hs.timer") | |
local eventtap = require("hs.eventtap") | |
local events = eventtap.event.types | |
local module = {} | |
-- Save this in your Hammerspoon configuration directiorn (~/.hammerspoon/) | |
-- You either override timeFrame and action here or after including this file from another, e.g. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Example to test hs.javascript. This is a modified version of the code found at | |
-- https://trans4mind.com/personal_development/JavaScript/longnumPiMachin.htm | |
-- | |
-- Note that the last 5 digits are probably wrong (this returns 5 more digits than | |
-- requested), but the specified N digits are provably correct (see web page for | |
-- details) | |
-- | |
-- This results in the following on my machine: | |
-- | |
-- true PI (10005)=3. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# This is the sample file used for testing during the development of hs.styledtext | |
# for Hammerspoon. See https://github.com/Hammerspoon/hammerspoon/pull/620 | |
# It is based on code I found when I first discovered GeekTool, but I forget | |
# where it originated or how much I edited it for my purposes, so if you find | |
# this and feel additional attribution is warranted, please let me know. | |
################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- uses debug.sethook and a timer to break out of infinite loops in lua code within Hammerspoon | |
-- | |
-- Haven't had any problems with it or false positives, but YMMV -- standard disclaimers, etc. | |
-- | |
-- Updates 2015-12-21: | |
-- should play nicely with other hooks by storing info about it and chaining | |
-- you can force an "immediate" break by holding down CMD-CTRL-SHIFT-ALT-CAPSLOCK-FN all at once | |
-- you'll need to remove "and mods.fn" where noted below if your keyboard does not have this | |
-- modifier (non-laptops, I suspect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- save file in ~/.hammerspoon and use as follows: | |
-- | |
-- graph = require("graphpaper") | |
-- images = graph.fillScreen(x,y,screen) | |
-- all three parameters are optional. x and y specify the graph size in screen points. | |
-- default 10 for x, default whatever x is for y, default hs.screen.mainScreen() for screen | |
-- | |
-- so, on a MacBook Air with a 1920x900 non-retina screen: `images = graph.fillScreen(20)` | |
-- images will be an array of 6 images. The array has a metatable set replicating the hs.drawing methods | |
-- and applies them to all elements of the array, so you can show the graph with: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Requirements: hs.webview -- currently a proposed module addition | |
-- (see https://github.com/Hammerspoon/hammerspoon/pull/544) | |
-- luarocks-5.3, lsqlite3 lua-rock, and sqlite3 installed with extension support | |
-- (stock 10.11 sqlite3 doesn't have this... not sure about earlier OS X's, | |
-- but the brew versions work) | |
-- Uncompressed Hammerspoon.docset (Dash 2 version will work, not sure yet how to | |
-- uncompress Dash 3 version yet...) | |
-- | |
-- Update _rootPath to match where your docset is located |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
A way to protect tables of constants in Hammerspoon modules from inadvertant changes | |
Updated 2015-12-19: differentiate __tostring output for keyed table vs array | |
recursively descend, making each sub-table a constant table as well | |
weak key for storing original table so can be used with generated data (in testing) | |
notifies if wrong type passed in and returns unchanged value instead | |
]]-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Code snippit to check/add LSUIElement to Hammerspoon's Info.plist file | |
-- if running 10.8, since this entry is required for HS to be able to toggle | |
-- the dock icon. Surprisingly it isn't necessary in later OS X versions... | |
-- | |
-- Save this file as LSUIElementCheck.lua in ~/.hammerspoon/ and add: | |
-- | |
-- dofile("LSUIElementCheck.lua") | |
-- | |
-- to the top of your init.lua also located in ~/.hammerspoon/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Basic console auto-hide when Hammerspoon loses focus | |
-- | |
-- ConsoleWatcher:start() | |
-- Turns on the watcher, and the Hammerspoon console, if open, will close when you enter another application | |
-- ConsoleWatcher:stop() | |
-- Turns off the watcher; Hammerspoon console open/close state is left untouched. | |
ConsoleWatcher = hs.application.watcher.new(function(name,event,hsapp) | |
if name then |
NewerOlder