Skip to content

Instantly share code, notes, and snippets.

@Thomasorus
Created June 11, 2021 11:36
Show Gist options
  • Save Thomasorus/e358bc4b9e0713e11e21969d56bc0214 to your computer and use it in GitHub Desktop.
Save Thomasorus/e358bc4b9e0713e11e21969d56bc0214 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Inspired by: https://github.com/Julian-Heng/yabai-config/blob/master/yabairc
set -x
# ====== Variables =============================
declare -A gaps
declare -A color
gaps["top"]="10"
gaps["bottom"]="10"
gaps["left"]="10"
gaps["right"]="10"
gaps["inner"]="10"
color["focused"]="0xE0808080"
color["normal"]="0x00010101"
color["preselect"]="0xE02d74da"
# Uncomment to refresh ubersicht widget on workspace change
# Make sure to replace WIDGET NAME for the name of the ubersicht widget
#ubersicht_spaces_refresh_command="osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"WIDGET NAME\"'"
# ===== Loading Scripting Additions ============
# See: https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#macos-big-sur---automatically-load-scripting-addition-on-startup
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
# ===== Tiling setting =========================
yabai -m config layout bsp
yabai -m config top_padding "${gaps["top"]}"
yabai -m config bottom_padding "${gaps["bottom"]}"
yabai -m config left_padding "${gaps["left"]}"
yabai -m config right_padding "${gaps["right"]}"
yabai -m config window_gap "${gaps["inner"]}"
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse off
yabai -m config window_topmost on
yabai -m config window_opacity off
yabai -m config window_shadow float
yabai -m config window_border off
yabai -m config window_border_width 2
yabai -m config active_window_border_color "${color["focused"]}"
yabai -m config normal_window_border_color "${color["normal"]}"
yabai -m config insert_feedback_color "${color["preselect"]}"
yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.90
yabai -m config split_ratio 0.50
yabai -m config auto_balance off
yabai -m config mouse_modifier fn
yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize
# ===== Rules ==================================
yabai -m rule --add label="Finder" app="^Finder$" title="(Copy|nnect)|Move|Info|Pref)" manage=off
yabai -m rule --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance)$" manage=off
yabai -m rule --add label="System Preferences" app="^System Preferences$" title=".*" manage=off
yabai -m rule --add label="App Store" app="^App Store$" manage=off
yabai -m rule --add label="Activity Monitor" app="^Activity Monitor$" manage=off
yabai -m rule --add label="Calculator" app="^Calculator$" manage=off
yabai -m rule --add label="Dictionary" app="^Dictionary$" manage=off
yabai -m rule --add label="mpv" app="^mpv$" manage=off
yabai -m rule --add label="Software Update" title="Software Update" manage=off
yabai -m rule --add label="About This Mac" app="System Information" title="About This Mac" manage=off
# ===== Signals ================================
yabai -m signal --add event=application_front_switched action="${ubersicht_spaces_refresh_command}"
yabai -m signal --add event=display_changed action="${ubersicht_spaces_refresh_command}"
yabai -m signal --add event=space_changed action="${ubersicht_spaces_refresh_command}"
yabai -m signal --add event=window_created action="${ubersicht_spaces_refresh_command}"
yabai -m signal --add event=window_destroyed action="${ubersicht_spaces_refresh_command}"
yabai -m signal --add event=window_focused action="${ubersicht_spaces_refresh_command}"
yabai -m signal --add event=window_title_changed action="${ubersicht_spaces_refresh_command}"
set +x
printf "yabai: configuration loaded...\\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment