Move to yabai, adapt skhd and bitbar configs

This commit is contained in:
Adam Goldsmith 2019-10-16 17:56:56 -04:00
parent a7b26b45ab
commit 324fbeec8f
5 changed files with 175 additions and 266 deletions

View File

@ -1,141 +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, profile, 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 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 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
chunkc set preselect_border_radius 0
chunkc set preselect_border_outline 0
#
# 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.
#
# NOTE: syntax for `focused_border_outline` setting
# 0 = false, inline border
# 1 = true, outline border
#
chunkc set focused_border_color 0xff0f6288
chunkc set focused_border_width 5
chunkc set focused_border_radius 0
chunkc set focused_border_outline 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
#
# 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 Emacs --except "^$|\*lsp-ui-doc-.*\*" --state tile &

35
.config/bitbar/chunkwm-ws.1s.py Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env python3
import json
import subprocess
CYAN='\033[0;36m'
BLUE='\033[0;34m'
NC='\033[0m'
YABAI = '/usr/local/bin/yabai'
desktops = json.loads(subprocess.check_output(
[YABAI, '-m', 'query', '--spaces']))
recent_desktop = json.loads(subprocess.check_output(
[YABAI, '-m', 'query', '--spaces', '--space', 'recent']))
def pick_color(desktop):
if desktop['focused']:
return CYAN
elif desktop == recent_desktop:
return BLUE
else:
return ''
print(' '.join([pick_color(d) + str(d['index']) + NC for d in desktops]))
# TODO: convert to python when yabai supports serialization
# echo '---'
# for i in ~/.chunkwm_layouts/*
# do
# echo "Load $(basename $i) | terminal=false bash='/usr/local/bin/chunkc' param1='tiling::desktop' param2='--deserialize' param3='$i'"
# echo "Save $(basename $i) | alternate=true terminal=false bash='/usr/local/bin/chunkc' param1='tiling::desktop' param2='--serialize' param3='$i'"
# done

View File

