Convert Figma logo to code with AI

fikovnik logoShiftIt

Managing windows size and position in OSX

5,530
358
5,530
165

Top Related Projects

23,088

A tiling window manager for macOS based on binary space partitioning

14,622

Automatic tiling window manager for macOS à la xmonad.

25,585

Move and resize windows on macOS with keyboard shortcuts and snap areas

4,361

A lightweight macOS window and app manager scriptable with JavaScript

Staggeringly powerful macOS desktop automation with Lua

Quick Overview

ShiftIt is a macOS application that allows users to quickly manipulate window positions and sizes using keyboard shortcuts. It provides an easy way to organize windows on your screen, improving productivity and workspace management.

Pros

  • Simple and intuitive keyboard-driven interface
  • Customizable keyboard shortcuts
  • Supports multiple displays
  • Lightweight and efficient

Cons

  • Limited to macOS only
  • May conflict with other window management tools
  • Requires manual installation and setup
  • Not actively maintained (last update in 2019)

Getting Started

  1. Download the latest release from the GitHub releases page.
  2. Open the downloaded DMG file and drag ShiftIt to your Applications folder.
  3. Launch ShiftIt from your Applications folder.
  4. When prompted, grant ShiftIt the necessary permissions in System Preferences > Security & Privacy > Accessibility.
  5. Use the default keyboard shortcuts or customize them in ShiftIt's preferences.

Default shortcuts:

  • Move window to left half: Ctrl + Option + Cmd + Left Arrow
  • Move window to right half: Ctrl + Option + Cmd + Right Arrow
  • Move window to top half: Ctrl + Option + Cmd + Up Arrow
  • Move window to bottom half: Ctrl + Option + Cmd + Down Arrow
  • Maximize window: Ctrl + Option + Cmd + M

Competitor Comparisons

23,088

A tiling window manager for macOS based on binary space partitioning

Pros of yabai

  • More advanced window management with tiling and stacking capabilities
  • Highly customizable through scripting and configuration files
  • Actively maintained with frequent updates and improvements

Cons of yabai

  • Steeper learning curve due to its complexity and advanced features
  • Requires disabling System Integrity Protection (SIP) for full functionality
  • May have compatibility issues with some macOS versions or applications

Code Comparison

yabai configuration example:

yabai -m config layout bsp
yabai -m config top_padding 10
yabai -m config left_padding 10
yabai -m config right_padding 10
yabai -m config bottom_padding 10

ShiftIt configuration example:

[ShiftItAction registerAction:@"left" withDefaultKey:@"cmd+opt+left"];
[ShiftItAction registerAction:@"right" withDefaultKey:@"cmd+opt+right"];
[ShiftItAction registerAction:@"top" withDefaultKey:@"cmd+opt+up"];
[ShiftItAction registerAction:@"bottom" withDefaultKey:@"cmd+opt+down"];

While ShiftIt focuses on simple window positioning through keyboard shortcuts, yabai offers a more comprehensive window management system with tiling and advanced customization options. ShiftIt is easier to set up and use out of the box, while yabai provides greater flexibility and power for users willing to invest time in configuration and learning its features.

14,622

Automatic tiling window manager for macOS à la xmonad.

Pros of Amethyst

  • Offers more advanced window management features, including automatic tiling and multiple layout options
  • Supports custom keybindings and configuration through a YAML file
  • Actively maintained with regular updates and improvements

Cons of Amethyst

  • Steeper learning curve due to its more complex features and configuration options
  • May consume more system resources compared to ShiftIt's lightweight approach
  • Some users report occasional stability issues or conflicts with other applications

Code Comparison

Amethyst configuration (YAML):

layouts:
  - tall
  - wide
  - fullscreen
  - column

mod1:
  - option
  - shift

mod2:
  - option
  - shift
  - control

ShiftIt configuration (Objective-C):

- (void)registerDefaultsAndBindings
{
    NSDictionary *defaultValues = [NSDictionary dictionaryWithObjectsAndKeys:
        [NSNumber numberWithBool:YES], @"launchOnStartup",
        [NSNumber numberWithBool:NO], @"showMenu",
        nil];
    [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];
}

The code snippets highlight the difference in configuration approaches between the two projects. Amethyst uses a YAML file for more flexible and user-friendly configuration, while ShiftIt relies on hardcoded Objective-C methods for setting default values.

25,585

Move and resize windows on macOS with keyboard shortcuts and snap areas

Pros of Rectangle

  • More actively maintained with frequent updates
  • Supports additional window management features like snap areas and custom shortcuts
  • Offers a more modern and customizable user interface

Cons of Rectangle

  • Larger file size and potentially higher resource usage
  • May have a steeper learning curve for new users due to additional features
  • Some users report occasional conflicts with other macOS window management tools

