Skip to content

shalomb/unmarked

Repository files navigation

unmarked 🎯

Similar to harpoon, unmarked is the keyboard user's tool for switching desktop windows using just their marks.

If you are familiar with vim/neovim's concept of marks - unmarked does the same for desktop windows.

unmarked mark f     # Mark the currently active window with the letter 'f'
# Move around to other windows in the desktop environment, etc
unmarked summon f   # Switch back to and focus the window marked 'f'

yabai and skhd are required to complete functionality. Works only on MacOS currently.

Setup ⚙️

With a ~/.config/skhd/skhdrc file as follows

ctrl + alt - a : ~/.bin/unmarked summon a
ctrl + alt - b : ~/.bin/unmarked summon b
ctrl + alt - c : ~/.bin/unmarked summon c
...
ctrl + alt - x : ~/.bin/unmarked summon x
ctrl + alt - y : ~/.bin/unmarked summon y
ctrl + alt - z : ~/.bin/unmarked summon z

ctrl + alt + cmd - a : ~/.bin/unmarked mark a
ctrl + alt + cmd - b : ~/.bin/unmarked mark b
ctrl + alt + cmd - c : ~/.bin/unmarked mark c
...
ctrl + alt + cmd - x : ~/.bin/unmarked mark x
ctrl + alt + cmd - y : ~/.bin/unmarked mark y
ctrl + alt + cmd - z : ~/.bin/unmarked mark z

You are free to use any letter now to mark (and jump between) windows.

Let's say you use wezterm a lot in your workflow and want to mark it - you would press ctrl-alt-cmd-t to mark it with the letter t. (t being a mnemonic for terminal - but you would choose any letter of your liking).

Now, let's say you've switched windows and are doing something else and want to move back to the wezterm window quickly - simply press ctrl-alt-t. Voila!

No need to alt-tab or reach for the mouse - Win! 🏆

To help setup a set of initial marks, an example unmarked.yaml is available to build from.

mkdir -p ~/Library/Application\ Support/unmarked/
cp unmarked.yaml ~/Library/Application\ Support/unmarked/

# Setup marks on your preferences
unmarked generate

why? 💡

Most developers' workflow usually involves making some code edits in the terminal, switching to a browser to test, moving to some custom app to making some comments, moving to slack to make an announcement, moving back to the terminal to pick up coding work, etc.

alt-tabbing your way through many open windows is a tad bit tedious that the tab key starts to develop a shine. For the few windows that make up the current context, it should be super quick to switch to/between them and hence the ctrl-alt-<mnemonic> to keep you in flow state.

Building 🛠️

Requires go >= 1.19, yabai, skhd

make build
cp unmarked-darwin* ~/.bin/unmarked  # or some other dir in $PATH
export PATH="$HOME/.bin:$PATH"

unmarked help  # Testing installation

Debugging 🐞

Ensure unmarked is installed into a directory of $PATH

unmarked version

Run skhd in debugging mode and test keyboard input

pkill skhd
skhd -V

# when complete with debugging, restart the skhd service
skhd --start-service

Refer to skhd's documentation on how to discover keycodes.

If unmarked is unable to mark a window, this may be a fault with yabai. Ensure yabai is able to generate a JSON representation of the window object.

sleep 5 && yabai -m query --windows --window