Coder Social home page Coder Social logo

hammerspoon-appsizer's Introduction

AppSizer Spoon for Hammerspoon

AppSizer is a configurable module (Spoon) for Hammerspoon that automatically resizes application windows to predefined sizes when they are first focused or when the F14 key is pressed.

Installation

To install the AppSizer Spoon, clone this repository into your ~/.hammerspoon/Spoons/ directory:

Usage

In your Hammerspoon init.lua script, require the AppSizer Spoon and configure your applications with their default sizes:

local AppSizer = hs.loadSpoon("AppSizer")
AppSizer:setAppSizeMap({
    ["Telegram"] = {{w=470, h=900}, {w=1160, h=710}},
    ["Todoist"] = {{w=635, h=920}, {w=1115, h=760}},
    ["Slack"] = {{w=1300, h=780}, {w=980, h=670}},
    ["WezTerm"] = {w=1357, h=920}
})
AppSizer:start()

Tip

Keep an eye on the Hammerspoon logs to see your window sizes! It logs the size it is scaling from and to.

You can add as many applications as you want to the AppSizer:setAppSizeMap(map) function. The map should be a table where the keys are the application names and the values are tables of dimensions (with w for width and h for height).

The applications will be automatically resized to the specified dimensions the first time they are focused after Hammerspoon starts, or when the F14 key is pressed.

To disable the auto resize on first focus omit calling AppSizer:start().

To stop the AppSizer, call the stop() function:

AppSizer:stop()

Note

The start() function initializes an application watcher for each application in the appSizeMap. The watchers are stored in a global table and are not stopped when the init.lua script is reloaded. To ensure that old watchers are stopped when the script is reloaded, you should call the AppSizer:stop() function at the beginning of your init.lua script.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

hammerspoon-appsizer's People

Contributors

sixlive avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.