nix-dots/modules/yabai.nix

83 lines
3.0 KiB
Nix

{...}: {
services.yabai = {
enable = true;
config = {
mouse_follows_focus = "off";
focus_follows_mouse = "off";
window_origin_display = "default";
window_placement = "second_child";
window_zoom_persist = "on";
window_shadow = "on";
window_animation_duration = 0;
window_animation_frame_rate = 120;
window_opacity_duration = 0;
active_window_opacity = 1;
normal_window_opacity = 0;
window_opacity = "off";
insert_feedback_color = "0xffd75f5f";
split_ratio = 0;
split_type = "auto";
auto_balance = "off";
top_padding = 0;
bottom_padding = 0;
left_padding = 0;
right_padding = 0;
window_gap = 6;
layout = "bsp";
mouse_modifier = "fn";
mouse_action1 = "move";
mouse_action2 = "resize";
mouse_drop_action = "swap";
};
};
services.skhd = {
enable = true;
skhdConfig = ''
ctrl + alt - h: yabai -m window --focus west
ctrl + alt - j: yabai -m window --focus south
ctrl + alt - k: yabai -m window --focus north
ctrl + alt - l: yabai -m window --focus east
cmd + ctrl + alt - h : yabai -m window --warp west
cmd + ctrl + alt - j : yabai -m window --warp south
cmd + ctrl + alt - k : yabai -m window --warp north
cmd + ctrl + alt - l : yabai -m window --warp east
ctrl + alt - 1 : yabai -m space --focus 1
ctrl + alt - 2 : yabai -m space --focus 2
ctrl + alt - 3 : yabai -m space --focus 3
ctrl + alt - 4 : yabai -m space --focus 4
ctrl + alt - 5 : yabai -m space --focus 5
ctrl + alt - 6 : yabai -m space --focus 6
ctrl + alt - 7 : yabai -m space --focus 7
ctrl + alt - 8 : yabai -m space --focus 8
ctrl + alt - 9 : yabai -m space --focus 9
ctrl + alt - q: yabai -m window --close
## stack window
# Note that this only works when the active window does *not* already belong to a stack
shift + alt + cmd - left : yabai -m window west --stack $(yabai -m query --windows --window | jq -r '.id')
shift + alt + cmd - right : yabai -m window east --stack $(yabai -m query --windows --window | jq -r '.id')
# 0x21 - [
# 0x1E - ]
ctrl + alt - 0x21 : yabai -m query --spaces --space \
| jq -re ".index" \
| xargs -I{} yabai -m query --windows --space {} \
| jq -sre "add | map(select(.minimized != 1)) | sort_by(.display, .frame.y, .frame.y, .id) | nth(index(map(select(.focused == 1))) - 1).id" \
| xargs -I{} yabai -m window --focus {}
ctrl + alt - 0x1E : yabai -m query --spaces --space \
| jq -re ".index" \
| xargs -I{} yabai -m query --windows --space {} \
| jq -sre "add | map(select(.minimized != 1)) | sort_by(.display, .frame.y, .frame.x, .id) | reverse | nth(index(map(select(.focused == 1))) - 1).id" \
| xargs -I{} yabai -m window --focus {}
# applications
ctrl + alt - t: open -n -a 'Alacritty.app'
'';
};
}