Code Comparison

ShiftIt (Objective-C):

- (void)centerWindow {
    SIWindow *window = [SIWindow frontMostWindow];
    SIFrame *screenFrame = [window screenFrame];
    SIFrame *frame = [window frame];
    
    frame.origin.x = (screenFrame.size.width - frame.size.width) / 2;
    frame.origin.y = (screenFrame.size.height - frame.size.height) / 2;
    
    [window setFrame:frame];
}

Rectangle (Swift):

func centerWindow() {
    guard let window = AccessibilityElement.frontmostWindow() else { return }
    let screen = window.screen
    let frame = window.frame
    
    let newOrigin = CGPoint(
        x: screen.frame.midX - frame.width / 2,
        y: screen.frame.midY - frame.height / 2
    )
    
    window.setFrame(CGRect(origin: newOrigin, size: frame.size))
}

Both code snippets demonstrate the window centering functionality, with Rectangle using Swift and more modern syntax compared to ShiftIt's Objective-C implementation.

4,361

A lightweight macOS window and app manager scriptable with JavaScript

Pros of Phoenix

  • More actively maintained with recent updates
  • Offers a wider range of window management features beyond just resizing
  • Highly customizable through a JavaScript configuration file

Cons of Phoenix

  • Steeper learning curve due to its scripting-based approach
  • Requires more setup and configuration to achieve basic functionality
  • May be overkill for users who only need simple window resizing

Code Comparison

Phoenix configuration example:

Phoenix.set({
  openAtLogin: true
});

Key.on('f', ['cmd', 'alt'], () => {
  Window.focused().maximize();
});

ShiftIt usage example:

[ShiftItAction shiftToLeft];
[ShiftItAction shiftToRight];
[ShiftItAction shiftToFullScreen];

Phoenix offers more flexibility through its JavaScript API, allowing for complex window management scripts. ShiftIt provides a simpler, more straightforward approach with predefined actions for common window operations.

While ShiftIt is easier to use out of the box, Phoenix's customizability makes it more powerful for advanced users willing to invest time in configuration. ShiftIt is better suited for those who want quick, basic window management without extensive setup.

Staggeringly powerful macOS desktop automation with Lua

Pros of Hammerspoon

  • More versatile and customizable, allowing for complex automation beyond just window management
  • Active development with frequent updates and a larger community
  • Extensible through Lua scripting, enabling users to create custom functionality

Cons of Hammerspoon

  • Steeper learning curve, especially for users unfamiliar with Lua programming
  • Requires more setup and configuration to achieve basic window management functionality
  • Larger resource footprint due to its extensive feature set

Code Comparison

ShiftIt (Objective-C):

- (void)leftHalf {
    [self moveAndResize:^(NSRect windowRect, NSRect screenRect) {
        windowRect.size.width = screenRect.size.width / 2;
        windowRect.origin.x = screenRect.origin.x;
        return windowRect;
    }];
}

Hammerspoon (Lua):

hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", function()
  local win = hs.window.focusedWindow()
  local f = win:frame()
  local screen = win:screen()
  local max = screen:frame()
  f.x = max.x
  f.y = max.y
  f.w = max.w / 2
  f.h = max.h
  win:setFrame(f)
end)

Both repositories provide window management functionality for macOS, but Hammerspoon offers a more comprehensive automation platform at the cost of increased complexity. ShiftIt is simpler and more focused on window management, while Hammerspoon allows for extensive customization and broader system control.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

ShiftIt Build Status

Managing window size and position in OSX

Looking for a new maintainer #296.

This project is looking for a new maintainer. Until that transition is completed, there will likely not be further development on this project.

Alternatives

A highly recommended alternative to ShiftIt that can be implemented using Hammerspoon.

You can use the ShiftIt Spoon which implements the ShiftIt functionality in Hammerspoon.

Additionally there is a step-by-step guide to replicating ShiftIt's features using Hammerspoon yourself: https://github.com/fikovnik/ShiftIt/wiki/The-Hammerspoon-Alternative

About

Looking for a new maintainer #296.

ShiftIt is an application for OSX that allows you to quickly manipulate window position and size using keyboard shortcuts. It intends to become a full featured window organizer for OSX. It is a complete rewrite of the original ShiftIt by Aravindkumar Rajendiran which is not longer under development. For discussing any sort of stuff about this app, please create a new issue.

License: GNU General Public License v3

Change logs: change logs are versioned in the repository as well.

Download

A binary build for OSX 10.7+ is available in releases.

Installation

Please note, because the binary is not signed, you'll have to "right click" on the application, click "Open", and subsequently click "Open" in the dialog that appears. You only have to do this the first time you launch the newly-downloaded application.

