简介
yabai 是一个窗口管理实用程序,旨在作为 macOS 内置窗口管理器的扩展工作。yabai 允许您使用直观的命令行界面自由控制窗口、空间和显示,并可选择使用设置用户定义的键盘快捷键↗ skhd和其他第三方软件。
yabai的主要功能是平铺窗口管理;使用二进制空间分区算法自动修改窗口布局,让您专注于窗口的内容而不会分心。yabai 的其他功能包括焦点跟随鼠标、禁用切换空间的动画、创建超过 16 个空间限制的空间等等。
github主页:
https://github.com/koekeishiya/yabai
安装
安装方法,官方 的wiki中写的非常的清楚。建议直接看官方的wiki:
https://github.com/koekeishiya/yabai/wiki
以下是我安装时候随手记的笔记,没有专门进行整理,仅供参考。
https://blog.csdn.net/lxyoucan/article/details/121202575
配置
yabai配置
为了让其他人使用我电脑,能够适应。所以默认我是不使用bsp layout的。只有我自己用电脑的时候我才会加载这个配置。
这些配置是我专门提出来的,当我自己用电脑的时候,会手动加载这些配置。(我是按CapsLk + 0
加载)
路径~/.config/yabai/yabairc
#!/usr/bin/env bash
set -x
declare -A gaps
declare -A color
gaps["top"]="4"
gaps["bottom"]="24"
gaps["left"]="4"
gaps["right"]="4"
gaps["inner"]="4"
color["focused"]="0xffd75f5f"
color["normal"]="0x00010101"
color["preselect"]="0xE02d74da"
sudo yabai --load-sa
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
yabai -m config layout float
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 external_bar all:28:0
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse off
yabai -m config window_topmost off
yabai -m config window_opacity on
yabai -m config window_shadow float
yabai -m config window_border off
yabai -m config window_border_width 3
yabai -m config active_window_border_color '0xffd75f5f'
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
yabai -m rule --add app="^系统偏好设置$" manage=off
yabai -m rule --add app="^提醒事项$" manage=off
yabai -m rule --add app="^关于本机$" manage=off
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"
路径~/.config/yabai/itkeyrc
这些配置是我专门提出来的,当我自己用电脑的时候,会手动加载这些配置。(我是按CapsLk + 0
加载)
#!/usr/bin/env bash
yabai -m config layout bsp
yabai -m config window_border on
yabai -m config window_border_width 6
yabai -m config active_window_border_color 0xff775759
yabai -m config normal_window_border_color 0xff555555
yabai -m config external_bar all:0:0
skhdrc快捷键配置
路径~/.skhdrc
shift + ctrl + alt + cmd - return : "${HOME}"/.config/yabai/scripts/open_iterm2.sh
shift + ctrl + alt + cmd - b : open -na /Applications/Google\ Chrome.app
shift + ctrl + alt + cmd - 0 : \
/usr/bin/env osascript <<< \
"display notification \"ITKEY 专属配置加载中\" with title \"yabai\""; \
source /Users/itkey/.config/yabai/itkeyrc
shift + ctrl + alt + cmd - w : yabai -m space --destroy
shift + ctrl + alt + cmd - n : yabai -m space --create
shift + ctrl + alt + cmd - 1 : yabai -m space --focus 1
shift + ctrl + alt + cmd - 2 : yabai -m space --focus 2
shift + ctrl + alt + cmd - 3 : yabai -m space --focus 3
shift + ctrl + alt + cmd - 4 : yabai -m space --focus 4
shift + ctrl + alt + cmd - 5 : yabai -m space --focus 5
shift + ctrl + alt + cmd - 6 : yabai -m space --focus 6
shift + ctrl + alt + cmd - 7 : yabai -m space --focus 7
shift + ctrl + alt + cmd - 8 : yabai -m space --focus 8
shift + ctrl + alt + cmd - 9 : yabai -m space --focus 9
alt - 1 : yabai -m space --focus 1
alt - 2 : yabai -m space --focus 2
alt - 3 : yabai -m space --focus 3
alt - 4 : yabai -m space --focus 4
alt - 5 : yabai -m space --focus 5
alt - 6 : yabai -m space --focus 6
alt - 7 : yabai -m space --focus 7
alt - 8 : yabai -m space --focus 8
alt - 9 : yabai -m space --focus 9
alt - 0 : yabai -m space --focus 10
alt - l : yabai -m space --focus next || yabai -m space --focus first
alt - h : yabai -m space --focus prev || yabai -m space --focus last
alt - k : yabai -m space --focus first
alt - j : yabai -m space --focus last
alt - tab : yabai -m space --focus recent
shift + ctrl + alt + cmd - g : yabai -m space --toggle padding; yabai -m space --toggle gap
shift + alt - x : yabai -m space --mirror x-axis
shift + alt - y : yabai -m space --mirror y-axis
shift + ctrl + alt + cmd - h : yabai -m window --focus west
shift + ctrl + alt + cmd - j : yabai -m window --focus south
shift + ctrl + alt + cmd - k : yabai -m window --focus north
shift + ctrl + alt + cmd - l : yabai -m window --focus east
shift + ctrl + alt + cmd - r : yabai -m window --focus recent
shift + alt - h : yabai -m window --warp west
shift + alt - j : yabai -m window --warp south
shift + alt - k : yabai -m window --warp north
shift + alt - l : yabai -m window --warp east
alt + ctrl - l : yabai -m window --space next && yabai -m space --focus next
alt + ctrl - h : yabai -m window --space prev && yabai -m space --focus prev
shift + ctrl + alt + cmd - e : yabai -m space --balance
alt - r : yabai -m space --rotate 270
shift + alt - r : yabai -m space --rotate 90
shift + ctrl + alt + cmd - left : yabai -m window --resize left:-50:0; \
yabai -m window --resize right:-50:0
shift + ctrl + alt + cmd - down : yabai -m window --resize bottom:0:50; \
yabai -m window --resize top:0:50
shift + ctrl + alt + cmd - up : yabai -m window --resize top:0:-50; \
yabai -m window --resize bottom:0:-50
shift + ctrl + alt + cmd - right : yabai -m window --resize right:50:0; \
yabai -m window --resize left:50:0
shift + lctrl + alt - h : yabai -m window --insert west
shift + lctrl + alt - j : yabai -m window --insert south
shift + lctrl + alt - k : yabai -m window --insert north
shift + lctrl + alt - l : yabai -m window --insert east
shift + alt - space : \
yabai -m window --toggle float; \
yabai -m window --toggle border
shift + ctrl + alt + cmd - f : yabai -m window --toggle zoom-fullscreen
alt - f : yabai -m window --toggle zoom-fullscreen
shift + alt - f : yabai -m window --toggle native-fullscreen
shift + ctrl + alt + cmd - s : yabai -m window --toggle split
shift + lctrl + alt - r : \
/usr/bin/env osascript <<< \
"display notification \"正在重启 Yabai\" with title \"Yabai\""; \
launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"
shift + lctrl + alt - b : yabai -m window --toggle border
spacebar配置
macOS 的最小状态栏。非常适合与 yabai 等平铺窗口管理器一起使用。
安装笔记,安装过程中随手记的,仅供参考:
https://blog.csdn.net/lxyoucan/article/details/121209267
路径 ~/.config/spacebar/spacebarrc
#!/usr/bin/env sh
spacebar -m config position top
spacebar -m config height 26
spacebar -m config title on
spacebar -m config spaces on
spacebar -m config clock on
spacebar -m config power on
spacebar -m config padding_left 20
spacebar -m config padding_right 20
spacebar -m config spacing_left 25
spacebar -m config spacing_right 15
spacebar -m config text_font "Helvetica Neue:Bold:12.0"
spacebar -m config icon_font "Font Awesome 5 Free:Solid:12.0"
spacebar -m config background_color 0xff202020
spacebar -m config foreground_color 0xffa8a8a8
spacebar -m config space_icon_color 0xff458588
spacebar -m config power_icon_color 0xffcd950c
spacebar -m config battery_icon_color 0xffd75f5f
spacebar -m config dnd_icon_color 0xffa8a8a8
spacebar -m config clock_icon_color 0xffa8a8a8
spacebar -m config power_icon_strip
spacebar -m config space_icon_strip 一 二 三 四 五 六 七 八 九 十
spacebar -m config space_icon
spacebar -m config clock_icon
spacebar -m config dnd_icon
spacebar -m config clock_format "%m月%d日 %R"
spacebar -m config right_shell off
spacebar -m config right_shell_icon
spacebar -m config right_shell_command "whoami"
echo "spacebar configuration loaded.."
参考
配置参考了一些大佬的分享。因为时间有点久了,有部分地址不记得了。我把记得的列到了下面。
https://github.com/koekeishiya/yabai
https://github.com/koekeishiya/skhd
https://github.com/julian-heng/yabai-config
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)