• Stars
    star
    210
  • Rank 186,662 (Top 4 %)
  • Language
    Lua
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

hackable tiling window manager for macOS and Hammerspoon

HHTWM

Hackable Hammerspoon Tiling WM

HHTWM is a module for Hammerspoon providing automatic layout-based tiling for macOS.

It's configurable, hackable, and composes well with other Hammerspoon libraries.

Setup

  1. install required dependency - hs._asm.undocumented.spaces
  2. copy hhtwm/ folder to ~/.hammerspoon/
  3. require the library in your init.lua:
hhtwm = require('hhtwm') -- it's recommended to make `hhtwm` a global object so it's not garbage collected.

MVP

Smallest init.lua that tiles by default (with no keybindings and no margins):

hhtwm = require('hhtwm')
hhtwm.start()

Configuration

All settings are optional.

  • hhtwm.margin - [number] - gap size between windows (in px)
  • hhtwm.screenMargin - [object] ({ top = 30, bottom = 5, left = 5, right = 5 }) - gap size from screen edges
  • hhtwm.defaultLayout - [string] - name of default layout to be applied
  • hhtwm.enabledLayouts - [array] - list of enabled layouts, all layouts are enabled by default
  • hhtwm.displayLayouts - [object] ({ [leftScreenId] = "equal-right" }) - per-screen default layouts
  • hhtwm.filters - [object] - filters to force tiling on/off, example:
    hhtwm.filters = {
      { app = 'Finder', tile = false } -- don't tile Finder
      { app = 'Hammerspoon', title = 'Hammerspoon Console', tile = true } -- force tile Hammerspoon Console
    }
  • hhtwm.calcResizeStep - [function] - function to calculate resize step, example:
    hhtwm.calcResizeStep = function(screen)
      return 1 / hs.grid.getGrid(screen).w -- make the resize step be the same as hs.grid size for given screen
    end

API

Module related

  • hhtwm.start() - starts watching for window changes and tiles when needed
  • hhtwm.stop() - stops hhtwm and stores current state in hs.settings, hhtwm.start() picks those settings up, so state can be persisted over reloads
  • hhtwm.tile() - force tile, usually not needed
  • hhtwm.reset() - reset hhtwm state, usually not needed

Window related

  • hhtwm.swapInDirection(win, dir) - swaps window in given direction if possible (direction: "west", "south", "north", "east")
  • hhtwm.throwToScreen(win, dir) - throws window to another screen in given direction
  • hhtwm.throwToScreenUsingSpaces(win, dir) - same as above but uses hs._asm.undocumented.spaces api
  • hhtwm.throwToSpace(win, spaceIndex) - throws window to space by given index
  • hhtwm.isFloating(win) - test if window is tiling/floating, returns true/false
  • hhtwm.toggleFloat(win) - toggles floating state of given window

Layout related

  • hhtwm.setLayout(layout) - sets layout for current space
  • hhtwm.getLayout() - gets layout for current space (returns layout name)
  • hhtwm.getLayouts() - returns list of available layouts (either hhtwm.enabledLayouts or all layouts from hhtwm)
  • hhtwm.resizeLayout(resizeOption) - resizes layout by given option, right now some layouts allow thinner/wider options
  • hhtwm.equalizeLayout() - resets the layout resize (usually to 50/50)

Example config

You can check out my usage of hhtwm in my dotfiles repo, although it might be over-engineered in places.

More Repositories

1

cartographist

experimental web browser optimized for rabbit-holing
JavaScript
171
star
2

archivist

tool for archiving and exploring
JavaScript
139
star
3

SDF-UI

WebGL node editor for Signed Distance Functions
JavaScript
105
star
4

dotfiles

scripts and dotfiles
Lua
102
star
5

LoopPI2

6-track audio looper working on Raspberry PI 3, made with ChucK.
Shell
74
star
6

DAS-UI

domain-agnostic keyboard-based visual programming language
JavaScript
71
star
7

LoopPI

4-track audio looper working on Raspberry PI, made with ChucK and Node.js.
Max
71
star
8

diy-monome

DIY monome based on Sparkfun and Adafruit Trellis PCBs
C++
64
star
9

