Table of contents
Window management on mac
When I was using Linux, I really enjoyed using the Xmonad app. It's a good window manager for Linux. Generally speaking, it helps to manage windows without using a mouse as much as possible.
Now, I'm using Mac on a regular basis, and since Xmonad can only be used on Linux, I had to find a window manager app that can be used on Mac in the same way. And there is such an application it's called Amethyst.
Amethyst
Installing Amethyst
The setup is pretty straightforward. First, we need to install it using the Homebrew package manager, with the following command:
brew install --cask amethyst
Setup Amethyst in macOS system
Before we move any further, we need to update a few more configurations in our system. I'm using the macOS Sonoma.
We need to give Amethyst permission to use the accessibility API. To do this open System settings, Privacy & Security, Accessibility, and add Amethyst to the list.
Configuring Amethyst
Config file can be located at:
~/.amethyst.yml ~/.config/amethyst/.amethyst.yml
Here is my
focus-ccw:
mod: mod1
key: k
focus-cw:
mod: mod1
key: j
swap-ccw:
mod: mod2
key: k
swap-cw:
mod: mod2
key: j
smart-window-margins: false
window-margins: true
window-margin-size: 15
focus-follows-mouse: false
mouse-swaps-windows: true
mouse-resizes-windows: true
float-small-windows: false
Here is the full list of configurations:
https://github.com/ianyh/Amethyst/blob/development/docs/configuration-files.md
Here is the sample file:
https://github.com/ianyh/Amethyst/blob/development/.amethyst.sample.yml
Amethyst keyboard shortcuts
I won't go through all the keyboard shortcuts. Instead, I'll describe my favorites:
Hotkey | Description |
---|---|
|
Cycle layout forward |
|
Cycle layout backwards |
|
Shrink the main pane |
|
Expand the main pane |
|
Move focus counter clockwise |
|
Move focus clockwise |
|
Swap focused window counter clockwise |
|
Swap focused window clockwise |
|
Swap focused window with main window |
|
Relaunch Amethyst |
|
Full mode screen |
|
Throw focused window to space n |
|
Increase main pane count |
|
Decrease main pane count |
These are keyboard shortcuts I'm using on a regular basis. The whole list can be found in the documentation.
MacOS spaces
Configuring MacOS spaces
I like having five spaces and navigating between them as needed.
To add a few more spaces, click
Configuring shortcuts
After you've added new spaces, they will appear in your Mission control shortcuts. But you need to turn them on.
Open System settings, Keyboard, and at the top, you'll see the Keyboard Shortcuts button.
Click it, and the popup will appear with the shortcut list. On this list, find and select Mission control.
You'll see the Mission Control item on the list with the checkboxes, which can be expanded.
Click on the arrow to expand it and choose all your spaces with the hotkeys. I like to use
Installing SpaceId
In order not to be confused about what space you're using at the current moment, you need an application that will reflect this information.
There is an app called SpaceId that does exactly what we need.
It's pretty easy to install, you just need to run:
brew install --cask spaceid
In preferences, I've chosen the following options:
- Launch on Login
- Icon Per Space
- Black on White
Now it looks like this:
Mac shortcuts
Minimize & Maximize windows
Hotkey | Description |
---|---|
|
Minimize the window |
|
Maximize the window |
|
Toggle full screen |
Opening and closing programs
Hotkey | Description |
---|---|
|
Open Spotlight |
|
Close program |
|
Close finder window |
|
Force quit application |
JankyBorders
To add borders to the focused window we can use the JankyBorders.
JankyBorders installation
It can be installed with Homebrew:
brew tap FelixKratz/formulae
brew install borders
Update border styles
To configure the border color and width, run this command with the color and width you prefer.
borders active_color=0xFFB30458 inactive_color=0xff494d64 width=10.0
Hex to JankyBorders color format
If you don't know how to transform hex color to the current format, here is the Python script that could do everything for you.
def hex_to_0xAARRGGBB(hex_color):
hex_color = hex_color.lstrip('#')
red = int(hex_color[0:2], 16)
green = int(hex_color[2:4], 16)
blue = int(hex_color[4:6], 16)
alpha = 0xFF
result = (alpha << 24) | (red << 16) | (green << 8) | blue
return result
# Example usage
hex_color_code = "#b30458"
result = hex_to_0xAARRGGBB(hex_color_code)
print("Hex Color Code:", hex_color_code)
print("Converted Value:", hex(result))
Setting up a login script
In addition to all we've done, we need to set up a shell script that will run when the user logs in to the system.
The script we want to run on startup:
# Setup borders
/usr/local/bin/borders active_color=0xFFB30458 inactive_color=0xff494d64 width=10.0
# Open Amethyst
open -a "Amethyst"
In order to add the script that will run on startup, we need to follow these steps:
- Open Finder
- Choose Application
- Double click on Automator
- Click on New document
- Select Application
- Select Utilities and choose Run Shell Script
- Put your script content into the text area.
- Click
Cmnd+S to save the script (LoginSystem.app ) and Choose Application folder - Open System Settings and search for Open at Login
- At left panel click on + button and add your script which we previously named as
LoginSystem.app - Restart to be sure that everything works as expected