Shimmy - A window positioning tool for macOS

Shimmy is a lightweight utility for users who need precise control over window positions, allowing directional adjustments using global keyboard shortcuts.
Stack: Go C

Author

Andrew Schwenke

You can explore the project and its code on GitHub.

Project Summary

Shimmy is a lightweight utility designed for macOS users who need quick and precise control over their window positions. It allows users to nudge windows in any direction using customisable global keyboard shortcuts. Unlike full-fledged window management tools, Shimmy focuses on providing simple directional adjustments, making it a perfect companion to other window management solutions.

Technical Stack

  • Programming Languages: Go, C
  • Build Pipeline Github Workflows, Make
  • Platform: macOS
  • Additional Requirements: C Compiler

Key Features

  • Directional Window Movement: Easily move active windows in any direction using the keyboard.
  • Customisable Shortcuts: Configure movement distance with the -p flag, allowing for fine-tuned control.
  • Foreground and Background Operation: Shimmy can run in the foreground or as a background process, making it flexible for different use cases.
  • Future Enhancements: Plans to add support for custom keybindings and to run as a menu bar app for more seamless integration.

Challenges and Solutions

Developing a tool that interacts with macOS’s window management using only keyboard shortcuts required overcoming challenges related to native system integration.

Go was chosen for its simplicity and performance, making it ideal for creating lightweight tools like Shimmy. However, Go’s cross-platform nature doesn’t natively support macOS-specific window management functions.

To bridge this gap, the cgo package was used to integrate C code into the Go project. This allowed me to utilise Apple’s native C libraries for enabling precise control over window positioning, while maintaining the efficiency and ease of development provided by Go.

Usage

  1. Clone the repository and build the binary using go build.

  2. Run the binary with options to control window movements.

  3. Example command, setting the movement distance to 10 pixels:

    ./shimmy -p 10

Future Development

Shimmy’s development roadmap includes features like customisable keybindings and running as a menu bar application for even easier access and usability.