# $DOTFILES/platforms/mac/skhdrc
# Date: 2024-11-30
# Author: js0ny

# # Location: $XDG_CONFIG_HOME/skhd/skhdrc
# # Linking:
# # ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc

# # Navigation
# alt - h : yabai -m window --focus west
# alt - n : yabai -m window --focus south
# alt - e : yabai -m window --focus north
# alt - i : yabai -m window --focus east

# # Moving windows
# shift + alt - h : yabai -m window --warp west
# shift + alt - n : yabai -m window --warp south
# shift + alt - e : yabai -m window --warp north
# shift + alt - i : yabai -m window --warp east

# ctrl - 1 : yabai -m space --focus 1
# ctrl - 2 : yabai -m space --focus 2
# ctrl - 3 : yabai -m space --focus 3
# ctrl - 4 : yabai -m space --focus 4
# ctrl - 5 : yabai -m space --focus 5
# ctrl - 6 : yabai -m space --focus 6
# ctrl - 7 : yabai -m space --focus 7
# ctrl - 8 : yabai -m space --focus 8
# ctrl - 9 : yabai -m space --focus 9
# ctrl - 0  : yabai -m space --focus 10

# # minimize window
# alt - m : yabai -m window --minimize

# float / unfloat window and center on screen
ctrl - f : yabai -m window --toggle float

# toggle window native fullscreen
shift + ctrl - f : yabai -m window --toggle native-fullscreen

# send window to a space
shift + ctrl - 1 : yabai -m window --space 1
shift + ctrl - 2 : yabai -m window --space 2
shift + ctrl - 3 : yabai -m window --space 3
shift + ctrl - 4 : yabai -m window --space 4
shift + ctrl - 5 : yabai -m window --space 5
shift + ctrl - 6 : yabai -m window --space 6
shift + ctrl - 7 : yabai -m window --space 7
shift + ctrl - 8 : yabai -m window --space 8
shift + ctrl - 9 : yabai -m window --space 9
shift + ctrl - 0 : yabai -m window --space 10

# open terminal
ctrl - r : open -n -a "Kitty"

# moves focus between windows in the current focused display
ctrl - h : yabai -m window --focus west
ctrl - n : yabai -m window --focus south
ctrl - e : yabai -m window --focus north
ctrl - i : yabai -m window --focus east

# moves focus between spaces
ctrl - 1 : yabai -m space --focus 1
ctrl - 2 : yabai -m space --focus 2
ctrl - 3 : yabai -m space --focus 3
ctrl - 4 : yabai -m space --focus 4
ctrl - 5 : yabai -m space --focus 5
ctrl - 6 : yabai -m space --focus 6
ctrl - 7 : yabai -m space --focus 7
ctrl - 8 : yabai -m space --focus 8
ctrl - 9 : yabai -m space --focus 9
ctrl - 0  : yabai -m space --focus 10

# delete focused space
alt - q : yabai -m space --destroy

# toggle window split type
alt - e : yabai -m window --toggle split

# close window
alt - x : yabai -m window --close

# minimize window
alt - m : yabai -m window --minimize

# rotate tree
alt - r : yabai -m space --rotate 90

# mirror tree y-axis
alt - y : yabai -m space --mirror y-axis

# toggle desktop offset
alt - a : yabai -m space --toggle padding; yabai -m space --toggle gap

# toggle window parent zoom
alt - d : yabai -m window --focus mouse && \
          yabai -m window --toggle zoom-parent

# float / unfloat window and center on screen
alt - t : yabai -m window --toggle float;\
          yabai -m window --grid 4:4:1:1:2:2

# toggle window fullscreen zoom
alt - f : yabai -m window --focus mouse && \
          yabai -m window --toggle zoom-fullscreen

# toggle window native fullscreen
shift + alt - f : yabai -m window --toggle native-fullscreen

# increase gap in focused space
alt - g : yabai -m space --gap rel:10

# decrease gap in focused space
shift + alt - g : yabai -m space --gap rel:-10

# create a new space and follow focus
alt - n : yabai -m space --create && \
                  index="$(yabai -m query --displays --display | jq '.spaces[-1]')" && \
                  yabai -m space --focus "${index}"

# create a new space, move window and follow focus
shift + alt - n : yabai -m space --create && \
                  index="$(yabai -m query --displays --display | jq '.spaces[-1]')" && \
                  yabai -m window --space "${index}" && \
                  yabai -m space --focus "${index}"

# balance size of windows
shift + alt - 0 : yabai -m space --balance

# swap window
shift + alt - h : yabai -m window --swap west
shift + alt - n : yabai -m window --swap south
shift + alt - e : yabai -m window --swap north
shift + alt - i : yabai -m window --swap east

# move window
shift + cmd - h : yabai -m window --warp west
shift + cmd - n : yabai -m window --warp south
shift + cmd - e : yabai -m window --warp north
shift + cmd - i : yabai -m window --warp east

# send window to a space
shift + alt - 1 : yabai -m window --space 1
shift + alt - 2 : yabai -m window --space 2
shift + alt - 3 : yabai -m window --space 3
shift + alt - 4 : yabai -m window --space 4
shift + alt - 5 : yabai -m window --space 5
shift + alt - 6 : yabai -m window --space 6
shift + alt - 7 : yabai -m window --space 7
shift + alt - 8 : yabai -m window --space 8
shift + alt - 9 : yabai -m window --space 9
shift + alt - 0 : yabai -m window --space 10

# change layout of desktop
ctrl + alt - a : yabai -m space --layout bsp
ctrl + alt - d : yabai -m space --layout float

# increase window size
ctrl + alt - h : yabai -m window --resize left:-40:0
ctrl + alt - n : yabai -m window --resize bottom:0:40
ctrl + alt - e : yabai -m window --resize top:0:-40
ctrl + alt - i : yabai -m window --resize right:40:0

# decrease window size
ctrl + alt + cmd - h : yabai -m window --resize left:40:0
ctrl + alt + cmd - n : yabai -m window --resize bottom:0:-40
ctrl + alt + cmd - e : yabai -m window --resize top:0:40
ctrl + alt + cmd - i : yabai -m window --resize right:-40:0

# restart yabai
ctrl + alt + cmd - r : launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"

ctrl + alt + cmd - o : node ~/Projects/Personal/philips-hue-experiments/commands/turn-on.js --all
ctrl + alt + cmd - f : node ~/Projects/Personal/philips-hue-experiments/commands/turn-off.js --all