@ -1,34 +0,0 @@
#!/bin/bash
PATH="/usr/local/bin/:$PATH"
TEAL='\033[0;36m'
RED='\033[0;31m'
NC='\033[0m'
current_desktop=$(chunkc tiling::query --desktop id)
last_desktop=$(chunkc get _last_active_desktop)
monitor=$(chunkc tiling::query --monitor-for-desktop $current_desktop)
desktops=$(chunkc tiling::query --desktops-for-monitor $monitor)
highlighted=""
for desktop in $desktops
do
if (( $desktop == $current_desktop ))
then
highlighted+=" ${TEAL}$desktop${NC}"
elif (( $desktop == $last_desktop ))
then
highlighted+=" ${RED}$desktop${NC}"
else
highlighted+=" $desktop"
fi
done
echo -e ${highlighted}
echo "---"
for i in ~/.chunkwm_layouts/*
do
echo "Load $(basename $i) | terminal=false bash='/usr/local/bin/chunkc' param1='tiling::desktop' param2='--deserialize' param3='$i'"
echo "Save $(basename $i) | alternate=true terminal=false bash='/usr/local/bin/chunkc' param1='tiling::desktop' param2='--serialize' param3='$i'"
done

41
.config/yabai/yabairc Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
yabai -m config status_bar off
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_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 1
yabai -m config active_window_border_color 0xff0f6288
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
#yabai -m rule --add app=Finder title=Copy manage=off
#yabai -m rule --add app="App Store" manage=off
yabai -m rule --add app=Emacs manage=on
echo "yabai configuration loaded.."

190
.skhdrc
View File

@ -7,7 +7,7 @@ cmd + alt - f: osascript -e $'tell application "System Events" to tell process "
# close focused window
# note: with carabiner this is also 'cmd + shift - q'
cmd + alt - q : chunkc tiling::window --close
cmd + alt - q : yabai -m window --close
# Lock/turn off screen
# requires system setting "require password immediately after sleep or screen saver begins"
@ -15,124 +15,132 @@ ctrl + cmd - l : pmset displaysleepnow
ctrl + alt - l : pmset displaysleepnow
# focus window
cmd - h : chunkc tiling::window --focus west
cmd - j : chunkc tiling::window --focus south
cmd - k : chunkc tiling::window --focus north
cmd - l : chunkc tiling::window --focus east
cmd - h : yabai -m window --focus west
cmd - j : yabai -m window --focus south
cmd - k : yabai -m window --focus north
cmd - l : yabai -m window --focus east
# cmd - j : chunkc tiling::window --focus prev
# cmd - k : chunkc tiling::window --focus next
# equalize size of windows
shift + cmd - 0 : chunkc tiling::desktop --equalize
# balance size of windows
shift + cmd - 0 : yabai -m space --balance
# swap window
shift + alt + cmd - h : chunkc tiling::window --swap west
shift + alt + cmd - j : chunkc tiling::window --swap south
shift + alt + cmd - k : chunkc tiling::window --swap north
shift + alt + cmd - l : chunkc tiling::window --swap east
shift + alt + cmd - h : yabai -m window --swap west
shift + alt + cmd - j : yabai -m window --swap south
shift + alt + cmd - k : yabai -m window --swap north
shift + alt + cmd - l : yabai -m window --swap east
# move window
shift + cmd - h : chunkc tiling::window --warp west
shift + cmd - j : chunkc tiling::window --warp south
shift + cmd - k : chunkc tiling::window --warp north
shift + cmd - l : chunkc tiling::window --warp east
shift + cmd - h : yabai -m window --warp west
shift + cmd - j : yabai -m window --warp south
shift + cmd - k : yabai -m window --warp north
shift + cmd - l : yabai -m window --warp east
# create desktop, move window and follow focus
shift + cmd - n : chunkc tiling::desktop --create;\
id=$(chunkc tiling::query --desktops-for-monitor $(chunkc tiling::query --monitor-for-desktop $(chunkc tiling::query --desktop id)));\
chunkc tiling::window --send-to-desktop $(echo ${id##* });\
chunkc tiling::desktop --focus $(echo ${id##* })
# 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}"
# create desktop and follow focus
cmd + alt - n : chunkc tiling::desktop --create;\
id=$(chunkc tiling::query --desktops-for-monitor $(chunkc tiling::query --monitor-for-desktop $(chunkc tiling::query --desktop id)));\
chunkc tiling::desktop --focus $(echo ${id##* })
# destroy desktop
cmd + alt - w : chunkc tiling::desktop --annihilate
cmd + alt - w : yabai -m space --destroy
# fast focus desktop
cmd - tab : chunkc tiling::desktop --focus $(chunkc get _last_active_desktop)
cmd + alt - z : chunkc tiling::desktop --focus prev
cmd + alt - c : chunkc tiling::desktop --focus next
cmd - 1 : i=1; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 2 : i=2; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 3 : i=3; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 4 : i=4; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 5 : i=5; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 6 : i=6; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 7 : i=7; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 8 : i=8; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 9 : i=9; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - 0 : i=10; chunkc tiling::desktop --focus $(( $(chunkc tiling::query --desktop id) == $i ? $(chunkc get _last_active_desktop) : $i ))
cmd - tab : yabai -m space --focus recent
cmd - 1 : i=1; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 2 : i=2; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 3 : i=3; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 4 : i=4; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 5 : i=5; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 6 : i=6; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 7 : i=7; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 8 : i=8; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 9 : i=9; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
cmd - 0 : i=10; yabai -m space --focus $(yabai -m query --spaces --space $i | jq -r 'if .focused == 1 then "recent" else '$i' end')
# send window to desktop
shift + cmd - tab : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop)
shift + cmd - z : chunkc tiling::window --send-to-desktop prev
shift + cmd - c : chunkc tiling::window --send-to-desktop next
shift + cmd - 1 : chunkc tiling::window --send-to-desktop 1
shift + cmd - 2 : chunkc tiling::window --send-to-desktop 2
shift + cmd - 3 : chunkc tiling::window --send-to-desktop 3
shift + cmd - 4 : chunkc tiling::window --send-to-desktop 4
shift + cmd - 5 : chunkc tiling::window --send-to-desktop 5
shift + cmd - 6 : chunkc tiling::window --send-to-desktop 6
shift + cmd - 7 : chunkc tiling::window --send-to-desktop 7
shift + cmd - 8 : chunkc tiling::window --send-to-desktop 8
shift + cmd - 9 : chunkc tiling::window --send-to-desktop 9
shift + cmd - 0 : chunkc tiling::window --send-to-desktop 10
# send window to desktop and follow focus
shift + cmd - x : i=recent; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - z : i=prev; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - c : i=next; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 1 : i=1; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 2 : i=2; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 3 : i=3; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 4 : i=4; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 5 : i=5; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 6 : i=6; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 7 : i=7; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 8 : i=8; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 9 : i=9; yabai -m window --space $i; yabai -m space --focus $i
shift + cmd - 0 : i=10; yabai -m window --space $i; yabai -m space --focus $i
# increase region size
shift + alt - a : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge west
shift + alt - s : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge south
shift + alt - w : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge north
shift + alt - d : chunkc tiling::window --use-temporary-ratio 0.1 --adjust-window-edge east
# 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 region size
shift + cmd - a : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge west
shift + cmd - s : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge south
shift + cmd - w : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge north
shift + cmd - d : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge east
# 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 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
# 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
cmd + alt - r : chunkc tiling::desktop --rotate 90
cmd + alt - r : yabai -m space --rotate 90
# mirror tree y-axis
cmd + alt - y : chunkc tiling::desktop --mirror vertical
cmd + alt - y : yabai -m space --mirror y-axis
# mirror tree x-axis
cmd + alt - x : chunkc tiling::desktop --mirror horizontal
cmd + alt - x : yabai -m space --mirror x-axis
# toggle window fullscreen
cmd + alt - f : chunkc tiling::window --toggle fullscreen
# toggle window native fullscreen
cmd + alt + shift - f : chunkc tiling::window --toggle native-fullscreen
# toggle desktop offset
cmd + alt - a : yabai -m space --toggle padding; yabai -m space --toggle gap
# toggle window parent zoom
# alt - d : chunkc tiling::window --toggle parent
cmd + alt - d : yabai -m window --toggle zoom-parent
# toggle window fullscreen zoom
cmd + alt - f : yabai -m window --toggle zoom-fullscreen
# toggle window native fullscreen
cmd + shift + alt - f : yabai -m window --toggle native-fullscreen
# toggle window border
cmd + shift + alt - b : yabai -m window --toggle border
# toggle window split type
cmd + alt - e : chunkc tiling::window --toggle split
cmd + alt - e : yabai -m window --toggle split
# toggle window fade
# alt - q : chunkc tiling::window --toggle fade
# float / unfloat window and center on screen
cmd + shift - space : yabai -m window --toggle float
# toggle sticky
# alt - s : chunkc tiling::window --toggle sticky
# toggle sticky (show on all spaces)
cmd + alt - s : yabai -m window --toggle sticky
# float window
cmd + shift - space : chunkc tiling::window --toggle float
# toggle topmost (keep above other windows)
cmd + alt - o : yabai -m window --toggle topmost
# toggle sticky, topmost and resize to picture-in-picture size
# alt - p : yabai -m window --toggle sticky;\
# yabai -m window --toggle topmost;\
# yabai -m window --grid 5:5:4:0:1:1
# change layout of desktop
cmd + alt - a : chunkc tiling::desktop --layout bsp
cmd + alt - s : chunkc tiling::desktop --layout monocle
cmd + alt - d : chunkc tiling::desktop --layout float
# ctrl + alt - a : yabai -m space --layout bsp
# ctrl + alt - d : yabai -m space --layout float
cmd + alt - w : chunkc tiling::desktop --deserialize ~/.chunkwm_layouts/dev_1
# TODO: wait for yabai to have serialization
# shift + cmd + alt - f1 : chunkc tiling::desktop --serialize ~/.chunkwm_layouts/dev_1
# cmd + alt - f1 : chunkc tiling::desktop --deserialize ~/.chunkwm_layouts/dev_1