User guide

ShiftIt installs itself in the menu bar (optionally it can be completely hidden). It provides a set of actions that manipulates windows positions and sizes. Following is an example of list of actions available:

Screenshot Menu

Normally, all Cocoa windows and X11 windows are supported. Some applications might not work correctly or not at all. There is a list of known problems. If you find any problem not mentioned there, please submit an issue.

Requirements

  • OSX 10.7+, 64-bit

The primary development is done on OSX 10.10, but it should be running under OSX 10.7 as well.

FAQ

How do I turn on/off windows cycling sizes with multiple hotkey presses?

If this feature is on, snapping to the left side of the screen (and top, bottom, and right sides) will resize the window to half of the screen. If window is then snapped to the same side of the screen, it will resize to one third of the screen, and then two thirds of the screen.

If the feature is off, additional snappings will have no effect and the window will remain at half of the screen.

Currently, the only way to accomplish this is by running commands on the command line. To turn the feature on, run:

defaults write org.shiftitapp.ShiftIt multipleActionsCycleWindowSizes YES

To turn it off, run:

defaults write org.shiftitapp.ShiftIt multipleActionsCycleWindowSizes NO
I disabled the Show Icon in Menu Bar in the preferences, how can I get it back?

Launch the application again. It will open the preference dialog.

I pressed a shortcut, but nothing has happened, why?

While most of application windows should work well with ShiftIt, there are some exceptions (like the GTK+ OSX applications). There is a list of known problems. If you find any problem not mentioned in the list, please raise an issue.

I pressed a shortcut, something happened, but not what I expected, why?

ShiftIt is based on a Cocoa Accessibility API and sometimes this API can be a bit fragile and not do exactly what it should. In order to help to improve ShiftIt, please submit an issue every time you find some weird behavior. Before you do please consult the list of known problems. Thanks!

ShiftIt wants accessibility access on my Mac but my system preferences don't match the instruction, why?

For instructions on accessibility in Mac OS X 10.9.x, see this comment.

How to repair Accessibility API permissions?

This can be done either using the GUI in System Preferences -> Security & Privacy -> Privacy -> Accessibility where it is necessary to check and uncheck the checkbox which is next to ShiftIt in the Allow the apps below to control your computer. If ShiftIt is not in the list, just drag and drop it there from the Applications folder.

ShiftIt permissions

Alternatively, this can be also done in a command line, however, this is rather a hack with all potential issues hacks come with.

$ sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' 'update access set allowed=1 where client like "%org.shiftitapp.ShiftIt%"'

For instructions on accessibility in Mac OS X 10.9.x, see this comment. If you've upgraded to 10.10, just uncheck and recheck the box to make things work again.

Development

The repository is based on the git flow model. The development therefore happens in the develop branch. Any contribution is welcomed!

Local build

To build ShiftIt locally just clone the repository or get the latest snapshot and execute following command in the ShiftIt directory:

$ xcodebuild -target ShiftIt -configuration Release

To make a build without X11 support execute following:

$ xcodebuild -target "ShiftIt NoX11" -configuration Release

Brew Cask

To install ShiftIt using brew you can use the cask.

$ brew install shiftit --cask

Making a release

First, update the release version in ShiftIt/ShiftIt-Info.plist. NOTE the version is in the file twice; once under <key>CFBundleShortVersionString</key> and again under <key>CFBundleVersion</key>. Make sure you update both!

Releases are handled using fabric. There are some dependencies that can be easily obtained using pip:

NOTE: this is Python2 compatible; it will error out under Python3.

Using pipenv, a release environment can be created with the following command:

$ pipenv install --two
$ pipenv shell

Prior to running the commands below, ensure the following environment variables are set:

export SHIFTIT_PRIVATE_KEY=~/.shiftit/dsa_priv.pem.gpg  # get this from the project contributors
export SHIFTIT_GITHUB_TOKEN=~/.shiftit/github.token.gpg  # this is your personal access token
export SHIFTIT_GITHUB_USER=fikovnik
export SHIFTIT_GITHUB_REPO=ShiftIt

Get your personal access token from Github's developer settings page.

As you see above, the private key and github token can be gpg-encrypted at rest. This is optional and they can simply be plain text; just don't suffix the files with .gpg.

The releases are fully automatic which hopefully will help to release more often.

Available commands

  • archive - Archives build
  • build - Makes a build by executing xcodebuild
  • info - Output all the build properties
  • release - Prepare the release: sign the build, generate appcast, generate release notes
  • release_notes - Generate release notes

After fab release instructions about how to create the actual release at github are printed.

Thanks JetBrains for kindly supporting this open source project by providing AppCode IDE.