Skip to content

Instantly share code, notes, and snippets.

@geastwood
Last active March 15, 2019 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geastwood/235f3350a9d97a0ae0789b933baf9a27 to your computer and use it in GitHub Desktop.
Save geastwood/235f3350a9d97a0ae0789b933baf9a27 to your computer and use it in GitHub Desktop.
chunkwm+khd
#!/bin/bash
#
# NOTE: specify the desired level of logging.
#
# - none, debug, warn, error
#
chunkc core::log_level error
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
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 1
#
# NOTE: the following are config variables for the chunkwm-tiling plugin.
#
chunkc set global_desktop_mode monocle
chunkc set 2_desktop_mode bsp
chunkc set 3_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 10
chunkc set 3_desktop_offset_top 10
chunkc set 3_desktop_offset_bottom 10
chunkc set 3_desktop_offset_left 10
chunkc set 3_desktop_offset_right 10
chunkc set 3_desktop_offset_gap 20
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
#
# NOTE: shell commands require escaped quotes
# to pass value containing a whitespace.
#
# chunkc set mouse_modifier \"cmd shift\"
chunkc set mouse_modifier fn
chunkc set preselect_border_color 0xffd75f5f
chunkc set preselect_border_width 5
chunkc set preselect_border_radius 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.5
chunkc set window_use_cgs_move 0
#
# NOTE: the following are config variables for the chunkwm-border plugin.
#
chunkc set focused_border_color 0xaaff66cc
chunkc set focused_border_width 3
chunkc set focused_border_radius 0
chunkc set focused_border_skip_floating 0
#
# NOTE: specify plugins to load when chunkwm starts.
# if chunkc plugin_dir is not set, the absolutepath is necessary.
#
chunkc core::load border.so
chunkc core::load tiling.so
# chunkc core::load ffm.so
#
# NOTE: shell commands require escaped quotes
# to pass value containing a whitespace.
#
chunkc tiling::rule --owner Finder --state float
chunkc tiling::rule --owner Slack --desktop 2 --follow-desktop
chunkc tiling::rule --owner \"Microsoft Outlook\" --desktop 2 --follow-desktop
chunkc tiling::rule --owner \"Microsoft Outlook\" --name \".*Reminders\" --state float
chunkc tiling::rule --owner NordVPN --desktop 2 --follow-desktop
chunkc tiling::rule --owner Notes --desktop 2 --follow-desktop
chunkc tiling::rule --owner 1Password --desktop 2 --follow-desktop
chunkc tiling::rule --owner WeChat --desktop 3 --follow-desktop
chunkc tiling::rule --owner Discord --desktop 3 --follow-desktop
chunkc tiling::rule --owner Skype --desktop 3 --follow-desktop
chunkc tiling::rule --owner \"Skype for Business\" --desktop 4 --follow-desktop
# IntelliJ
chunkc tiling::rule --owner \"IntelliJ IDEA\" --state float
# chunkc tiling::rule --owner \"CLion\" --state native-fullscreen
# chunkc tiling::rule --owner \"PhpStorm\" --state native-fullscreen
chunkc tiling::rule --owner \"Android Studio\" --state native-fullscreen
chunkc tiling::rule --owner \"Code\" --state native-fullscreen
# chunkc tiling::rule --owner \"GoLand\" --state native-fullscreen
chunkc tiling::rule --name \"Tip of the Day\" --state float
chunkc tiling::rule --owner Giffy --state float
# Enable the prefix mode
khd mode prefix prefix on
khd mode prefix restore default
ctrl - t : khd -e "mode activate prefix"
khd mode prefix timeout 0.5
khd mode switcher prefix on
ctrl - y : khd -e "mode activate switcher"
khd mode switcher timeout 2
khd mode switcher restore default
switcher - h: osascript -e 'tell app "loginwindow" to «event aevtrsdn»'
switcher - r: osascript -e 'tell app "loginwindow" to «event aevtrrst»'
switcher - s: osascript -e 'tell app "System Events" to sleep'
# reload config
prefix - r : khd -e "reload"
# prefix - a : chunkc tiling::desktop --layout bsp
# prefix - s : chunkc tiling:desktop --layout monocle
# prefix - f : chunkc tiling::window --toggle float
cmd + ctrl - a : chunkc tiling::desktop --layout bsp
cmd + ctrl - s : chunkc tiling:desktop --layout monocle
cmd + ctrl - f : chunkc tiling::window --toggle float
# cmd + ctrl - w : /Users/feiliu/sh/toggle_app.sh `osascript -e 'tell application "System Events"' -e 'set frontApp to name of first application process whose frontmost is true' -e 'end tell'`
# focus window
cmd + alt - h : chunkc tiling::window --focus west
cmd + alt - j : chunkc tiling::window --focus south
cmd + alt - k : chunkc tiling::window --focus north
cmd + alt - l : chunkc tiling::window --focus east
# equalize size of windows
cmd + alt - 0 : chunkc tiling::desktop --equalize
# swap window
# shift + alt - h : chunkc tiling::window --swap west
# shift + alt - j : chunkc tiling::window --swap south
# shift + alt - k : chunkc tiling::window --swap north
# shift + alt - l : chunkc tiling::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
# send window to desktop
# shift + alt - x : chunkc tiling::window --send-to-desktop $(chunkc get _last_active_desktop)
# prefix - z : chunkc tiling::window --send-to-desktop prev
# prefix - c : chunkc tiling::window --send-to-desktop next
prefix - 1 : chunkc tiling::window --send-to-desktop 1
prefix - 2 : chunkc tiling::window --send-to-desktop 2
prefix - 3 : chunkc tiling::window --send-to-desktop 3
prefix - 4 : chunkc tiling::window --send-to-desktop 4
prefix - 5 : chunkc tiling::window --send-to-desktop 5
prefix - 6 : chunkc tiling::window --send-to-desktop 6
# switch to last active desktop
cmd + alt - x : `id=$(chunkc get _last_active_desktop); khd -p "cmd + alt - $id" &> /dev/null`
# focus monitor
ctrl + alt - z : chunkc tiling::monitor -f prev
ctrl + alt - c : chunkc tiling::monitor -f next
ctrl + alt - 1 : chunkc tiling::monitor -f 1
ctrl + alt - 2 : chunkc tiling::monitor -f 2
# send window to monitor and follow focus
ctrl + cmd - 1 : chunkc tiling::window --send-to-monitor 1; khd -p "cmd + alt - 1"
ctrl + cmd - 2 : chunkc tiling::window --send-to-monitor 2; khd -p "cmd + alt - 2"
# ctrl + cmd - 3 : chunkc tiling::window --send-to-monitor 3; khd -p "cmd + alt - 3"
# 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
# decrease region size
shift + cmd - d : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge east
shift + cmd - w : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge south
shift + cmd - s : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge north
shift + cmd - a : chunkc tiling::window --use-temporary-ratio -0.1 --adjust-window-edge east
# 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
# rotate tree
alt - r : chunkc tiling::desktop --rotate 90
# mirror tree y-axis
alt - y : chunkc tiling::desktop --mirror vertical
# mirror tree x-axis
alt - x : chunkc tiling::desktop --mirror horizontal
# toggle desktop offset
# alt - a : chunkc tiling::desktop --toggle offset
# toggle window fullscreen
# alt - f : chunkc tiling::window --toggle fullscreen
# toggle window native fullscreen
shift + alt - f : chunkc tiling::window --toggle native-fullscreen
# toggle window parent zoom
alt - d : chunkc tiling::window --toggle parent
# toggle window split type
# alt - e : chunkc tiling::window --toggle split
# toggle sticky, float and resize to picture-in-picture size
alt - s : chunkc tiling::window --toggle sticky;\
chunkc tiling::window --warp-floating pip-right
# float next window to be tiled
shift + alt - t : chunkc set window_float_next 1
# remap caps-lock to escape for this config only !!!
# macos sierra can also perform this remap for a given keyboard
# capslock : khd -p "- escape"
# Application shotcut
prefix - o: open /Applications/Microsoft\ Outlook.app
prefix - k: open /Applications/Slack.app
prefix - c: /Users/feiliu/sh/toggle_app.sh "Google Chrome"
prefix - w: /Users/feiliu/sh/toggle_app.sh "WeChat"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment