Code Monkey home page Code Monkey logo

macaerosnap's Introduction

Aero Snap for Mac OS X

This python script adds AeroSnap functionality to macOS Mojave using python3, bash, applescript, and swift. Unlike most macOS AeroSnap scripts, though, it uses the mouse when docking windows to the left, right, top, or bottom of the screen.

At the moment, MacAeroSnap must be launched manually.

Dependencies:

  • py-applescript

How it Works

  • MacAeroSnap asks Applescript for the desktop size and foremost window position.
  • Every 0.1 seconds, it records the Finder window position and checks it against the last recorded position. If it's different, it assumes the window is being dragged.
  • If the window is being dragged, it calls Tkinter for the mouse position and checks to see if the mouse has crossed a border of the screen. If so, it fires AppleScript to dock the window to that side of the screen.
  • Once the window is snapped, the mouse is immediately released with a bit of Swift magic.

Installation

  1. Paste the following into your Terminal:
    git clone https://github.com/callaginn/MacAeroSnap ~/bin/MacAeroSnap; ln -sf $_/macsnap.py ~/bin;
  2. Add the destination folder to your $PATH:
    echo 'PATH="$PATH:$HOME/bin"' >> ~/.bash_profile; . ~/.bash_profile;

Start and Stop

Type macsnap.py into the macOS Terminal and press enter. For debugging info, pass an additional verbose flag to the script: macsnap.py -v. You can stop MacAeroSnap at any time by closing the Terminal.

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.