feat: use yabai and skhd again

This commit is contained in:
Oliver Ladner 2025-05-06 14:48:59 +02:00
commit 660f539026
2 changed files with 49 additions and 23 deletions

View file

@ -10,33 +10,56 @@ alt - j : yabai -m window --focus south
alt - k : yabai -m window --focus north
alt - l : yabai -m window --focus east
# Zoom a window
# Focus a space
ctrl + shift + alt - 1 : index=1; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')"
ctrl + shift + alt - 2 : index=2; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')"
ctrl + shift + alt - 3 : index=3; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')"
ctrl + shift + alt - 4 : index=4; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')"
ctrl + shift + alt - 5 : index=5; eval "$(yabai -m query --spaces | jq --argjson index "${index}" -r '(.[] | select(.index == $index).windows[0]) as $wid | if $wid then "yabai -m window --focus \"" + ($wid | tostring) + "\"" else "skhd --key \"ctrl - " + (map(select(."is-native-fullscreen" == false)) | index(map(select(.index == $index))) + 1 % 10 | tostring) + "\"" end')"
# Zoom a window. `--toggle float` would be nicer, but results
# in the window brought back to the wrong place after toggling
ctrl + shift + alt - f : yabai -m window --toggle zoom-fullscreen
# Swap windows
# Move/swap windows
ctrl + shift + alt - h : yabai -m window --swap west
ctrl + shift + alt - j : yabai -m window --swap south
ctrl + shift + alt - k : yabai -m window --swap north
ctrl + shift + alt - l : yabai -m window --swap east
# split
ctrl + shift + alt + cmd - h : yabai -m window --warp west
ctrl + shift + alt + cmd - j : yabai -m window --warp south
ctrl + shift + alt + cmd - k : yabai -m window --warp north
ctrl + shift + alt + cmd - l : yabai -m window --warp east
# Split
#ctrl + shift + alt + cmd - h : yabai -m window --warp west
#ctrl + shift + alt + cmd - j : yabai -m window --warp south
#ctrl + shift + alt + cmd - k : yabai -m window --warp north
#ctrl + shift + alt + cmd - l : yabai -m window --warp east
# Move window to other desktop and focus desktop
ctrl + shift + alt - 1 : yabai -m window --space 1; yabai -m space --focus 1
ctrl + shift + alt - 2 : yabai -m window --space 2; yabai -m space --focus 2
ctrl + shift + alt - 3 : yabai -m window --space 3; yabai -m space --focus 3
ctrl + shift + alt - 4 : yabai -m window --space 4; yabai -m space --focus 4
cmd - 1 : yabai -m window --space 1
cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2
cmd - 3 : yabai -m window --space 3
cmd - 4 : yabai -m window --space 4
cmd - 5 : yabai -m window --space 5
# Move window to display left and right
ctrl + shift + alt - r : yabai -m window --display west; yabai -m display --focus west;
ctrl + shift + alt - u : yabai -m window --display east; yabai -m display --focus east;
ctrl + shift + alt - r : yabai -m window --display west; yabai -m display --focus west
ctrl + shift + alt - u : yabai -m window --display east; yabai -m display --focus east
# Revert resized windows to default
ctrl + shift + alt - 0 : yabai -m space --balance
# Rotate windows clockwise
ctrl + shift + alt - y : yabai -m space --rotate 270
# Resize window
# Custom keys can be checked with `skhd --observe`
#ctrl + shift + alt - 0x18 : yabai -m window --resize bottom_left:50:50; yabai -m window --resize right:50:50
#ctrl + shift + alt - 0x1B : yabai -m window --resize bottom_left:-50:-50; yabai -m window --resize right:-50:-50
ctrl + shift + alt + cmd - h : yabai -m window --resize left:-50:0; yabai -m window --resize right:-50:0
ctrl + shift + alt + cmd - j : yabai -m window --resize bottom:0:50; yabai -m window --resize top:0:50
ctrl + shift + alt + cmd - k : yabai -m window --resize top:0:-50; yabai -m window --resize bottom:0:-50
ctrl + shift + alt + cmd - l : yabai -m window --resize right:50:0; yabai -m window --resize left:50:0
# Indicate focus
# Needs scripting/protetion off
#ctrl + shift + alt - m : yabai -m window --opacity 0.1 && sleep $(yabai -m config window_opacity_duration) && yabai -m window --opacity 0.0

View file

@ -5,17 +5,19 @@
# /tmp/yabai_$USER.out.log
yabai -m config layout bsp
yabai -m config window_placement second_child
# Global
yabai -m config focus_follows_mouse off
yabai -m config mouse_follows_focus off
yabai -m config mouse_follows_focus on
yabai -m config layout bsp
yabai -m config top_padding 0
yabai -m config bottom_padding 0
yabai -m config left_padding 0
yabai -m config right_padding 0
yabai -m config window_gap 0
yabai -m config auto_balance on
yabai -m config top_padding 8
yabai -m config bottom_padding 8
yabai -m config left_padding 8
yabai -m config right_padding 8
yabai -m config window_gap 16
yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize
@ -25,15 +27,16 @@ yabai -m config mouse_modifier ctrl
#yabai -m config --space 2 window_gap
# Floating (unmanaged) apps
yabai -m rule --add app=Finder manage=off
yabai -m rule --add app=Calculator manage=off
yabai -m rule --add app=VLC manage=off
yabai -m rule --add app="^Calculator$" manage=off
yabai -m rule --add app"^=VLC$" manage=off
yabai -m rule --add app="^System Settings$" manage=off
# Launch borders
# https://github.com/FelixKratz/JankyBorders/issues/37#issuecomment-1871262622
#borders order=above active_color=0xff007777 inactive_color=0xff004444 width=8.0 style=square &
#borders order=above active_color=0xffffd700 inactive_color=0xff004444 width=8.0 style=square &
#borders order=above active_color=0xffffd700 inactive_color=0xff897400 width=8.0 style=square &
borders order=above active_color=0xffffd700 background_color=0xee897400 width=8.0 style=square blacklist="firefox" ax_focus=true &
#borders order=above active_color=0xffffd700 background_color=0xee897400 width=8.0 style=square blacklist="firefox" &
#borders order=above active_color=0xffffd700 background_color=0xee897400 width=8.0 style=square &
echo "$(date) yabai config $0 loaded"