Skip to content

bviefhues/TilingWindowManager.spoon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

TilingWindowManager

macOS Tiling Window Manager. Spoon on top of Hammerspoon.

Example ~/.hammerspoon/init.lua configuration:

hs.loadSpoon("TilingWindowManager")
    :setLogLevel("debug")
    :bindHotkeys({
        tile =           {hyper, "t"},
        incMainRatio =   {hyper, "p"},
        decMainRatio =   {hyper, "o"},
        incMainWindows = {hyper, "i"},
        decMainWindows = {hyper, "u"},
        focusNext =      {hyper, "k"},
        focusPrev =      {hyper, "j"},
        swapNext =       {hyper, "l"},
        swapPrev =       {hyper, "h"},
        toggleFirst =    {hyper, "return"},
        tall =           {hyper, ","},
        talltwo =        {hyper, "m"},
        fullscreen =     {hyper, "."},
        wide =           {hyper, "-"},
        display =        {hyper, "d"},
    })
    :start({
        menubar = true,
        dynamic = true,
        layouts = {
            spoon.TilingWindowManager.layouts.fullscreen,
            spoon.TilingWindowManager.layouts.tall,
            spoon.TilingWindowManager.layouts.talltwo,
            spoon.TilingWindowManager.layouts.wide,
            spoon.TilingWindowManager.layouts.floating,
        },
        displayLayout = true,
        floatApps = {
            "com.apple.systempreferences",
            "com.apple.ActivityMonitor",
            "com.apple.Stickies",
        }
    })

API Overview

API Documentation

Variables

layouts
Signature TilingWindowManager.layouts
Type Variable
Description A table holding all known tiling layouts. Maps keys to descriptive strings. The strings show up in the user interface.

Functions

displayLayout
Signature TilingWindowManager.displayLayout() -> nil
Type Function
Description Shows an alert displaying the current spaces current layout.
Parameters
  • None
Returns
  • None
Notes
    focusRelative
    Signature TilingWindowManager.focusRelative(relativeIndex) -> nil
    Type Function
    Description Change window focus.
    Parameters
    • relativeIndex - positive moves focus next, negative moves focus previous.
    Returns
    • None
    Notes
    • Newly focussed window is determined by relative distance relativeIndex from current window in ordered tileable windows table. Wraps around if current window is first or last window.
    • +1 focuses next window, -1 focuses previous window.
    moveRelative
    Signature TilingWindowManager.moveRelative(relativeIndex) -> nil
    Type Function
    Description Moves window to different position in table of tileable windows.
    Parameters
    • relativeIndex - positive moves window next, negative moves window previous.
    Returns
    • None
    Notes
    • Wraps around if current window is first or last window.
    • Tiles the current space.
    swapFirst
    Signature TilingWindowManager.swapFirst() -> nil
    Type Function
    Description Swaps first window.
    Parameters
    • None
    Returns
    • None
    Notes
    • If current window is first window: Swaps window order and position with second window in tileable windows.
    • If current window is not first window: Swaps window order and position with first window in tileable windows.
    • Tiles the current space.
    toggleFirst
    Signature TilingWindowManager.toggleFirst() -> nil
    Type Function
    Description Toggles first window.
    Parameters
    • None
    Returns
    • None
    Notes
    • If current window is first window: Swaps window order and position with second window in tileable windows.
    • If current window is not first window: Makes current window the first window. Previous first window becomes the second window.
    • *Tiles the current space.

    Methods

    bindHotkeys
    Signature TilingWindowManager:bindHotkeys(mapping) -> self
    Type Method
    Description Binds hotkeys for TilingWindowManager
    Parameters
    • mapping - A table containing hotkey modifier/key details for the following items
    Returns
    • The TilingWindowManager object
    Notes
    • Keys for mapping:
    • - tile - Manually tiles the current macOS space.
    • - focusNext - move focus to next window.
    • - focusPrev - move focus to previous window.
    • - swapNext - swap current window with next window.
    • - swapPrev - swap current window with previous window.
    • - swapFirst - swap current window with first window.
    • - toggleFirst - Toggle current window with first window.
    • - float - switch current space to float layout.
    • - fullscreen - switch current space to fullscreen layout.
    • - tall - switch current space to tall layout.
    • - wide - switch current space to wide layout.
    • - display - display current space layout.
    setLogLevel
    Signature TilingWindowManager:setLogLevel(level) -> self
    Type Method
    Description Set the log level of the spoon logger.
    Parameters
    • Log level
    Returns
    • The TilingWindowManager object
    Notes
      start
      Signature TilingWindowManager:start([config]) -> self
      Type Method
      Description Starts TilingWindowManager spoon
      Parameters
      • config A table with configuration options for the spoon. These keys are recognized:
      dynamic - if true: dynamically tile windows.
      layouts - a table with all layouts to be enabled.
      fullscreenRightApps - a table with app names, to position right half only in fullscreen layout.
      floatApp - a table with app names to always float.
      displayLayout - if true: show layout when switching tiling layout.
      menubar - if true: enable menubar item.
      Returns
      • The TilingWindowManager object
      Notes
        stop
        Signature TilingWindowManager:stop() -> self
        Type Method
        Description Stops TilingWindowManager spoon
        Parameters
        • None
        Returns
        • The TilingWindowManager object
        Notes

          About

          macOS Tiling Window Manager. Spoon on top of Hammerspoon.

          Topics

          Resources

          License

          Stars

          Watchers

          Forks

          Languages