dacein

experimental creative coding IDE
JavaScript
63
star
10

modeler

CSG modeling with React
JavaScript
60
star
11

Neutron

self-contained Node and NPM environment, useful for teaching and sketching
JavaScript
57
star
12

timav-standalone

Time Tracking system backed by Google Calendar
JavaScript
56
star
13

react-window-mixins

React mixins for working with browser window events
JavaScript
53
star
14

timav

cli tool and a library for working with time tracking data
JavaScript
34
star
15

editable-cli

command line notebooks powered by observablehq
JavaScript
27
star
16

nott

standalone sampler, looper and granular instrument
Python
26
star
17

glsl-auto-ui

Automatic DAT.GUI generation from GLSL uniforms
JavaScript
26
star
18

Pico-Tags-Plugin

Provides tags functionality for Pico
PHP
19
star
19

nodation

Experimental webapp for creating music using graphs
JavaScript
19
star
20

hiccup-sdf

tools for modeling signed distance functions with hiccup-like language
JavaScript
18
star
21

hhann

screen annotating tool for Hammerspoon
Lua
17
star
22

muninn

set of utilities helping me build and navigate my personal flat-file markdown wiki
JavaScript
17
star
23

muninn-old

set of utilities helping me build and navigate my personal flat-file markdown wiki
JavaScript
15
star
24

taskpaper-parser

Simple TaskPaper file parser for node/browser
JavaScript
15
star
25

gpujs-sdf-demo

signed distance function to obj with gpu.js
JavaScript
15
star
26

of-exp-kinect2-nite-osx

Kinect 2 with skeleton tracking on OSX
C++
14
star
27

behaviours-rs

rust + wasm for declarative particle simulations
Rust
13
star
28

reasonml-flow-field-exp

2d flow field made with ReasonML
OCaml
13
star
29

volume-brush

volumetric brush implementation, heavily inspired by toxiclibs
JavaScript
13
star
30

haze

four track live granular looper
Lua
13
star
31

reasonml-metaballs-regl-exp

2d metaballs experiment made with ReasonML
OCaml
13
star
32

threejs-exp-particles

3d flow-filed particles experiment in THREE.js
JavaScript
12
star
33

parametrium

Interactive parameter space explorer for P5.js
JavaScript
11
star
34

sketchbook-cli

a place for your sketches
JavaScript
10
star
35

Kinect2OSC

Simple application for sending preprocessed data from Kinect through OSC
C++
7
star
36

alfred-infinite-clipboard

Infinite Clipboard History for Alfred
JavaScript
7
star
37

node-serialoscd

mext-compatible serialoscd implementation in node
JavaScript
7
star
38

pex-exp-curl-noise

3D Curl Noise in Pex / WebGL
JavaScript
6
star
39

wallgen

Evolutionary wallpaper generator
JavaScript
5
star
40

maiden-remote-repl

Remote REPL session for Norns Maiden
JavaScript
4
star
41

haskell-playground

playing with Haskell
Haskell
4
star
42

muninn-vim

vim plugin for muninn
Vim Script
4
star
43

EEG2OSC

Emotiv EPOC to OSC transmitter in Objective-C
C++
3
star
44

openprocessing-scraper

Download all sketches from openprocessing.org
JavaScript
3
star
45

mjolnir.sk.transform

Animated window transformations for Mjolnir.
Objective-C
2
star
46

CRLN

GPGPU curl noise experiment
JavaScript
2
star
47

workshops-processing-video-poznan-id

Processing
1
star
48

homebridge-remote

cli remote control for homebridge
JavaScript
1
star
49

pex-physics-springs

Simple spring physics for Pex library, working with floats, Vec2, and Vec3
JavaScript
1
star
50

behaviours

declarative library for describing behaviours
JavaScript
1
star
51

drop-cli

synthetic drag&drop event util
Swift
1
star
52

pex-screensize

Screen size module for pex library
JavaScript
1
star
53

pex-exp-grayscott-gpu

GrayScott on GPU with Pex
JavaScript
1
star
54

insides

Small JavaScript utility library for working with nested objects
JavaScript
1
star