How Yabai & Skhd Changed My macOS Workflow as a Software Engineer

Posted by Chaitanya Shahare on Tue, Aug 6, 2024

Introduction

Yabai and Skhd are two tools that can be used to improve your MacOS workflow. Yabai is a tiling window manager for macOS that allows you to manage your windows more efficiently. Skhd is a hotkey daemon that will enable you to define custom shortcuts for various actions on your Mac. In this blog post, I will show you how I use Yabai and Skhd to improve my workflow as a software engineer.

This guide is not a tutorial on how to set these things up, I’ll write another blog post on how to replicate this setup.

What is a tiling window manager?

A tiling window manager is a type of window manager that arranges windows in a non-overlapping way. This means that windows do not overlap each other, and they are placed in a grid-like pattern. Tiling window managers are designed to be fast and efficient, and they can help you to work more productively by allowing you to organize your windows more logically.

Essentially, they give each window on the screen the maximum size available.

What is Yabai?

Yabai is a tiling window manager for macOS that allows you to manage your windows more efficiently. It is inspired by the i3 window manager for Linux and is designed to be fast and easy to use. Yabai allows you to organize your windows into different layouts, move them around, and resize them with keyboard shortcuts. This can help you to work more efficiently and stay focused on your tasks.

What is Skhd?

Skhd is a hotkey daemon for macOS that allows you to define custom shortcuts for various actions on your Mac. You can use Skhd to define shortcuts for launching applications, switching between windows, and performing other tasks. Skhd is highly customizable, and you can define your shortcuts using a simple configuration file.

Skhd is required as Yabai doesn’t provide a keymapping feature in itself, the creator of both Yabai wanted it to be used in conjunction with Skhd.

Desktops are spaces in macOS which can contain windows of applications. We can change up the order of desktops and switch between different desktops using Mission Control or swiping three fingers on the trackpad.

I have the following keymaps for desktop navigation

  • Option + 1: Desktop 1
  • Option + 2: Desktop 2
  • Option + 3: Desktop 3
  • Option + 4: Desktop 4
  • Option + 5: Desktop 5
  • Option + 6: Desktop 6
  • Option + 7: Desktop 7
  • Option + 8: Desktop 8
  • Option + 9: Desktop 9

How I use Yabai and Skhd to improve my workflow

KeyMaps

Focus window

  • Option + h: Focus the window to the left of the current window or focus on the left monitor
  • Option + j: Focus the window below the current window
  • Option + k: Focus the window above the current window
  • Option + l: Focus the window to the left of the current window or focus on the left monitor

By current window, I mean window currently focused.

Swap window

  • Option + Shift + h: Swap the currently focused window with the window to the left.
  • Option + Shift + j: Swap the currently focused window with the window below.
  • Option + Shift + k: Swap the currently focused window with the window above.
  • Option + Shift + l: Swap the currently focused window with the window to the right.

Moving windows through desktops

  • Option + Shift + 1: Move currently focused window to Desktop 1.
  • Option + Shift + 2: Move currently focused window to Desktop 2.
  • Option + Shift + 3: Move currently focused window to Desktop 3.
  • Option + Shift + 4: Move currently focused window to Desktop 4.
  • Option + Shift + 5: Move currently focused window to Desktop 5.
  • Option + Shift + 6: Move currently focused window to Desktop 6.
  • Option + Shift + 7: Move currently focused window to Desktop 7.
  • Option + Shift + 8: Move currently focused window to Desktop 8.
  • Option + Shift + 9: Move currently focused window to Desktop 9.

Resizing windows

  • Control + Option + h or Control + Option + left: If the window is on the right, increase the width by increasing the left edge, or if the window is on the left, decrease the width by reducing the right edge.
  • Control + Option + j or Control + Option + Down: If the window is on the top, increase the height by increasing the bottom edge, or if the window is on the bottom, decrease the height by reducing the top edge.
  • Control + Option + k or Control + Option + up: If the window is on the bottom, increase the height by increasing the top edge, or if the window is on the top, decrease the height by reducing the bottom edge.
  • Control + Option + l or Control + Option + Right: If the window is on the left, increase the width by increasing the right edge, or if the window is on the right, decrease the width by reducing the left edge.
  • Option + Shift + n: Move currently focused window to Next Display.
  • Option + Shift + p: Move currently focused window to Previous Display.

Miscellaneous

  • Option + r: Rotate windows in a clockwise direction
  • Option + e: Change the layout of the tiles
  • Option + t: Toggle between flow and tiling mode
  • Option + f: Toggle fullscreen (this is not native full screen)
  • Option + Shift + 0: To reset the tiles

Rules to keep in mind

I have each desktop reserved for a specific app. So I know which desktop to go to for a specific application and don’t have to use the Option + Tab shortcut and keep an eye out for the right application icon.

  • Desktop 1: Notes (Obsidian)
  • Desktop 2: Browser (Firefox Developer Edition)
  • Desktop 3: Code (iTerm2 with a tmux session running Neovim)
  • Desktop 4: Development Browser window, if I’m working on the frontend & Postman if I’m working on the backend
  • Desktop 5: Discord
  • Desktop 6: Whatsapp
  • Desktop 7: Miscellaneous (first desktop of the second display)
  • Desktop 8: Spotify & clock (for Pomodoro timer)
  • Desktop 9: Miscellaneous

In this way whenever I think of something I want to not down I just press Option + 1 on the keyboard and then I’m in Obsidian my note-taking app of choice. If I want to search for something I press Option + 2 and it opens my browser and so on …

Conclusion

These shortcuts may feel like overkill and maybe it is but they make me feel productive and I use most of these keyboard shortcuts daily, I didn’t anticipate that when I configured this setup initially.

This has made me spend less time arranging windows to my liking and just made the entire process more seamless and keyboard-driven which I always preferred. As you can tell I use neovim btw ;).

I hope this blog post gave you some insights on how you can customize your workflow to be more keyboard-driven and efficient.