Skip to content

andykuszyk/osawm.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

osawm.el

osawm is a window manager for Mac OS implemented in Emacs, using osascript to execute Applescript scripts. It isn’t really a window manager, but uses ✨ smoke and mirrors 🪄 to give you the illusion that Emacs is managing your windows. If you’re interested in more details, see the How it works section later.

🚧 This package is a work in progress, and currently only supports managing Google Chrome windows.

./screencast.gif

Installation

Install the Emacs package

This package hasn’t been published on MELPA yet, but you can install it from source control. For example, if you use use-package:

(use-package osawm
  :vc (:fetcher github :repo "andykuszyk/osawm.el")
  :config (global-osawm-mode))

💡 Enabling global-osawm-mode isn’t completely necessary, but does enable refreshing window screenshots when you switch back to Emacs.

Usage

There are two main functions of this package:

  1. “Launching” a Mac OS app to an osawm buffer (currently only Chrome is supported)
  2. “Activating” a Mac OS app from an osawm Emacs buffer

Launching an app

If you want an app’s position and visibility to be managed by osawm, it needs to be launched by osawm too.

Currently, only Chrome is supported via the osawm-launch-chrome command.

This establishes a relationship between the app and the new buffer in Emacs, which will allow you to manage the app window’s location and size using an Emacs window.

Activating an app

An osawm buffer normally displays a screenshot of its app when it isn’t activated. In order to actually interact with the app, and bring it into focus, you open the buffer and activate it. This will focus the app over the Emacs frame.

Activating an app is achieved by running the osawm-activate command (bound to C-c C-c by default) in an osawm buffer.

You are now out of Emacs, and will need to return to Emacs to continue managing your windows.

Returning to Emacs

Since the last activated window was Emacs, you should always be able to return directly to Emacs by pressing Cmd-tab once (using Mac OS’ native window switcher).

A note on updating windows

When you return to Emacs, or resize a window within Emacs, the screenshots displayed by osawm buffers should automatically update. This behaviour is enabled by global-osawm-mode.

Configuration

Disabling automatic window updates

osawm will try to keep the Mac OS windows it manages in-sync with their corresponding Emacs window sizes and locations. This behaviour can have unexpected consequences sometimes, so it can be disabled by setting osawm-automatically-update-windows to nil:

(setq osawm-automatically-update-windows nil)

How it works

osawm works by establishing a simple relationship between a special Emacs buffer (in osawm-mode) with a Mac OS application window based on the window’s name.

osawm uses screenshots of the window to display a representation of the window’s contents inside Emacs. This representation is obviously static, but does allow you to see a web page in Chrome alongside a regular Emacs buffer for example.

When you want to interact with the Mac OS application, you activate the osawm buffer (C-c C-c by default). osawm handles positioning and resizing the window to match the bounds of the Emacs window using Applescript.

Contributions

Contributions to this repo are welcome. Please fork it and submit your PRs via GitHub.

About

An Emacs window manager for Mac OS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published