1
0
mirror of https://github.com/danbee/dotfiles-local synced 2025-03-04 08:49:07 +00:00

Switch to Yabai

This commit is contained in:
Daniel Barber 2021-02-12 09:50:32 -05:00
parent 67f6873d82
commit 46f0a69f32
3 changed files with 190 additions and 172 deletions

138
chunkwmrc
View File

@ -1,138 +0,0 @@
#!/bin/bash
#
# NOTE: any 'chunkc' command that is run from this config file
# that is NOT 'chunkc core::<..>' or 'chunkc set ..'
# MUST be put in the background using &
#
# e.g:
# chunkc tiling::rule --owner Finder --name Copy --state float &
#
#
# NOTE: specify the absolutepath of the file to use for logging.
# 'stdout' or 'stderr' can be used instead of an actual filepath.
#
chunkc core::log_file ~/chunk.log
#
# NOTE: specify the desired level of logging.
#
# - none, debug, profile, warn, error
#
chunkc core::log_level debug
#
# NOTE: specify the absolutepath to the directory to use when loading a plugin.
#
chunkc core::plugin_dir /usr/local/share/chunkwm/plugins/
#
# NOTE: if enabled, chunkwm will monitor the specified plugin_dir
# and automatically reload any '.so' file that is changed.
#
chunkc core::hotload 0
#
# NOTE: the following are config variables for the chunkwm-tiling plugin.
#
chunkc set custom_bar_enabled 0
chunkc set custom_bar_all_monitors 0
chunkc set custom_bar_offset_top 22
chunkc set custom_bar_offset_bottom 0
chunkc set custom_bar_offset_left 0
chunkc set custom_bar_offset_right 0
chunkc set global_desktop_mode bsp
chunkc set global_desktop_offset_top 12
chunkc set global_desktop_offset_bottom 12
chunkc set global_desktop_offset_left 12
chunkc set global_desktop_offset_right 12
chunkc set global_desktop_offset_gap 8
#
# NOTE: syntax for desktop-specific settings
#
# chunkc set 2_desktop_mode monocle
# chunkc set 5_desktop_mode float
# chunkc set 3_desktop_offset_top 190
# chunkc set 3_desktop_offset_bottom 190
# chunkc set 3_desktop_offset_left 190
# chunkc set 3_desktop_offset_right 190
# chunkc set 3_desktop_offset_gap 30
#
chunkc set desktop_padding_step_size 8.0
chunkc set desktop_gap_step_size 2.0
chunkc set bsp_spawn_left 1
chunkc set bsp_optimal_ratio 1.618
chunkc set bsp_split_mode optimal
chunkc set bsp_split_ratio 0.5
chunkc set monitor_focus_cycle 1
chunkc set window_focus_cycle all
chunkc set mouse_follows_focus intrinsic
chunkc set window_float_next 0
chunkc set window_region_locked 1
chunkc set mouse_move_window \"fn 1\"
chunkc set mouse_resize_window \"fn 2\"
chunkc set mouse_motion_interval 35
chunkc set preselect_border_color 0xffd75f5f
chunkc set preselect_border_width 5
#
# NOTE: these settings require chwm-sa.
# (https://github.com/koekeishiya/chwm-sa)
#
chunkc set window_float_topmost 0
chunkc set window_fade_inactive 0
chunkc set window_fade_alpha 0.85
chunkc set window_fade_duration 0.25
chunkc set window_use_cgs_move 0
#
# NOTE: the following are config variables for the chunkwm-border plugin.
#
chunkc set focused_border_color 0xff0f6288
chunkc set focused_border_width 5
chunkc set focused_border_radius 4
chunkc set focused_border_skip_floating 1
chunkc set focused_border_skip_monocle 1
#
# NOTE: the following are config variables for the chunkwm-ffm plugin.
#
chunkc set ffm_bypass_modifier fn
chunkc set ffm_standby_on_float 1
#
# NOTE: specify plugins to load when chunkwm starts.
#
chunkc core::load border.so
chunkc core::load tiling.so
# chunkc core::load ffm.so
#
# NOTE: sample rules for the tiling plugin
#
chunkc tiling::rule --owner Finder --name Copy --state float &
chunkc tiling::rule --owner \"App Store\" --state float &
chunkc tiling::rule --owner \"Acorn\" --state float &
chunkc tiling::rule --owner \"DaisyDisk\" --state float &
chunkc tiling::rule --owner \"ImageOptim\" --state float &
chunkc tiling::rule --owner Emacs --except "^$" --state tile &

177
skhdrc
View File

@ -1,44 +1,153 @@
# enter fullscreen mode for the focused container
alt - f : chunkc tiling::window --toggle fullscreen
# ################################################################ #
# THE FOLLOWING IS AN EXPLANATION OF THE GRAMMAR THAT SKHD PARSES. #
# FOR SIMPLE EXAMPLE MAPPINGS LOOK FURTHER DOWN THIS FILE.. #
# ################################################################ #
# change focus between tiling / floating windows
shift + alt - space : chunkc tiling::window --toggle float
# A list of all built-in modifier and literal keywords can
# be found at https://github.com/koekeishiya/skhd/issues/1
#
# A hotkey is written according to the following rules:
#
# hotkey = <mode> '<' <action> | <action>
#
# mode = 'name of mode' | <mode> ',' <mode>
#
# action = <keysym> '[' <proc_map_lst> ']' | <keysym> '->' '[' <proc_map_lst> ']'
# <keysym> ':' <command> | <keysym> '->' ':' <command>
# <keysym> ';' <mode> | <keysym> '->' ';' <mode>
#
# keysym = <mod> '-' <key> | <key>
#
# mod = 'modifier keyword' | <mod> '+' <mod>
#
# key = <literal> | <keycode>
#
# literal = 'single letter or built-in keyword'
#
# keycode = 'apple keyboard kVK_<Key> values (0x3C)'
#
# proc_map_lst = * <proc_map>
#
# proc_map = <string> ':' <command> | <string> '~' |
# '*' ':' <command> | '*' '~'
#
# string = '"' 'sequence of characters' '"'
#
# command = command is executed through '$SHELL -c' and
# follows valid shell syntax. if the $SHELL environment
# variable is not set, it will default to '/bin/bash'.
# when bash is used, the ';' delimeter can be specified
# to chain commands.
#
# to allow a command to extend into multiple lines,
# prepend '\' at the end of the previous line.
#
# an EOL character signifies the end of the bind.
#
# -> = keypress is not consumed by skhd
#
# * = matches every application not specified in <proc_map_lst>
#
# ~ = application is unbound and keypress is forwarded per usual, when specified in a <proc_map>
#
# A mode is declared according to the following rules:
#
# mode_decl = '::' <name> '@' ':' <command> | '::' <name> ':' <command> |
# '::' <name> '@' | '::' <name>
#
# name = desired name for this mode,
#
# @ = capture keypresses regardless of being bound to an action
#
# command = command is executed through '$SHELL -c' and
# follows valid shell syntax. if the $SHELL environment
# variable is not set, it will default to '/bin/bash'.
# when bash is used, the ';' delimeter can be specified
# to chain commands.
#
# to allow a command to extend into multiple lines,
# prepend '\' at the end of the previous line.
#
# an EOL character signifies the end of the bind.
# change layout of desktop
shift + alt + ctrl + cmd - e : chunkc tiling::desktop --layout bsp
shift + alt + ctrl + cmd - s : chunkc tiling::desktop --layout monocle
# ############################################################### #
# THE FOLLOWING SECTION CONTAIN SIMPLE MAPPINGS DEMONSTRATING HOW #
# TO INTERACT WITH THE YABAI WM. THESE ARE SUPPOSED TO BE USED AS #
# A REFERENCE ONLY, WHEN MAKING YOUR OWN CONFIGURATION.. #
# ############################################################### #
# kill focused window
shift + alt - q : chunkc tiling::window --close
# focus window
# alt - h : yabai -m window --focus west
# change focus
alt - h : chunkc tiling::window --focus west
alt - j : chunkc tiling::window --focus south
alt - k : chunkc tiling::window --focus north
alt - l : chunkc tiling::window --focus east
# swap managed window
# shift + alt - h : yabai -m window --swap north
alt - p : chunkc tiling::window --focus prev
alt - n : chunkc tiling::window --focus next
# move managed window
# shift + cmd - h : yabai -m window --warp east
# move focused window
shift + alt - h : chunkc tiling::window --warp west
shift + alt - j : chunkc tiling::window --warp south
shift + alt - k : chunkc tiling::window --warp north
shift + alt - l : chunkc tiling::window --warp east
# balance size of windows
# shift + alt - 0 : yabai -m space --balance
alt - r : chunkc tiling::desktop --rotate 90
# make floating window fill screen
# shift + alt - up : yabai -m window --grid 1:1:0:0:1:1
# move focused container to workspace
shift + alt + ctrl + cmd - m : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop)
shift + alt + ctrl + cmd - p : chunkc tiling::window --send-to-desktop prev
shift + alt + ctrl + cmd - n : chunkc tiling::window --send-to-desktop next
shift + alt + ctrl + cmd - 1 : chunkc tiling::window --send-to-desktop 1
shift + alt + ctrl + cmd - 2 : chunkc tiling::window --send-to-desktop 2
shift + alt + ctrl + cmd - 3 : chunkc tiling::window --send-to-desktop 3
shift + alt + ctrl + cmd - 4 : chunkc tiling::window --send-to-desktop 4
shift + alt + ctrl + cmd - 5 : chunkc tiling::window --send-to-desktop 5
shift + alt + ctrl + cmd - 6 : chunkc tiling::window --send-to-desktop 6
# make floating window fill left-half of screen
# shift + alt - left : yabai -m window --grid 1:2:0:0:1:1
# create desktop, move window and follow focus - uses jq for parsing json (brew install jq)
# shift + cmd - n : yabai -m space --create && \
# index="$(yabai -m query --spaces --display | jq 'map(select(."native-fullscreen" == 0))[-1].index')" && \
# yabai -m window --space "${index}" && \
# yabai -m space --focus "${index}"
# fast focus desktop
# cmd + alt - x : yabai -m space --focus recent
# cmd + alt - 1 : yabai -m space --focus 1
# send window to desktop and follow focus
# shift + cmd - z : yabai -m window --space next; yabai -m space --focus next
# shift + cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2
# focus monitor
# ctrl + alt - z : yabai -m display --focus prev
# ctrl + alt - 3 : yabai -m display --focus 3
# send window to monitor and follow focus
# ctrl + cmd - c : yabai -m window --display next; yabai -m display --focus next
# ctrl + cmd - 1 : yabai -m window --display 1; yabai -m display --focus 1
# move floating window
# shift + ctrl - a : yabai -m window --move rel:-20:0
# shift + ctrl - s : yabai -m window --move rel:0:20
# increase window size
# shift + alt - a : yabai -m window --resize left:-20:0
# shift + alt - w : yabai -m window --resize top:0:-20
# decrease window size
# shift + cmd - s : yabai -m window --resize bottom:0:-20
# shift + cmd - w : yabai -m window --resize top:0:20
# set insertion point in focused container
# ctrl + alt - h : yabai -m window --insert west
# toggle window zoom
shift + alt + ctrl + cmd - d : yabai -m window --toggle zoom-parent
shift + alt + ctrl + cmd - f : yabai -m window --toggle zoom-fullscreen
# toggle window split type
# alt - e : yabai -m window --toggle split
# float / unfloat window and center on screen
shift + alt + ctrl + cmd - t : chunkc tiling::window --toggle float;\
chunkc tiling::window --grid-layout 4:4:1:1:2:2
ctrl + alt + cmd + shift - t : yabai -m window --toggle float;\
yabai -m window --grid 4:4:1:1:2:2
# toggle sticky(+float), topmost, picture-in-picture
# alt - p : yabai -m window --toggle sticky;\
# yabai -m window --toggle topmost;\
# yabai -m window --toggle pip
# change layout of desktop
shift + alt + ctrl + cmd - a : yabai -m space --layout bsp
shift + alt + ctrl + cmd - d : yabai -m space --layout float
shift + alt + ctrl + cmd - s : yabai -m space --layout stack

47
yabairc Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env sh
# the scripting-addition must be loaded manually if
# you are running yabai on macOS Big Sur. Uncomment
# the following line to have the injection performed
# when the config is executed during startup.
#
# for this to work you must configure sudo such that
# it will be able to run the command without password
#
# see this wiki page for information:
# - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)
#
# sudo yabai --load-sa
# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
# global settings
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse off
yabai -m config window_placement second_child
yabai -m config window_topmost off
yabai -m config window_shadow on
yabai -m config window_opacity off
yabai -m config window_opacity_duration 0.0
yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.90
yabai -m config window_border off
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 insert_feedback_color 0xffd75f5f
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 config mouse_drop_action swap
# general space settings
yabai -m config layout bsp
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 8
echo "yabai configuration loaded.."