Skip to content

Instantly share code, notes, and snippets.

@slarwise
Last active August 15, 2023 20:52
Show Gist options
  • Save slarwise/d42e1d336c5d65ff5cb13851ea9048b7 to your computer and use it in GitHub Desktop.
Save slarwise/d42e1d336c5d65ff5cb13851ea9048b7 to your computer and use it in GitHub Desktop.

Navigating and making it comfy on mac

Window management

The usual layout I need is a main window on the left and a secondary on the right, where the main window stays the same and the secondary changes applications. It should also be easy to fullscreen the current window.

Amethyst

Amethyst is pretty nice for window management. Shortcuts for

  • Changing layout (e.g. between fullscreen and tall)
  • Going to the next/previous window
  • Swapping the current window with the next/previous

are kind of enough. Using screen and window margins is nice.

Tiling window managers get complicated when you start opening up many windows. Maybe this is possible to fix using the max window setting for Amethyst. If I have this at 2, then it will minimize the remaining windows. Using alt-tab, it's possible to cycle through minimized windows. It works pretty well since it will always swap out the secondary window and leave the main one in place. Pretty cool! The minimize/maximize animations are so slow though. Using the scale instead of genie animation improves this.

Native stuff

To be able to move windows by pressing Ctrl + Cmd and clicking and dragging anywhere on the window, run

defaults write -g NSWindowShouldDragOnGesture -bool true

Magnet plus alt-tab

Magnet is simple, and does not get overwhelming with many windows open. Together with alt-tab I think it can be pretty good. Have shortcuts for

  • Snapping to the left half
  • Snapping to the right half
  • Make full-screen

alt-tab makes it possible to go through windows regardless of applications (like on windows).

The only thing missing with this setup is screen and window margins. Also, having windows stacked on top of each other doesn't work so well with a transparent terminal.

I think a tiling window manager is also nicer when you have two windows side-by-side, and want to make one of them slightly bigger and the other one slightly smaller. Resizing a window with Rectangle only resizes that particular window.

A shortcoming of alt-tab seems to be that you can't go through the windows in reverse order with a shortcut.

Rectangle plus alt-tab (I think this is it)

Rectangle is like Magnet but it can add margins. I think a good setup is

  • Snapping hotkeys (left, right, maximize, resize) with Rectangle
  • alt-tab to switch windows

You can set the resize increment by doing

defaults write com.knollsoft.Rectangle sizeOffset -float <NUM_PIXELS>

# For Rectangle Pro:
defaults write com.knollsoft.Hookshot sizeOffset -float <NUM_PIXELS>

The default is 30, something a bit larger like 90 is better. You can also make commands like send to right half loop through 1/3, 1/2 and 2/3's when pressing it repeatedly. With the pro version it is possible to customize how the repetition works, so one way is to have a hotkey for cycling between left half, top left and bottom left.

Hammerspoon PaperWM (this is it???)

PaperWM is a scrolling tiling window manager. It's really cool basically, and doesn't feel as restrictive as a non-scrolling one, like Amethyst. It adds new windows to the right as a new column, and it's possible to stack windows vertically.

Hotkeys

Use skhd for creating hotkeys such as opening the terminal and the browser. Alfred is an improved version of Spotlight, faster and more like the launchers for Linux.

Looks, looks, looks

To make it look more hacky, hide the menu bar on the mac, hide the title bar on wezterm using window_decorations = "RESIZE".

Convert an image to use a specific color palette, AKA make a cool wallpaper

To convert e.g. the default macos background to use the same colors as the terminal, I've found these methods:

  1. Use imagemagick: magick convert <input-filename> -remap <image-with-wanted-palette> <output-filename>. The image with the wanted palette can be the output of neofetch. Try removing dithering (something with adding noise) using +dither if it doesn't look good.
  2. Use Krita: Create a custom color palette by going enabling Settings/Dockers/Palette, and creating a palette in this window. Open the image to convert and go to Filter/Map/Palettize, and choose the custom palette.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment