Migrate from chunkwm, which is no longer maintained, to yabai, which is still maintained (yay)

This commit is contained in:
Danielle McLean 2019-09-24 13:56:40 +10:00
parent 8036df0164
commit 8699cdf3f7
Signed by: 00dani
GPG key ID: FF6F9216852288FF
5 changed files with 185 additions and 327 deletions

View file

@ -1,31 +0,0 @@
#!/bin/zsh
# <bitbar.title>chunkwm mode</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Danielle McLean</bitbar.author>
# <bitbar.author.github>00dani</bitbar.author.github>
# <bitbar.desc>Display current desktop ID and layout from chunkwm.</bitbar.desc>
# <bitbar.dependencies>brew,chunkwm</bitbar.dependencies>
# For info about chunkwm, see: https://github.com/koekeishiya/chunkwm
chunkc=/usr/local/bin/chunkc
modes=(
bsp 🌳
monocle 🔍
float ⛵
)
typeset -A icons
icons=($modes)
id=$($chunkc tiling::query --desktop id)
mode=$($chunkc tiling::query --desktop mode)
print -l "$icons[$mode] $id" "---"
for m i in $modes; do
if [[ $mode = $m ]]; then
print $i $m
else
print "$i $m | terminal=false bash=$chunkc param1=tiling::desktop param2=--layout param3=$m"
fi
done

32
config/bitbar/bin/yabai.1s.zsh Executable file
View file

@ -0,0 +1,32 @@
#!/bin/zsh
# <bitbar.title>yabai mode</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Danielle McLean</bitbar.author>
# <bitbar.author.github>00dani</bitbar.author.github>
# <bitbar.desc>Display current desktop ID and layout from yabai.</bitbar.desc>
# <bitbar.dependencies>brew,yabai</bitbar.dependencies>
# For info about yabai, see: https://github.com/koekeishiya/yabai
path=(/usr/local/bin $path)
yabai==yabai
modes=(
bsp 🌳
monocle 🔍
float ⛵
)
typeset -A icons
icons=($modes)
yabai -m query --spaces | jq -r 'map(select(.focused == 1))[-1] | (.index | tostring) + " " + .type' | read id mode
print -l "$icons[$mode] $id" "---"
for m i in $modes; do
if [[ $mode = $m ]]; then
print $i $m
else
print "$i $m | terminal=false bash=$yabai param1=-m param2=space param3=--layout param4=$m"
fi
done

View file

@ -1,140 +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 stdout
#
# NOTE: specify the desired level of logging.
#
# - none, debug, warn, error
#
chunkc core::log_level warn
#
# NOTE: specify the absolutepath to the directory to use when loading a plugin.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/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 20
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 0
chunkc set global_desktop_offset_bottom 0
chunkc set global_desktop_offset_left 0
chunkc set global_desktop_offset_right 0
chunkc set global_desktop_offset_gap 0
#
# 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 10.0
chunkc set desktop_gap_step_size 5.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 monitor
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 1
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 1
#
# 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 0
chunkc set focused_border_skip_floating 0
chunkc set focused_border_skip_monocle 0
#
# 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
chunkc tiling::rule --owner Fantastical --state float &
chunkc tiling::rule --owner Tweetbot --name '"New Tweet"' --state float &
#
# NOTE: sample rules for the tiling plugin
#
chunkc tiling::rule --owner \"PhpStorm\" --except "~/projects/" --state float &
chunkc tiling::rule --owner \"IntelliJ IDEA\" --except "~/projects/" --state float &
chunkc tiling::rule --owner Finder --name Copy --state float &
chunkc tiling::rule --owner \"App Store\" --state float &
chunkc tiling::rule --owner Emacs --except "^$" --state tile &

View file

@ -1,193 +1,147 @@
# NOTE(koekeishiya): 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> ':' <command> | <keysym> '->' ':' <command>
# <keysym> ';' <mode> | <keysym> '->' ';' <mode>
#
# keysym = <mod> '-' <key> | <key>
#
# mod = 'built-in mod keyword' | <mod> '+' <mod>
#
# key = <literal> | <keycode>
#
# literal = 'single letter or built-in keyword'
#
# keycode = 'apple keyboard kVK_<Key> values (0x3C)'
#
# -> = keypress is not consumed by skhd
#
# 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.
#
#
# NOTE(koekeishiya): 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.
# add an on_enter command to the default mode
# :: default : chunkc border::color 0xff775759
#
# defines a new mode 'test' with an on_enter command, that captures keypresses
# :: test @ : chunkc border::color 0xff24ccaa
#
# from 'default' mode, activate mode 'test'
# cmd - x ; test
#
# from 'test' mode, activate mode 'default'
# test < cmd - x ; default
#
# launch a new terminal instance when in either 'default' or 'test' mode
# default, test < cmd - return : open -na /Applications/Terminal.app
# open terminal
rctrl - return : ~/.local/bin/kit new-window --window-type os
# open qutebrowser
rctrl + shift - return : ~/.local/bin/qtb
# close focused window
rctrl - q : chunkc tiling::window --close
# focus window
rctrl - j : chunkc tiling::window --focus next
rctrl - k : chunkc tiling::window --focus prev
rctrl - j : yabai -m window --focus next
rctrl - k : yabai -m window --focus prev
cmd - tab : yabai -m window --focus prev
cmd + shift - tab : yabai -m window --focus next
cmd - tab : chunkc tiling::window --focus prev
cmd + shift - tab : chunkc tiling::window --focus next
# swap window
rctrl + shift - j : yabai -m window --swap next
rctrl + shift - k : yabai -m window --swap north
# equalize size of windows (mod+=)
rctrl - 0x18 : chunkc tiling::desktop --equalize
# move window
rctrl + shift - j : chunkc tiling::window --warp next
rctrl + shift - k : chunkc tiling::window --warp prev
# balance size of windows (mod =)
rctrl - 0x18 : yabai -m space --balance
# make floating window fill screen
shift + alt - up : chunkc tiling::window --grid-layout 1:1:0:0:1:1
shift + alt - up : yabai -m window --grid 1:1:0:0:1:1
# make floating window fill left-half of screen
shift + alt - left : chunkc tiling::window --grid-layout 1:2:0:0:1:1
shift + alt - left : yabai -m window --grid 1:2:0:0:1:1
# make floating window fill right-half of screen
shift + alt - right : chunkc tiling::window --grid-layout 1:2:1:0:1:1
shift + alt - right : yabai -m window --grid 1:2:1: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}"
# create desktop and follow focus - uses jq for parsing json (brew install jq)
cmd + alt - n : yabai -m space --create && \
index="$(yabai -m query --spaces --display | jq 'map(select(."native-fullscreen" == 0))[-1].index')" && \
yabai -m space --focus "${index}"
# destroy desktop
cmd + alt - w : yabai -m space --destroy
# fast focus desktop
rctrl - x : chunkc tiling::desktop --focus $(chunkc get _last_active_desktop)
rctrl - z : chunkc tiling::desktop --focus prev
rctrl - c : chunkc tiling::desktop --focus next
rctrl - 1 : chunkc tiling::desktop --focus 1
rctrl - 2 : chunkc tiling::desktop --focus 2
rctrl - 3 : chunkc tiling::desktop --focus 3
rctrl - 4 : chunkc tiling::desktop --focus 4
rctrl - 5 : chunkc tiling::desktop --focus 5
rctrl - 6 : chunkc tiling::desktop --focus 6
# send window to desktop
rctrl + shift - x : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop)
rctrl + shift - z : chunkc tiling::window --send-to-desktop prev
rctrl + shift - c : chunkc tiling::window --send-to-desktop next
rctrl + shift - 1 : chunkc tiling::window --send-to-desktop 1
rctrl + shift - 2 : chunkc tiling::window --send-to-desktop 2
rctrl + shift - 3 : chunkc tiling::window --send-to-desktop 3
rctrl + shift - 4 : chunkc tiling::window --send-to-desktop 4
rctrl + shift - 5 : chunkc tiling::window --send-to-desktop 5
rctrl + shift - 6 : chunkc tiling::window --send-to-desktop 6
rctrl - x : yabai -m space --focus recent
rctrl - z : yabai -m space --focus prev
rctrl - c : yabai -m space --focus next
rctrl - 1 : yabai -m space --focus 1
rctrl - 2 : yabai -m space --focus 2
rctrl - 3 : yabai -m space --focus 3
rctrl - 4 : yabai -m space --focus 4
rctrl - 5 : yabai -m space --focus 5
rctrl - 6 : yabai -m space --focus 6
rctrl - 7 : yabai -m space --focus 7
rctrl - 8 : yabai -m space --focus 8
rctrl - 9 : yabai -m space --focus 9
rctrl - 0 : yabai -m space --focus 10
# send window to desktop and follow focus
# shift + cmd - x : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop); chunkc tiling::desktop --focus $(chunkc get _last_active_desktop)
# shift + cmd - z : chunkc tiling::window --send-to-desktop prev; chunkc tiling::desktop --focus prev
# shift + cmd - c : chunkc tiling::window --send-to-desktop next; chunkc tiling::desktop --focus next
# shift + cmd - 1 : chunkc tiling::window --send-to-desktop 1; chunkc tiling::desktop --focus 1
# shift + cmd - 2 : chunkc tiling::window --send-to-desktop 2; chunkc tiling::desktop --focus 2
# shift + cmd - 3 : chunkc tiling::window --send-to-desktop 3; chunkc tiling::desktop --focus 3
# shift + cmd - 4 : chunkc tiling::window --send-to-desktop 4; chunkc tiling::desktop --focus 4
# shift + cmd - 5 : chunkc tiling::window --send-to-desktop 5; chunkc tiling::desktop --focus 5
# shift + cmd - 6 : chunkc tiling::window --send-to-desktop 6; chunkc tiling::desktop --focus 6
# shift + cmd - 7 : chunkc tiling::window --send-to-desktop 7; chunkc tiling::desktop --focus 7
shift + cmd - x : yabai -m window --space recent; yabai -m space --focus recent
shift + cmd - z : yabai -m window --space prev; yabai -m space --focus prev
shift + cmd - c : yabai -m window --space next; yabai -m space --focus next
shift + rctrl - 1 : yabai -m window --space 1; yabai -m space --focus 1
shift + rctrl - 2 : yabai -m window --space 2; yabai -m space --focus 2
shift + rctrl - 3 : yabai -m window --space 3; yabai -m space --focus 3
shift + rctrl - 4 : yabai -m window --space 4; yabai -m space --focus 4
shift + rctrl - 5 : yabai -m window --space 5; yabai -m space --focus 5
shift + rctrl - 6 : yabai -m window --space 6; yabai -m space --focus 6
shift + rctrl - 7 : yabai -m window --space 7; yabai -m space --focus 7
shift + rctrl - 8 : yabai -m window --space 8; yabai -m space --focus 8
shift + rctrl - 9 : yabai -m window --space 9; yabai -m space --focus 9
shift + rctrl - 0 : yabai -m window --space 10; yabai -m space --focus 10
# focus monitor
rctrl - w : chunkc tiling::monitor -f 1
rctrl - e : chunkc tiling::monitor -f 2
rctrl - r : chunkc tiling::monitor -f 3
rctrl - w : yabai -m display --focus 1
rctrl - e : yabai -m display --focus 2
rctrl - r : yabai -m display --focus 3
# send window to monitor and follow focus
rctrl + shift - w : chunkc tiling::window --send-to-monitor 1; chunkc tiling::monitor -f 1
rctrl + shift - e : chunkc tiling::window --send-to-monitor 2; chunkc tiling::monitor -f 2
rctrl + shift - r : chunkc tiling::window --send-to-monitor 3; chunkc tiling::monitor -f 3
rctrl + shift - w : yabai -m window --display 1; yabai -m display --focus 1
rctrl + shift - e : yabai -m window --display 2; yabai -m display --focus 2
rctrl + shift - r : yabai -m window --display 3; yabai -m display --focus 3
# set insertion point for focused container
# ctrl + alt - f : chunkc tiling::window --use-insertion-point cancel
# ctrl + alt - h : chunkc tiling::window --use-insertion-point west
# ctrl + alt - j : chunkc tiling::window --use-insertion-point south
# ctrl + alt - k : chunkc tiling::window --use-insertion-point north
# ctrl + alt - l : chunkc tiling::window --use-insertion-point east
# move window
shift + ctrl - a : yabai -m window --move rel:-20:0
shift + ctrl - s : yabai -m window --move rel:0:20
shift + ctrl - w : yabai -m window --move rel:0:-20
shift + ctrl - d : yabai -m window --move rel:20:0
# increase window size
shift + alt - a : yabai -m window --resize left:-20:0
shift + alt - s : yabai -m window --resize bottom:0:20
shift + alt - w : yabai -m window --resize top:0:-20
shift + alt - d : yabai -m window --resize right:20:0
# decrease window size
shift + cmd - a : yabai -m window --resize left:20:0
shift + cmd - s : yabai -m window --resize bottom:0:-20
shift + cmd - w : yabai -m window --resize top:0:20
shift + cmd - d : yabai -m window --resize right:-20:0
# set insertion point in focused container
ctrl + alt - h : yabai -m window --insert west
ctrl + alt - j : yabai -m window --insert south
ctrl + alt - k : yabai -m window --insert north
ctrl + alt - l : yabai -m window --insert east
# rotate tree
rctrl - space : chunkc tiling::desktop --rotate 90
alt - r : yabai -m space --rotate 90
# mirror tree
rctrl - m : chunkc tiling::desktop --mirror horizontal
rctrl + shift - m : chunkc tiling::desktop --mirror vertical
# mirror tree y-axis
alt - y : yabai -m space --mirror y-axis
# mirror tree x-axis
alt - x : yabai -m space --mirror x-axis
# toggle desktop offset
# alt - a : chunkc tiling::desktop --toggle offset
# toggle window fullscreen
rctrl - f : chunkc tiling::window --toggle fullscreen
# toggle window native fullscreen
rctrl + shift - f : chunkc tiling::window --toggle native-fullscreen
alt - a : yabai -m space --toggle padding; yabai -m space --toggle gap
# toggle window parent zoom
alt - d : chunkc tiling::window --toggle parent
alt - d : yabai -m window --toggle zoom-parent
# toggle window fade
alt - q : chunkc tiling::window --toggle fade
# toggle window fullscreen zoom
alt - f : yabai -m window --toggle zoom-fullscreen
# toggle window native fullscreen
shift + alt - f : yabai -m window --toggle native-fullscreen
# toggle window border
shift + alt - b : yabai -m window --toggle border
# toggle window split type
alt - e : yabai -m window --toggle split
# float / unfloat window and center on screen
alt - t : chunkc tiling::window --toggle float;\
chunkc tiling::window --grid-layout 4:4:1:1:2:2
alt - t : yabai -m window --toggle float;\
yabai -m window --grid 4:4:1:1:2:2
# toggle sticky
alt - s : yabai -m window --toggle sticky
# toggle sticky, float and resize to picture-in-picture size
alt - s : chunkc tiling::window --toggle sticky;\
chunkc tiling::window --grid-layout 5:5:4:0:1:1
# float next window to be tiled
# shift + alt - t : chunkc set window_float_next 1
alt - p : yabai -m window --toggle sticky;\
yabai -m window --grid 5:5:4:0:1:1
# change layout of desktop
rctrl - a : chunkc tiling::desktop --layout bsp
rctrl - s : chunkc tiling::desktop --layout monocle
rctrl - d : chunkc tiling::desktop --layout float
rctrl - a : yabai -m space --layout bsp
rctrl - d : yabai -m space --layout float
play : mpc toggle
rewind : mpc cdprev

43
config/yabai/yabairc Executable file
View file

@ -0,0 +1,43 @@
#!/usr/bin/env sh
# bar settings
yabai -m config status_bar off
yabai -m config status_bar_text_font "Helvetica Neue:Bold:12.0"
yabai -m config status_bar_icon_font "Font Awesome 5 Pro:Regular:12.0"
yabai -m config status_bar_background_color 0xff202020
yabai -m config status_bar_foreground_color 0xffa8a8a8
yabai -m config status_bar_space_icon_strip I II III IV V VI VII VIII IX X
yabai -m config status_bar_power_icon_strip  
yabai -m config status_bar_space_icon 
yabai -m config status_bar_clock_icon 
# global settings
yabai -m config mouse_follows_focus on
yabai -m config focus_follows_mouse on
yabai -m config window_placement second_child
yabai -m config window_topmost on
yabai -m config window_opacity off
yabai -m config window_opacity_duration 0.0
yabai -m config window_shadow on
yabai -m config window_border on
yabai -m config window_border_width 2
yabai -m config active_window_border_color 0xff775759
yabai -m config normal_window_border_color 0xff505050
yabai -m config insert_window_border_color 0xffd75f5f
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
# general space settings
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
echo "yabai configuration loaded.."